blob: 68ce3ae3ff32ddce5c04acbde3dac7bf6ca99058 [file] [log] [blame]
# 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 debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.user}'"
SYS_API_CDB_PASSWORD:
sh: $OPS debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.password}'"
SYS_API_HOSTNAME:
sh: $OPS debug kube ctl CMD="-n nuvolaris get ingress/apihost -o jsonpath='{.spec.rules[0].host}'"
INGRESS_TYPE:
sh: $OPS util ingress-type
tasks:
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 _api.yaml
#- cat _ingress.yaml
- kubectl -n nuvolaris apply -f _ingress.yaml
- |
echo "Admin API deployed with HOSTNAME: ${SYS_API_HOSTNAME}/system"
undeploy:
silent: true
desc: undeploy the admin api
ignore_error: true
cmds:
- kubectl -n nuvolaris delete sts/nuvolaris-system-api ing/nuvolaris-system-api-ingress svc/nuvolaris-system-api
- |
echo "System API undeployed"
update:
silent: true
desc: update the OpenServerless 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 pod/nuvolaris-system-api-0 -ojsonpath='{.spec.containers[0].image}')