-
Notifications
You must be signed in to change notification settings - Fork 11
223 lines (190 loc) · 5.85 KB
/
test.yaml
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Test
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: "0 5 * * *"
workflow_dispatch:
inputs:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
test-default:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind cluster
uses: ./
- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
test-with-custom-resource-limits:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind cluster with custom resource limits
uses: ./
with:
cpu: "3"
disk: "5"
memory: "11"
- name: Test
run: |
kubectl get node $(kubectl get node -o custom-columns=":metadata.name") -o custom-columns="CPU:.status.capacity.cpu" | grep "3" 1> /dev/null && echo "CPU OK"
kubectl get node $(kubectl get node -o custom-columns=":metadata.name") -o custom-columns="DISK:.status.capacity.ephemeral-storage" | grep -E "5\d{6}Ki" 1> /dev/null && echo "Disk OK"
kubectl get node $(kubectl get node -o custom-columns=":metadata.name") -o custom-columns="MEMORY:.status.capacity.memory" | grep -E "11\d{6}Ki" 1> /dev/null && echo "Memory OK"
test-with-custom-name:
strategy:
matrix:
version:
- v0.17.0
- v0.16.0
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind cluster with custom name
uses: ./
with:
version: "${{ matrix.version }}"
cluster_name: "custom-name"
- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
test-without-registry:
strategy:
matrix:
version:
- v0.17.0
- v0.16.0
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind cluster with custom name
uses: ./
with:
version: "${{ matrix.version }}"
cluster_name: "custom-name"
registry: false
- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
registry_id=$(docker ps --filter "name=kind-registry" --format "{{.ID}}")
if [[ -n "$registry_id" ]]; then
echo "Registry present"
exit 1
fi
test-with-registry:
strategy:
matrix:
version:
- v0.17.0
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind cluster with registry
uses: ./
with:
version: "${{ matrix.version }}"
- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
# Checking env variable
if [[ "$KIND_REGISTRY" != "kind-registry:5000" ]]; then
echo "Wrong KIND_REGISTRY env variable: $KIND_REGISTRY"
exit 1
fi
# Test registry usage inside cluster
docker pull busybox
docker tag busybox kind-registry:5000/localbusybox
docker push kind-registry:5000/localbusybox
kubectl create job test --image=kind-registry:5000/localbusybox
i=1
max=60
while [[ $i -le $max ]] && [[ $(kubectl get pods -l job-name=test -o 'jsonpath={..status.phase}') != "Succeeded" ]]; do
echo "Waiting for pod to complete ($i/$max)..."
((i++))
sleep 1
done
if [[ $i -ge $max ]]; then
echo "ERROR: Pod did not complete!"
kubectl get pods -o yaml
exit 1
fi
test-with-registry-with-delete-rights:
strategy:
matrix:
version:
- v0.17.0
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind cluster with registry
uses: ./
with:
version: "${{ matrix.version }}"
registry_delete: true
- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
# Checking env variable
if [[ "$KIND_REGISTRY" != "kind-registry:5000" ]]; then
echo "Wrong KIND_REGISTRY env variable: $KIND_REGISTRY"
exit 1
fi
# Test registry usage inside cluster
docker pull busybox
docker tag busybox kind-registry:5000/localbusybox
# Test delete API
OUTPUT=$(docker push kind-registry:5000/localbusybox | grep -o 'digest.*size')
TRIM=${OUTPUT//digest: /}
DIGEST=${TRIM// size/}
exit $(curl -X DELETE kind-registry:5000/v2/localbusybox/manifests/$DIGEST)
test-knative:
strategy:
matrix:
knative_version:
- v1.9.0
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Create kind cluster
uses: ./
with:
knative_serving: "${{ matrix.knative_version }}"
knative_kourier: "${{ matrix.knative_version }}"
knative_eventing: "${{ matrix.knative_version }}"
- name: Test
run: |
kubectl cluster-info
kubectl get storageclass standard
cat << EOF | kubectl apply -f -
apiVersion: messaging.knative.dev/v1
kind: InMemoryChannel
metadata:
name: messages
EOF