From 8275dd68c379a3793999de51146a256c0f0f63ed Mon Sep 17 00:00:00 2001 From: Joel Takvorian Date: Tue, 13 Aug 2024 14:32:44 +0200 Subject: [PATCH] Test console improvements (#736) - Remove the requirement to build our own image (requires https://github.com/netobserv/network-observability-console-plugin/pull/576) - Rewrite FAQ entry - Add make target (make use-test-console) Fixes #124 --- .mk/development.mk | 21 +++++++++++++++++++++ FAQ.md | 21 +++++++++++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.mk/development.mk b/.mk/development.mk index 7fa82959b..d485a2e93 100644 --- a/.mk/development.mk +++ b/.mk/development.mk @@ -199,3 +199,24 @@ pprof-pf: @echo -e "\n==> Port-forwarding..." oc get pods kubectl port-forward -n $(NAMESPACE) $(shell kubectl get pod -l app=netobserv-operator -o jsonpath="{.items[0].metadata.name}") 6060 + +.PHONY: use-test-console +use-test-console: + @echo -e "\n==> Enabling the test console..." +ifeq ("", "$(CSV)") + kubectl set env -n $(NAMESPACE) deployment netobserv-controller-manager -c "manager" RELATED_IMAGE_CONSOLE_PLUGIN=quay.io/$(USER)/network-observability-standalone-frontend:$(VERSION) +else + ./hack/swap-image-csv.sh $(CSV) $(OPERATOR_NS) console-plugin RELATED_IMAGE_CONSOLE_PLUGIN quay.io/$(USER)/network-observability-standalone-frontend:$(VERSION) +endif + @echo -e "\n==> Waiting for operator redeployed..." + kubectl rollout status -n $(OPERATOR_NS) --timeout=60s deployment netobserv-controller-manager + kubectl wait -n $(OPERATOR_NS) --timeout=60s --for condition=Available=True deployment netobserv-controller-manager + oc patch flowcollector cluster --type='json' -p '[{"op": "add", "path": "/spec/consolePlugin/advanced/env", "value": {"TEST_CONSOLE": "true"}}]' + @echo -e "\n==> Waiting for console-plugin pod..." + kubectl delete -n $(NAMESPACE) deployment netobserv-plugin + while ! kubectl get deployment netobserv-plugin; do sleep 1; done + kubectl rollout status -n $(NAMESPACE) --timeout=60s deployment netobserv-plugin + kubectl wait -n $(NAMESPACE) --timeout=60s --for condition=Available=True deployment netobserv-plugin + -pkill --oldest --full "9001:9001" + kubectl port-forward -n $(NAMESPACE) svc/netobserv-plugin 9001:9001 2>&1 >/dev/null & + @echo -e "\n===> Test console available at http://localhost:9001\n" diff --git a/FAQ.md b/FAQ.md index b968238ae..0408ceeb9 100644 --- a/FAQ.md +++ b/FAQ.md @@ -46,10 +46,23 @@ Without OpenShift, you can still access the data (Loki logs, Prometheus metrics) All these options depend on how you installed these components. -If you feel ready for hacking, there is also a way to view the Test Console, used by the development team, which is similar to the OpenShift console plugin and can work without OpenShift. You need to: -- Build the console plugin in "standalone" mode: https://github.com/netobserv/network-observability-console-plugin?tab=readme-ov-file#standalone-frontend (you can just build the image, no need to run it locally). -- Configure the Operator to use this build: `kubectl set env deployment/netobserv-controller-manager -c "manager" RELATED_IMAGE_CONSOLE_PLUGIN=""` -- Configure the Operator to deploy the Test Console: in `FlowCollector` yaml, set `spec.consolePlugin.advanced.env.TEST_CONSOLE` to `true`. +You may also want to try the Test Console, which is used by the development team. It is similar to the OpenShift console plugin and can work without OpenShift. +After cloning this repo, run: + +```bash +USER=netobserv make use-test-console +# If you deployed netobserv in non-default namespaces, use NAMESPACE and/or OPERATOR_NS envs. If you want to point to a specific version, use VERSION. +# Example: +USER=netobserv NAMESPACE=other-namespace OPERATOR_NS=operator-namespace VERSION=vX.Y.Z make use-test-console +``` + +Or without cloning, run the following steps: + +- Configure the operator to use a console-plugin standalone build: `kubectl set env deployment/netobserv-controller-manager -c "manager" RELATED_IMAGE_CONSOLE_PLUGIN="quay.io/netobserv/network-observability-standalone-frontend:main"` +- Configure the operator to deploy it: in `FlowCollector` yaml, set `spec.consolePlugin.advanced.env.TEST_CONSOLE` to `true`. +- Then port-forward port 9001: `kubectl port-forward svc/netobserv-plugin 9001:9001` and open http://localhost:9001/ . + +Remember that it is only an internal dev tool, not a fully finished one. Do not expect the perfect user experience! By the way, contributions are welcome. ### How can I make sure everything is correctly deployed?