forked from nuvolaris/nuvolaris-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfileTest.yml
140 lines (121 loc) · 4.53 KB
/
TaskfileTest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# 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:
KUBE:
sh: ./detect.sh
# taken from the tag
OPERATOR_TAG:
sh: git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD
# taken from the Dockerfile - ovverdable with MY_OPERATOR_IMAGE
OPERATOR_IMAGE:
sh: awk -F= '/ARG OPERATOR_IMAGE_DEFAULT=/ { print $2 ; exit }' Dockerfile
WHISK: '{{default "whisk" .WHISK}}'
CONFIG: "tests/{{.KUBE}}/{{.WHISK}}.yaml"
REDIS_URI: "redis://redis"
MONGO_URI: "mongodb://nuvolaris:s0meP%40ass3@nuvolaris-mongodb-0.nuvolaris-mongodb-svc.nuvolaris.svc.cluster.local:27017/nuvolaris?replicaSet=nuvolaris-mongodb&ssl=false"
MONGO_RT: "ghcr.io/nuvolaris/action-nodejs-v14:0.3.0-morpheus.22081008"
T: ""
tasks:
kustomization:
cmds:
- |
cat <<__EOF__ >deploy/nuvolaris-operator/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: ghcr.io/nuvolaris/nuvolaris-operator:latest
newName: ${MY_OPERATOR_IMAGE:-{{.OPERATOR_IMAGE}}}
newTag: {{.OPERATOR_TAG}}
resources:
- operator-pod.yaml
__EOF__
permission: kubectl apply -f deploy/nuvolaris-permissions
operator:
- task: kustomization
- kubectl apply -k deploy/nuvolaris-operator
- |
while ! kubectl -n nuvolaris wait --for=condition=ready pod/nuvolaris-operator
do echo still waiting...
done
destroy-operator:
- task: kustomization
- kubectl delete -k deploy/nuvolaris-operator
instance:
- kubectl config set-context --current --namespace nuvolaris
- >
cat tests/{{.KUBE}}/whisk.yaml
| kubectl apply -f -
- |
while ! kubectl -n nuvolaris wait pod --for=condition=ready -l app=controller
do sleep 1 ; echo waiting controller...
done
- |
while ! kubectl -n nuvolaris wait pod redis-0 --for=condition=ready
do sleep 1 ; echo waiting redis...
done
- |
while ! kubectl -n nuvolaris wait pod --for=condition=ready -l user-action-pod=true
do sleep 1 ; echo waiting actions...
done
destroy-instance:
- (sleep 5 ; task defin) &
- kubectl -n nuvolaris delete wsk/controller
destroy:
- task: destroy-instance
- task: destroy-operator
cleanup: kubectl -n nuvolaris delete pvc --all
config: |-
while true
do APIHOST=$(kubectl -n nuvolaris get cm/config -o yaml | awk '/apihost:/ {print $2}' | sed -e 's/https:/http:/')
if echo $APIHOST | grep pending
then echo "apihost still pending..." ; sleep 5
else break
fi
done
echo "*** $APIHOST ***"
AUTH=$(kubectl -n nuvolaris get wsk/controller -o yaml | awk '/nuvolaris:/{print $2}')
echo $AUTH
echo wsk property set --apihost $APIHOST --auth $AUTH
wsk property set --apihost $APIHOST --auth $AUTH
which nuv && nuv auth --apihost $APIHOST --auth $AUTH
while ! wsk action list
do echo $(( N++)) "waiting for the load balancer to be ready..." ; sleep 10
done
hello:
- wsk action update hello tests/hello.js --web=true
- wsk action invoke hello -r | grep "hello"
- |
URL=$(wsk action get hello --url | tail +2)
curl -sL $URL | grep hello
ping:
- wsk package update redis -p redis "{{.REDIS_URI}}"
- wsk action update redis/ping tests/ping.js
- wsk action invoke redis/ping -r | grep "PONG"
echo:
- wsk action update echo tests/echo.js -a provide-api-key true
- wsk action invoke echo -r | grep "__OW_API_KEY"
api:
- wsk action update api tests/api.js -a provide-api-key true
- wsk action invoke api -r | grep '"api"'
mongo:
- wsk package update mongo -p dburi {{.MONGO_URI}}
- wsk action update mongo/mongo tests/mongo.js --docker {{.MONGO_RT}}
- wsk action invoke mongo/mongo -r | grep "hello"
mongo2:
- wsk project deploy --manifest tests/mongo.yaml