| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| version: '3' |
| |
| vars: |
| VAR: "" |
| MSG: "" |
| VAL: "" |
| RETRY: 100 |
| TIMEOUT: 15s |
| CONTEXT: "" |
| |
| env: |
| |
| KUBECONFIG: |
| sh: | |
| if test -e "$OPS_TMP/kubeconfig" |
| then echo "$OPS_TMP/kubeconfig" |
| else echo ~/.kube/config |
| fi |
| |
| SYS_API_CDB_HOST: couchdb |
| |
| SYS_API_CDB_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 -- --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 -- --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 -- --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 |
| |
| tasks: |
| install-toml: |
| desc: Update the buildkitd.toml file config map |
| silent: true |
| 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 |
| cmds: |
| - | |
| 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 |
| cmds: |
| - task: remove-secret |
| - | |
| if ! kubectl -n nuvolaris get secret registry-pull-secret-int >/dev/null 2>&1; |
| 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 |
| cmds: |
| - | |
| if kubectl -n nuvolaris get secret registry-pull-secret-int >/dev/null 2>&1; |
| then kubectl -n nuvolaris delete secret registry-pull-secret-int |
| fi |
| |
| deploy: |
| silent: true |
| ignore_error: false |
| 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." |
| - envsubst -i api-template.yaml -o _api.yaml > /dev/null 2>&1 |
| - envsubst -i ${INGRESS_TYPE}-template.yaml -o _ingress.yaml > /dev/null 2>&1 |
| - kubectl -n nuvolaris apply -f "$OPS_ROOT/setup/nuvolaris/system-api/_api.yaml" |
| #- cat _ingress.yaml |
| - kubectl -n nuvolaris apply -f "$OPS_ROOT/setup/nuvolaris/system-api/_ingress.yaml" |
| - task: install-toml |
| - task: install-secret |
| - | |
| echo "Admin API deployed with HOSTNAME: ${SYS_API_HOSTNAME}/system" |
| |
| undeploy: |
| silent: true |
| desc: undeploy the admin api |
| ignore_error: false |
| cmds: |
| - task: remove-secret |
| - task: remove-toml |
| - 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 |
| desc: update the OpenServerless System Admin Api Stateful Set |
| cmds: |
| - task: deploy |
| - kubectl -n nuvolaris rollout restart statefulset nuvolaris-system-api |
| preconditions: |
| - sh: '[ $IMAGES_SYSTEMAPI != $CURRENT_API_VERSION ]' |
| msg: "Current OpenServerless System API stateful set it is already updated to newest version. Request ignored." |
| env: |
| CURRENT_API_VERSION: |
| sh: | |
| echo $(kubectl -n nuvolaris get sts/nuvolaris-system-api -ojsonpath='{.spec.template.spec.containers[0].image}') |