generated from cisco-ospo/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding init 1.2.0 changes * controller changes * controller rewrite to support pod labels * agent now supports podlables, configurable prometheus, plugin auto discover * chart changes to support new features * updating CONTRIBUTING doc with accurate info * restapi changes - wip * latest dev images in chart * restapi changes * restapi fix * bug fix for controller; restapi fix; remove binary * restapi chages for new ui; bug fixes; version in configs * refactor Makefiles, move to alpine * more dockerfile changes * small redis refactor, restapi detect redis.nil er * bug fixes and prep for ui, using protojson instead of json * remove multi-platform build * Fix SelectRandomAgent * Remove all buildfiles before building docker-all * fix bug with controller, export CRD status to redis * plugin discovery chagnes * fix controller not updating redis if there are errs * label and ns matching for agents, beter prom labels, py test * move to buf for proto generation, add plugin back to summary * python text experiment * working python test, bug fixes * python module * remove python cache * adding pyproject.toml * update pyproject * more python development, bug fixes * fix python wrapper * fix python wrapper * fully working python plugin - json-ping * push.sh file * Create README.md * merge Dockerfiles, use build stages * chore: create missing directories * fix bug where agent wont purge deleted test correctly * chart chages and local testing configs * chart image fix * more docs - deployment models, logo, local debugging * Markdown linting * mnore Markdown linting * mnore Markdown linting --------- Co-authored-by: bakshi41c <bakshi41c@gmail.com> Co-authored-by: BlitzQuiche <kieran.shave@live.com> Co-authored-by: Marwa Ouled El Hadj Ali <mouledel@cisco.com>
- Loading branch information
1 parent
d6bf0fb
commit 081c80c
Showing
87 changed files
with
3,900 additions
and
1,536 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,32 @@ | ||
default: all | ||
GOFLAGS=-ldflags=-w -ldflags=-s | ||
SYNTEST_PLUGIN_SUBDIRS = $(notdir $(wildcard ./agent/plugins/syntests/*)) | ||
|
||
LOCAL_BUILD_PATH=./bin | ||
|
||
## Proto | ||
build-go-proto: | ||
@echo Building Golang proto files... | ||
protoc --go_out=plugins=grpc:common/proto/ common/proto/syntest.proto --proto_path=common/proto/ | ||
|
||
## Agent | ||
build-go-syntest-plugins: | ||
@echo "Building Go syntest plugins" | ||
cd agent && \ | ||
for dir in $(SYNTEST_PLUGIN_SUBDIRS); do \ | ||
echo "Building plugin: $$dir" && \ | ||
CGO_ENABLED=0 go build $(GOFLAGS) -o $(LOCAL_BUILD_PATH)/plugins/test-$$dir ./plugins/syntests/$$dir/ && \ | ||
echo "$$dir compiled!" || { echo "$$dir failed!"; exit 1; }; \ | ||
done | ||
|
||
build-agent-only: | ||
@echo "Building agent" | ||
cd agent && CGO_ENABLED=0 go build $(GOFLAGS) -o $(LOCAL_BUILD_PATH)/agent . | ||
|
||
.PHONY: build-agent | ||
build-agent: build-agent-only build-go-syntest-plugins | ||
default: docker-all | ||
|
||
.PHONY: docker-agent | ||
docker-agent: | ||
@echo "Building agent container image" | ||
cd agent && podman build -f Dockerfile -t synheart-agent:dev_latest .. | ||
cd agent && podman build -f Dockerfile --target base -t synheart-agent:dev-latest-no-plugins .. | ||
cd agent && podman build -f Dockerfile --target base-with-go-plugins -t synheart-agent:dev-latest .. | ||
|
||
## Rest Api | ||
build-restapi: | ||
@echo "Building restapi binary" | ||
cd restapi && CGO_ENABLED=0 go build $(GOFLAGS) -o $(LOCAL_BUILD_PATH)/restapi . | ||
.PHONY: docker-agent-py | ||
docker-agent-py: | ||
@echo "Building python agent container image (Experimental)" | ||
cd agent && podman build -f Dockerfile --target base-with-python-plugins -t synheart-agent:dev-latest-with-py .. | ||
|
||
.PHONY: docker-restapi | ||
docker-restapi: | ||
@echo "Building restapi container image" | ||
cd restapi && podman build -f Dockerfile -t synheart-restapi:dev_latest .. | ||
cd restapi && podman build -f Dockerfile -t synheart-restapi:dev-latest .. | ||
|
||
## Controller | ||
.PHONY: docker-controller | ||
docker-controller: | ||
@echo "Building controller container image" | ||
cd controller && podman build -f Dockerfile -t synheart-controller:dev_latest .. | ||
cd controller && podman build -f Dockerfile -t synheart-controller:dev-latest .. | ||
|
||
.PHONY : docker-all | ||
docker-all: docker-agent docker-restapi docker-controller | ||
|
||
#.PHONY : test | ||
#test: build-dummy-test-plugins build-syn-heart | ||
# go test -race -v synthetic-heart/agent | ||
# go test -race -v synthetic-heart/broadcaster | ||
|
||
|
||
## SDK - Creating new syntest plugin | ||
.PHONY : new-go-test | ||
new-go-test: | ||
@echo Creating Directory plugins/syntests/$(name) | ||
mkdir agent/plugins/syntests/$(name) | ||
|
||
@echo Creating file plugins/syntests/$(name)/$(name).go | ||
cp agent/plugins/templates/go/test.tpl.go plugins/syntests/$(name)/$(name).go | ||
|
||
sed -i .backup s/{{TestName}}/$(call capitalize,$(name))/g plugins/syntests/$(name)/$(name).go | ||
rm agent/plugins/syntests/$(name)/$(name).go.backup | ||
|
||
docker-all: clean docker-agent docker-agent-py docker-restapi docker-controller | ||
|
||
.PHONY : clean | ||
clean: | ||
rm -rf agent/bin | ||
rm -rf controller/bin | ||
rm -rf restapi/bin | ||
|
||
define capitalize | ||
$(shell echo $(1) | awk '{$$1=toupper(substr($$1,0,1))substr($$1,2); print $$0}') | ||
endef | ||
rm -rf restapi/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,52 @@ | ||
GOFLAGS=-ldflags=-w -ldflags=-s | ||
SYNTEST_PLUGIN_SUBDIRS = $(notdir $(wildcard ./plugins/syntests/*)) | ||
LOCAL_BUILD_PATH=./bin | ||
|
||
## Agent | ||
build-go-syntest-plugins: | ||
@echo "Building Go syntest plugins" | ||
for dir in $(SYNTEST_PLUGIN_SUBDIRS); do \ | ||
echo "Building plugin: $$dir" && \ | ||
CGO_ENABLED=0 go build $(GOFLAGS) -o $(LOCAL_BUILD_PATH)/plugins/test-$$dir ./plugins/syntests/$$dir/ && \ | ||
echo "$$dir compiled!" || { echo "$$dir failed!"; exit 1; }; \ | ||
done | ||
|
||
build-agent-only: | ||
@echo "Building agent" | ||
CGO_ENABLED=0 go build $(GOFLAGS) -ldflags="-X main.Version=$(SYNHEART_VERSION)" -o $(LOCAL_BUILD_PATH)/agent . | ||
|
||
.PHONY: build-agent | ||
build-agent: build-agent-only build-go-syntest-plugins | ||
|
||
## SDK - Creating new syntest plugin | ||
.PHONY : new-go-syntest | ||
new-go-syntest: | ||
@echo Creating Directory plugins/syntests/$(name) | ||
mkdir agent/plugins/syntests/$(name) | ||
mkdir plugins/syntests/$(name) | ||
|
||
@echo Creating file plugins/syntests/$(name)/$(name).go | ||
cp agent/plugins/templates/go/test.tpl.go plugins/syntests/$(name)/$(name).go | ||
cp plugins/templates/go/test.tpl.go plugins/syntests/$(name)/$(name).go | ||
|
||
sed -i s/{{TestNameRaw}}/$(name)/g plugins/syntests/$(name)/$(name).go | ||
sed -i s/{{TestName}}/$(call capitalize,$(name))/g plugins/syntests/$(name)/$(name).go | ||
|
||
sed -i .backup s/{{TestName}}/$(call capitalize,$(name))/g plugins/syntests/$(name)/$(name).go | ||
rm agent/plugins/syntests/$(name)/$(name).go.backup | ||
.PHONY : new-python-syntest | ||
new-python-syntest: | ||
@echo Creating Directory plugins/syntests-python/$(name) | ||
mkdir -p plugins/syntests-python/$(name) | ||
|
||
@echo Creating file plugins/syntests/$(name)/$(name).py | ||
cp plugins/templates/python/test.tpl.py plugins/syntests-python/$(name)/test-$(name).py | ||
cp plugins/templates/python/requirements.txt plugins/syntests-python/$(name)/requirements.txt | ||
|
||
echo $(call camelcase,$(name)) | ||
|
||
sed -i s/{{TestName}}/$(call camelcase,$(name))/g plugins/syntests-python/$(name)/test-$(name).py | ||
|
||
define capitalize | ||
$(shell echo $(1) | awk '{$$1=toupper(substr($$1,0,1))substr($$1,2); print $$0}') | ||
endef | ||
|
||
define camelcase | ||
$(shell echo $(1) | awk 'BEGIN{FS="";RS="-";ORS=""} {$$0=toupper(substr($$0,1,1)) substr($$0,2)} 1') | ||
endef |
Oops, something went wrong.