fix systemapi deploy
diff --git a/setup/nuvolaris/system-api/opsfile.yml b/setup/nuvolaris/system-api/opsfile.yml index fa9e15d..f5e1767 100644 --- a/setup/nuvolaris/system-api/opsfile.yml +++ b/setup/nuvolaris/system-api/opsfile.yml
@@ -36,16 +36,20 @@ SYS_API_CDB_HOST: couchdb SYS_API_CDB_USER: - sh: ops util kubectl -- -n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.user}' + #sh: ops util kubectl -- --kubeconfig "$KUBECONFIG" -n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.user}' + sh: ops util kubeget wsk/controller .spec.couchdb.admin.user SYS_API_CDB_PASSWORD: - sh: ops util kubectl -- -n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.password}' + #sh: ops util kubectl -- --kubeconfig "$KUBECONFIG" -n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.password}' + sh: ops util kubeget wsk/controller .spec.couchdb.admin.password SYS_API_HOSTNAME: - sh: ops util kubectl -- -n nuvolaris get ingress/apihost -o jsonpath='{.spec.rules[0].host}' - + #sh: ops util kubectl -- --kubeconfig "$KUBECONFIG" -n nuvolaris get ingress/apihost -o jsonpath='{.spec.rules[0].host}' + sh: ops util kubeget ingress/apihost .spec.rules[0].host + REGISTRY_PASS: - sh: ops util kubectl -- -n nuvolaris get cm/config -o jsonpath='{.metadata.annotations.registry_password}' + #sh: ops util kubectl -- --kubeconfig "$KUBECONFIG" -n nuvolaris get cm/config -o jsonpath='{.metadata.annotations.registry_password}' + sh: ops util kubeget cm/config .metadata.annotations.registry_password INGRESS_TYPE: sh: ops util ingress-type @@ -57,7 +61,7 @@ cmds: - task: remove-toml - kubectl -n nuvolaris create configmap nuvolaris-buildkitd-conf --from-file="$OPS_ROOT/setup/nuvolaris/system-api/deploy/buildkit/buildkitd.toml" - + remove-toml: desc: Remove the buildkitd.toml config map silent: true @@ -66,7 +70,7 @@ if kubectl -n nuvolaris get cm nuvolaris-buildkitd-conf >/dev/null 2>&1; then kubectl -n nuvolaris delete configmap nuvolaris-buildkitd-conf fi - + install-secret: desc: Create secret to push to internal registry silent: true @@ -74,9 +78,9 @@ - task: remove-secret - | if ! kubectl -n nuvolaris get secret registry-pull-secret-int >/dev/null 2>&1; - then kubectl create secret docker-registry registry-pull-secret-int --docker-server=http://nuvolaris-registry-svc:5000 --docker-username=opsuser --docker-password=${REGISTRY_PASS} + then kubectl -n nuvolaris create secret docker-registry registry-pull-secret-int --docker-server=http://nuvolaris-registry-svc:5000 --docker-username=opsuser --docker-password=${REGISTRY_PASS} fi - + remove-secret: desc: Delete secret to push to internal registry silent: true @@ -86,11 +90,10 @@ then kubectl -n nuvolaris delete secret registry-pull-secret-int fi - deploy: silent: true ignore_error: false - desc: deploy the admin api + desc: deploy the admin api cmds: - test -e ${INGRESS_TYPE}-template.yaml || die "No avalable template for ingress type ${INGRESS_TYPE}." - test -n "$IMAGES_SYSTEMAPI" || die "IMAGES_SYSTEMAPI is not set. Please set it to the desired image version." @@ -103,7 +106,7 @@ - task: install-secret - | echo "Admin API deployed with HOSTNAME: ${SYS_API_HOSTNAME}/system" - + undeploy: silent: true desc: undeploy the admin api @@ -114,7 +117,7 @@ - kubectl -n nuvolaris delete sts/nuvolaris-system-api ing/nuvolaris-system-api-ingress svc/nuvolaris-system-api - | echo "System Admin API undeployed" - + update: silent: true @@ -122,7 +125,7 @@ cmds: - task: deploy - kubectl -n nuvolaris rollout restart statefulset nuvolaris-system-api - preconditions: + preconditions: - sh: '[ $IMAGES_SYSTEMAPI != $CURRENT_API_VERSION ]' msg: "Current OpenServerless System API stateful set it is already updated to newest version. Request ignored." env:
diff --git a/util/docopts.md b/util/docopts.md index 72d1107..f2bff4c 100644 --- a/util/docopts.md +++ b/util/docopts.md
@@ -34,6 +34,7 @@ util no-user-secrets <username> util kubectl <args>... util kubeconfig + util kubeget <object> <jsonpath> util config <configjson> [--override] [--showhelp] util clean util upload [<folder>] [--batchsize=<batchsize>] [--verbose] [--clean] @@ -53,12 +54,13 @@ - system system info (<os>-<arch> in Go format) - update-cli update the cli downloading the binary - check-operator-version check if you need to update the operator -- secrets generate system secrets +- secrets generate system secrets - nosecrets remove system secrets - user-secrets generate user secrets for the given user - no-user-secrets remove user secrets for the given user - kubectl execute kubectl on current kubeconfig - kubeconfig export OVERWRITING current kubeconfig to ~/.kube/config +- kubeget extract info from an object with a jsonpath - config update configuration file interactively - clean clean up the web bucket - upload uploads a folder to the web bucket in OpenServerless.
diff --git a/util/opsfile.yml b/util/opsfile.yml index 28e35c7..3a0f947 100644 --- a/util/opsfile.yml +++ b/util/opsfile.yml
@@ -36,7 +36,7 @@ if {{.__showhelp}} then FLAGS="$FLAGS --showhelp" fi - if {{.__override}} + if {{.__override}} then FLAGS="$FLAGS --override" fi bun config/configurator.js $(opspath {{._configjson_}}) $FLAGS @@ -76,7 +76,7 @@ else echo "cannot auto update ops - update it manually" echo "please run 'curl -sL bit.ly/get-ops | bash'" fi - else + else echo "skipping rename $OPS_TMP/ops{{.EXE}} $OPS_CMD" fi @@ -151,7 +151,7 @@ cmds: - | # no quote here - syntax array generated by docps - args={{._args_}} + args={{._args_}} # exanded and assigned to positional parameter set -- ${args[@]} # removing the '--' at the beginning required to pass extra flags @@ -166,6 +166,21 @@ else echo ~/.kube/config fi + kubeget: + desc: extract informations from + silent: true + cmds: + - kubectl -n nuvolaris get "$OBJECT" -o jsonpath="{$JSONPATH}" + env: + JSONPATH: '{{._jsonpath_}}' + OBJECT: '{{._object_}}' + KUBECONFIG: + sh: |- + if test -e "$OPS_TMP/kubeconfig" + then echo "$OPS_TMP/kubeconfig" + else echo ~/.kube/config + fi + kubeconfig: silent: true prompt: Are you sure? I am overwriting your ~/.kube/config @@ -173,7 +188,7 @@ cmds: - | if test -e "$OPS_TMP/kubeconfig" - then + then if test -e ~/.kube/config then BKP=~/.kube/config.$(datefmt -f ms) mv ~/.kube/config $(realpath $BKP) @@ -206,7 +221,7 @@ env: FOLDER_PATH: sh: | - if test -n "{{._folder_}}" + if test -n "{{._folder_}}" then opspath "{{._folder_}}" else opspath . fi @@ -273,10 +288,10 @@ NGINX_CONF: > server { listen 80; - location / { + location / { proxy_pass http://nuvolaris-control-plane:80; - proxy_set_header Host {{.HOST}}; - } + proxy_set_header Host {{.HOST}}; + } } cmds: - | @@ -286,8 +301,8 @@ if docker run -d --name docker-proxy-{{.PORT}} -p {{.PORT}}:80 --network kind nginx:alpine sh -c \ "echo '{{.NGINX_CONF}}' > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" then echo "docker-proxy started on port {{.PORT}} to http://{{.HOST}}" - else echo "Cannot start docker-proxy-{{.PORT}} - either the port is busy or another instance is running, remove it" - fi + else echo "Cannot start docker-proxy-{{.PORT}} - either the port is busy or another instance is running, remove it" + fi fi