1414# KIND, either express or implied. See the License for the
1515# specific language governing permissions and limitations
1616# under the License.
17+ version : ' 3'
1718
18- version : " 3"
19+ vars :
20+ VAR : " "
21+ MSG : " "
22+ VAL : " "
23+ RETRY : 100
24+ TIMEOUT : 15s
25+ CONTEXT : " "
1926
2027env :
28+
2129 KUBECONFIG :
22- sh : |-
23- if test -e $OPS_TMP/kubeconfig
24- then echo $OPS_TMP/kubeconfig
30+ sh : |
31+ if test -e " $OPS_TMP/kubeconfig"
32+ then echo " $OPS_TMP/kubeconfig"
2533 else echo ~/.kube/config
2634 fi
2735
28- IMAGE_TAG :
29- sh : git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD
30-
31- CDB_HOST : couchdb
36+ SYS_API_CDB_HOST : couchdb
3237
33- CDB_USER :
34- sh : nuv debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.user}'"
38+ SYS_API_CDB_USER :
39+ sh : $OPS debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.user}'"
3540
36- CDB_PASSWORD :
37- sh : nuv debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.password}'"
41+ SYS_API_CDB_PASSWORD :
42+ sh : $OPS debug kube ctl CMD="-n nuvolaris get wsk/controller -o jsonpath='{.spec.couchdb.admin.password}'"
3843
39- APIHOST :
40- sh : nuv debug kube ctl CMD="-n nuvolaris get cm/config -o jsonpath='{.metadata.annotations.apihost }'"
44+ SYS_API_HOSTNAME :
45+ sh : $OPS debug kube ctl CMD="-n nuvolaris get ingress/apihost -o jsonpath='{.spec.rules[0].host }'"
4146
42- REDIS_PREFIX :
43- sh : echo "nuvolaris:"
44-
45- REDIS_URL :
46- sh : |
47- echo redis://nuvolaris:$(kubectl -n nuvolaris get wsk/controller -o jsonpath='{.spec.redis.nuvolaris.password}')@redis:6379
48-
49- dotenv :
50- - .env
47+ INGRESS_TYPE :
48+ sh : $OPS util ingress-type
5149
5250tasks :
5351
54- api:deploy :
55- ignore_error : false
56- cmds :
57- - envsubst -i api-template.yaml -o _api-template.yaml
58- - kubectl -n nuvolaris apply -f _api-template.yaml
59-
60- api:undeploy :
52+ deploy :
53+ silent : true
6154 ignore_error : false
55+ desc : deploy the admin api
6256 cmds :
63- - envsubst -i api-template.yaml -o _api-template.yaml
64- - kubectl -n nuvolaris delete -f _api-template.yaml
65-
66- nginx:deploy :
67- desc : deploy nuvolaris admin api on an nginx based deployment (Kind or similar)
57+ - test -e ${INGRESS_TYPE}-template.yaml || die "No avalable template for ingress type ${INGRESS_TYPE}."
58+ - test -n "$IMAGES_SYSTEMAPI" || die "IMAGES_SYSTEMAPI is not set. Please set it to the desired image version."
59+ - envsubst -i api-template.yaml -o _api.yaml > /dev/null 2>&1
60+ - envsubst -i ${INGRESS_TYPE}-template.yaml -o _ingress.yaml > /dev/null 2>&1
61+ - kubectl -n nuvolaris apply -f _api.yaml
62+ # - cat _ingress.yaml
63+ - kubectl -n nuvolaris apply -f _ingress.yaml
64+ - |
65+ echo "Admin API deployed with HOSTNAME: ${SYS_API_HOSTNAME}/system"
66+
67+ undeploy :
68+ silent : true
69+ desc : undeploy the admin api
6870 ignore_error : true
6971 cmds :
70- - task : api:deploy
71- - envsubst -i nginx-template.yaml -o _nginx-template.yaml
72- - kubectl -n nuvolaris apply -f _nginx-template.yaml
73-
74- nginx:undeploy :
75- desc : undeploy nuvolaris admin api on an nginx based deployment (Kind or similar)
76- ignore_error : true
77- cmds :
78- - task : api:undeploy
79- - envsubst -i nginx-template.yaml -o _nginx-template.yaml
80- - kubectl -n nuvolaris delete -f _nginx-template.yaml
81-
82- k3s:deploy :
83- desc : deploy nuvolaris admin api on an nginx based deployment (Kind or similar)
84- ignore_error : true
85- cmds :
86- - task : api:deploy
87- - envsubst -i k3s-template.yaml -o _k3s-template.yaml
88- - kubectl -n nuvolaris apply -f _k3s-template.yaml
89-
90- k3s:undeploy :
91- desc : undeploy nuvolaris admin api on an nginx based deployment (Kind or similar)
92- ignore_error : true
72+ - kubectl -n nuvolaris delete sts/nuvolaris-system-api ing/nuvolaris-system-api-ingress
73+ - |
74+ echo "System API undeployed"
75+
76+
77+ update :
78+ silent : true
79+ desc : update the OpenServerless Admin Api stateful set
9380 cmds :
94- - task : api:undeploy
95- - envsubst -i k3s-template.yaml -o _k3s-template.yaml
96- - kubectl -n nuvolaris delete -f _k3s-template.yaml
81+ - task : deploy
82+ - kubectl -n nuvolaris rollout restart statefulset nuvolaris-system-api
83+ preconditions :
84+ - sh : ' [ $IMAGES_SYSTEMAPI != $CURRENT_API_VERSION ]'
85+ msg : " Current OpenServerless system API stateful set it is already updated to newest version. Request ignored."
86+ env :
87+ CURRENT_API_VERSION :
88+ sh : |
89+ echo $(kubectl -n nuvolaris get pod/nuvolaris-system-api-0 -ojsonpath='{.spec.containers[0].image}')
0 commit comments