From d3af0ebab77bcfef3f12b60e732751fcaadeb694 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Sun, 3 Sep 2023 18:29:04 +0530 Subject: [PATCH 1/2] add inital script that will setup cyclops --- scripts/cyclops-ui.sh | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 scripts/cyclops-ui.sh diff --git a/scripts/cyclops-ui.sh b/scripts/cyclops-ui.sh new file mode 100755 index 000000000..596fd2c1d --- /dev/null +++ b/scripts/cyclops-ui.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +set -euo pipefail + +# Default values +NAMESPACE=cyclops +CYCLOPS_UI=3000 +CYCLOPS_BACKEND=8080 + +function color() { + local color=$1 + shift + local black=30 red=31 green=32 yellow=33 blue=34 magenta=35 cyan=36 white=37 + local color_code=${!color:-$green} + printf "\033[%sm%s\033[0m\n" "$color_code" "$*" +} + +function stop-port-forward() { + color green "Trying to stop all port-forward, if any...." + PIDS=$(ps -ef | grep -i -e 'kubectl port-forward svc/cyclops' | grep -v 'grep' | cat | awk '{print $2}') || true + for p in $PIDS; do + kill -15 $p + done + sleep 2 +} + +function port-forward() { + stop-port-forward + color yellow "cyclops-ui to http://localhost:3000" && kubectl port-forward svc/cyclops-ui 3000:$CYCLOPS_UI -n $NAMESPACE > /dev/null 2>&1 & + color yellow "cyclops-ctrl to http://localhost:8080" && kubectl port-forward svc/cyclops-ctrl 8080:$CYCLOPS_BACKEND -n $NAMESPACE > /dev/null 2>&1 & +} + +function install() { + color green "Install cyclops ui in namespace: $NAMESPACE" + kubectl apply -f https://raw.githubusercontent.com/cyclops-ui/cyclops/v0.0.1-alpha.3/install/cyclops-install.yaml --namespace $NAMESPACE + color yellow "Fetching the pods" + kubectl get pods -n $NAMESPACE + + color yellow "Wait for 60 secs before running port forward commands" +} + +function stop() { + color green "Delete cyclops ui in namespace: $NAMESPACE" + kubectl delete -f https://raw.githubusercontent.com/cyclops-ui/cyclops/v0.0.1-alpha.3/install/cyclops-install.yaml --namespace $NAMESPACE + color yellow "Fetching the pods" + kubectl get pods -n $NAMESPACE +} + +if declare -f "$1" > /dev/null +then + # call arguments verbatim + "$@" +else + # Show a helpful error + echo "'$1' is not a known function name" >&2 + exit 1 +fi From c20b8f3277061da2412636fe38f37fe463cd35e1 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Mon, 16 Oct 2023 20:28:34 +0530 Subject: [PATCH 2/2] update cyclops to latest version --- scripts/cyclops-ui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cyclops-ui.sh b/scripts/cyclops-ui.sh index 596fd2c1d..4e5e2643e 100755 --- a/scripts/cyclops-ui.sh +++ b/scripts/cyclops-ui.sh @@ -32,7 +32,7 @@ function port-forward() { function install() { color green "Install cyclops ui in namespace: $NAMESPACE" - kubectl apply -f https://raw.githubusercontent.com/cyclops-ui/cyclops/v0.0.1-alpha.3/install/cyclops-install.yaml --namespace $NAMESPACE + kubectl apply -f https://raw.githubusercontent.com/cyclops-ui/cyclops/v0.0.1-alpha.5/install/cyclops-install.yaml --namespace $NAMESPACE color yellow "Fetching the pods" kubectl get pods -n $NAMESPACE