98
98
make dev-deploy MANAGER_IMG=test/tf-controller RUNNER_IMG=test/tf-runner TAG=$VERSION || true
99
99
make dev-deploy MANAGER_IMG=test/tf-controller RUNNER_IMG=test/tf-runner TAG=$VERSION
100
100
101
+ # All of these old cert would be cleaned up by GC at the start of the test
102
+ kubectl -n tf-system apply -f config/testdata/gc-old-certs/test.yaml
103
+
101
104
# Increase the concurrency of the controller to speed up tests
105
+ # --cert-rotation-check-frequency=6m0s, then GC will run every 1 minute
102
106
kubectl patch deployment \
103
107
tf-controller \
104
108
--namespace tf-system \
@@ -109,6 +113,7 @@ jobs:
109
113
"--log-encoding=json",
110
114
"--enable-leader-election",
111
115
"--concurrent=10",
116
+ "--cert-rotation-check-frequency=6m0s",
112
117
]}]'
113
118
114
119
kubectl -n tf-system rollout status deploy/source-controller --timeout=1m
@@ -192,11 +197,17 @@ jobs:
192
197
193
198
- name : Set up chaos testing environment
194
199
run : |
195
- # TODO we'll test a race condition with replica=3 later
196
- kubectl -n tf-system scale --replicas=1 deploy/tf-controller
200
+ kubectl -n tf-system scale --replicas=0 deploy/tf-controller
201
+ sleep 3
197
202
198
203
kubectl -n chaos-testing apply -f ./config/testdata/chaos
199
204
kubectl -n chaos-testing apply -f ./config/testdata/source
205
+
206
+ # Set up namespace-scoped old certs for GC
207
+ kubectl -n chaos-testing apply -f ./config/testdata/gc-old-certs/test.yaml
208
+
209
+ kubectl -n tf-system scale --replicas=1 deploy/tf-controller
210
+
200
211
sleep 10
201
212
- name : Randomly delete runner pods
202
213
run : |
@@ -212,6 +223,34 @@ jobs:
212
223
kubectl -n chaos-testing wait terraform/helloworld-chaos03 --for=condition=ready --timeout=30m
213
224
kubectl -n chaos-testing wait terraform/helloworld-chaos04 --for=condition=ready --timeout=30m
214
225
kubectl -n chaos-testing wait terraform/helloworld-chaos05 --for=condition=ready --timeout=30m
226
+ - name : Check that all old certs were GCed
227
+ run : |
228
+ echo "wait 120 seconds for GC to happen"
229
+ sleep 120
230
+
231
+ (kubectl get secret terraform-runner.tls-0 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
232
+ (kubectl get secret terraform-runner.tls-1 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
233
+ (kubectl get secret terraform-runner.tls-2 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
234
+ (kubectl get secret terraform-runner.tls-3 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
235
+ (kubectl get secret terraform-runner.tls-4 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
236
+ (kubectl get secret terraform-runner.tls-5 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
237
+ (kubectl get secret terraform-runner.tls-6 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
238
+ (kubectl get secret terraform-runner.tls-7 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
239
+ (kubectl get secret terraform-runner.tls-8 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
240
+ (kubectl get secret terraform-runner.tls-9 -n chaos-testing >/dev/null 2>&1 && exit 1 || exit 0)
241
+
242
+ (kubectl get secret terraform-runner.tls-0 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
243
+ (kubectl get secret terraform-runner.tls-1 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
244
+ (kubectl get secret terraform-runner.tls-2 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
245
+ (kubectl get secret terraform-runner.tls-3 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
246
+ (kubectl get secret terraform-runner.tls-4 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
247
+ (kubectl get secret terraform-runner.tls-5 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
248
+ (kubectl get secret terraform-runner.tls-6 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
249
+ (kubectl get secret terraform-runner.tls-7 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
250
+ (kubectl get secret terraform-runner.tls-8 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
251
+ (kubectl get secret terraform-runner.tls-9 -n tf-system >/dev/null 2>&1 && exit 1 || exit 0)
252
+
253
+ echo "All tests are true, all of the old secrets were GCed."
215
254
- name : Logs
216
255
run : |
217
256
kubectl -n tf-system logs deploy/source-controller
0 commit comments