diff --git a/.mk/development.mk b/.mk/development.mk index 7fb310edd..18a5f1144 100644 --- a/.mk/development.mk +++ b/.mk/development.mk @@ -58,8 +58,14 @@ undeploy-grafana: ## Undeploy grafana. kubectl delete --ignore-not-found=true configMap grafana-datasources -pkill --oldest --full "3000:3000" +.PHONY: deploy-infra +deploy-infra: manifests generate fmt lint deploy-loki deploy-grafana install + .PHONY: deploy-all -deploy-all: manifests generate fmt lint deploy-loki deploy-grafana install deploy-sample-cr +deploy-all: deploy-infra deploy-sample-cr deploy-sample-workload + +.PHONY: undeploy-infra +undeploy-infra: undeploy-loki undeploy-grafana uninstall .PHONY: undeploy-all -undeploy-all: undeploy-loki undeploy-grafana uninstall undeploy-sample-cr +undeploy-all: undeploy-infra undeploy-sample-cr undeploy-sample-workload diff --git a/.mk/local.mk b/.mk/local.mk index c3949c161..2d53c9bb9 100644 --- a/.mk/local.mk +++ b/.mk/local.mk @@ -10,7 +10,7 @@ delete-kind-cluster: $(KIND) ## Delete kind cluster $(KIND) delete cluster .PHONY: local-deploy -local-deploy: create-kind-cluster deploy-all ## Local deploy (kind, loki, grafana and example-cr excluding the operator) +local-deploy: create-kind-cluster deploy-all ## Local deploy (kind, loki, grafana, example-cr and sample-workload excluding the operator) .PHONY: clean-leftovers clean-leftovers: @@ -18,7 +18,7 @@ clean-leftovers: -kubectl delete namespace network-observability .PHONY: local-redeploy -local-redeploy: clean-leftovers undeploy-all deploy-all ## Local re-deploy (loki, grafana and example-cr excluding the operator) +local-redeploy: clean-leftovers undeploy-all deploy-all ## Local re-deploy (loki, grafana, example-cr and sample-workload excluding the operator) .PHONY: local-undeploy local-undeploy: clean-leftovers undeploy-all delete-kind-cluster ## Local cleanup diff --git a/.mk/ocp.mk b/.mk/ocp.mk index 78795ca58..d16ecc1bb 100644 --- a/.mk/ocp.mk +++ b/.mk/ocp.mk @@ -1,7 +1,7 @@ ##@ OCP -.PHONY: ocp-expose -ocp-expose: +.PHONY: ocp-expose-infra +ocp-expose-infra: oc expose service grafana || true @grafana_url=$$(oc get route grafana -o jsonpath='{.spec.host}'); \ echo -e "\nAccess grafana on OCP using: http://"$$grafana_url"\n" @@ -9,8 +9,17 @@ ocp-expose: @loki_url=$$(oc get route loki -o jsonpath='{.spec.host}'); \ echo -e "\nAccess loki on OCP using: http://"$$loki_url"\n" +.PHONY: ocp-expose-all +ocp-expose-all: ocp-expose-infra + oc expose -n sample-workload service frontend-external || true + @sample_workload_url=$$(oc get -n sample-workload route frontend-external -o jsonpath='{.spec.host}'); \ + echo -e "\nAccess sample workload on OCP using: http://"$$sample_workload_url"\n" + +.PHONY: ocp-deploy-infra +ocp-deploy-infra: deploy-infra ocp-expose-infra ## OCP infra. deploy (only loki and grafana excluding the operator) + .PHONY: ocp-deploy -ocp-deploy: deploy-all ocp-expose ## OCP deploy (loki, grafana and example-cr excluding the operator) +ocp-deploy: deploy-all ocp-expose-all ## OCP deploy (loki, grafana, example-cr and sample-workload excluding the operator) .PHONY: ocp-undeploy ocp-undeploy: undeploy-all ## OCP cleanup diff --git a/.mk/sample.mk b/.mk/sample.mk index b8c092377..b5256b3a4 100644 --- a/.mk/sample.mk +++ b/.mk/sample.mk @@ -1,9 +1,28 @@ # Deploy the sample FlowCollector CR .PHONY: deploy-sample-cr deploy-sample-cr: + @echo -e "\n==> Deploy sample CR" sed -e 's~:main~:$(VERSION)~' ./config/samples/flows_v1alpha1_flowcollector.yaml | kubectl apply -f - || true # Undeploy the sample FlowCollector CR .PHONY: undeploy-sample-cr undeploy-sample-cr: + @echo -e "\n==> Undeploy sample CR" sed -e 's~:main~:$(VERSION)~' ./config/samples/flows_v1alpha1_flowcollector.yaml | kubectl --ignore-not-found=true delete -f - || true + +# Deploy sample workload +.PHONY: deploy-sample-workload +deploy-sample-workload: + @echo -e "\n==> Deploy sample workload" + -kubectl create namespace sample-workload + kubectl -n sample-workload apply -f https://raw.githubusercontent.com/GoogleCloudPlatform/microservices-demo/main/release/kubernetes-manifests.yaml + kubectl -n sample-workload run syn-flood --privileged --image=bilalcaliskan/syn-flood:latest --restart=Never -- --host frontend-external.sample-workload.svc.cluster.local --port 80 --floodType syn + +# undeploy sample workload +.PHONY: undeploy-sample-workload +undeploy-sample-workload: + @echo -e "\n==> Undeploy sample workload" + kubectl -n sample-workload delete --ignore-not-found=true -f https://raw.githubusercontent.com/GoogleCloudPlatform/microservices-demo/main/release/kubernetes-manifests.yaml + -kubectl -n sample-workload delete --ignore-not-found=true pod syn-flood + -kubectl delete --ignore-not-found=true namespace sample-workload +