| # 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: "" |
| DRY: "" |
| |
| env: |
| |
| KUBECONFIG: |
| sh: |- |
| if test -e "$OPS_TMP/kubeconfig" |
| then echo "$OPS_TMP/kubeconfig" |
| else echo ~/.kube/config |
| fi |
| |
| STREAMER_API_HOSTNAME: |
| sh: | |
| ops util kubeget ingress/apihost .spec.rules[0].host |
| |
| OW_APIHOST: |
| sh: | |
| HOST=$(ops util kubeget ingress/apihost .spec.rules[0].host) |
| if [ $OPERATOR_COMPONENT_INVOKER = true ]; |
| then echo "$HOST" |
| else echo "http://controller:3233" |
| fi |
| |
| INGRESS_TYPE: |
| sh: ops util ingress-type |
| |
| tasks: |
| |
| deploy: |
| silent: true |
| ignore_error: false |
| desc: deploy the streamer |
| vars: |
| T: |
| sh: | |
| if ops util kubeget wsk/controller .status.whisk_create.tls | rg on >/dev/null |
| then echo "" |
| else echo "#" |
| fi |
| cmds: |
| - test -e ${INGRESS_TYPE}-template.yaml || die "No avalable template for ingress type ${INGRESS_TYPE}." |
| - test -n "$IMAGES_STREAMER" || die "IMAGES_STREAMER is not set. Please set it to the desired image version." |
| - envsubst -i streamer-template.yaml -o _streamer.yaml > /dev/null 2>&1 |
| - | |
| export T="{{.T}}" |
| envsubst -i "${INGRESS_TYPE}-template.yaml" -o _ingress.yaml > /dev/null 2>&1 |
| - "{{.DRY}} kubectl -n openserverless apply -f _streamer.yaml" |
| #- cat _ingress.yaml |
| - "{{.DRY}} kubectl -n openserverless apply -f _ingress.yaml" |
| - | |
| echo "Streamer API deployed with HOSTNAME: stream.${STREAMER_API_HOSTNAME} and OW_APIHOST: ${OW_APIHOST}" |
| |
| undeploy: |
| silent: true |
| desc: undeploy the streamer |
| ignore_error: true |
| cmds: |
| - kubectl -n openserverless delete sts/openserverless-streamer-api ing/openserverless-streamer-api-ingress |
| - | |
| echo "Streamer API undeployed" |
| |
| update: |
| silent: true |
| desc: update the streamer |
| cmds: |
| - task: deploy |
| - kubectl -n openserverless rollout restart statefulset openserverless-streamer-api |
| preconditions: |
| - sh: '[ $IMAGES_STREAMER != $CURRENT_STREAMER_VERSION ]' |
| msg: "Current openserverless streamer API stateful set it is already updated to newest version. Request ignored." |
| env: |
| CURRENT_STREAMER_VERSION: |
| sh: | |
| echo "$(kubectl -n openserverless get pod/openserverless-streamer-api-0 -ojsonpath='{.spec.containers[0].image}')" |
| |
| |