@@ -135,35 +135,16 @@ EOF
135
135
}
136
136
137
137
function installRookCeph {
138
- kubectl \
139
- --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " \
140
- --context " ${PREVIEW_K3S_KUBE_CONTEXT} " \
141
- apply -f " $ROOT /.werft/vm/manifests/rook-ceph/crds.yaml" --server-side --force-conflicts
138
+ diff-apply " ${PREVIEW_K3S_KUBE_CONTEXT} " " $ROOT /.werft/vm/manifests/rook-ceph/crds.yaml"
142
139
143
140
kubectl \
144
141
--kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " \
145
142
--context " ${PREVIEW_K3S_KUBE_CONTEXT} " \
146
143
wait --for condition=established --timeout=120s crd/cephclusters.ceph.rook.io
147
144
148
- kubectl \
149
- --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " \
150
- --context " ${PREVIEW_K3S_KUBE_CONTEXT} " \
151
- apply -f " $ROOT /.werft/vm/manifests/rook-ceph/common.yaml" -f " $ROOT /.werft/vm/manifests/rook-ceph/operator.yaml"
152
-
153
- kubectl \
154
- --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " \
155
- --context " ${PREVIEW_K3S_KUBE_CONTEXT} " \
156
- apply -f " $ROOT /.werft/vm/manifests/rook-ceph/cluster-test.yaml"
157
-
158
- kubectl \
159
- --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " \
160
- --context " ${PREVIEW_K3S_KUBE_CONTEXT} " \
161
- apply -f " $ROOT /.werft/vm/manifests/rook-ceph/storageclass-test.yaml"
162
-
163
- kubectl \
164
- --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " \
165
- --context " ${PREVIEW_K3S_KUBE_CONTEXT} " \
166
- apply -f " $ROOT /.werft/vm/manifests/rook-ceph/snapshotclass.yaml"
145
+ for file in common operator cluster-test storageclass-test snapshotclass; do
146
+ diff-apply " ${PREVIEW_K3S_KUBE_CONTEXT} " " $ROOT /.werft/vm/manifests/rook-ceph/$file .yaml"
147
+ done
167
148
}
168
149
169
150
# Install Fluent-Bit sending logs to GCP
376
357
yq d -i admin-login-secret.yaml metadata.creationTimestamp
377
358
yq d -i admin-login-secret.yaml metadata.uid
378
359
yq d -i admin-login-secret.yaml metadata.resourceVersion
379
- kubectl --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " --context " ${ PREVIEW_K3S_KUBE_CONTEXT}" apply -f admin-login-secret.yaml
360
+ diff-apply " ${PREVIEW_K3S_KUBE_CONTEXT} " admin-login-secret.yaml
380
361
rm -f admin-login-secret.yaml
381
362
382
363
yq w -i " ${INSTALLER_CONFIG_PATH} " adminLoginSecret.kind " secret"
@@ -391,7 +372,7 @@ yq w -i stripe-api-keys.secret.yaml metadata.namespace "default"
391
372
yq d -i stripe-api-keys.secret.yaml metadata.creationTimestamp
392
373
yq d -i stripe-api-keys.secret.yaml metadata.uid
393
374
yq d -i stripe-api-keys.secret.yaml metadata.resourceVersion
394
- kubectl --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " --context " ${ PREVIEW_K3S_KUBE_CONTEXT}" apply -f stripe-api-keys.secret.yaml
375
+ diff-apply " ${PREVIEW_K3S_KUBE_CONTEXT} " stripe-api-keys.secret.yaml
395
376
rm -f stripe-api-keys.secret.yaml
396
377
397
378
#
@@ -401,8 +382,9 @@ kubectl --kubeconfig "${DEV_KUBE_PATH}" --context "${DEV_KUBE_CONTEXT}" --namesp
401
382
| yq w - metadata.namespace ${PREVIEW_NAMESPACE} \
402
383
| yq d - metadata.uid \
403
384
| yq d - metadata.resourceVersion \
404
- | yq d - metadata.creationTimestamp \
405
- | kubectl --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " --context " ${PREVIEW_K3S_KUBE_CONTEXT} " apply -f -
385
+ | yq d - metadata.creationTimestamp > host-key.yaml
386
+ diff-apply " ${PREVIEW_K3S_KUBE_CONTEXT} " host-key.yaml
387
+ rm -f host-key.yaml
406
388
407
389
yq w -i " ${INSTALLER_CONFIG_PATH} " sshGatewayHostKey.kind " secret"
408
390
yq w -i " ${INSTALLER_CONFIG_PATH} " sshGatewayHostKey.name " host-key"
@@ -524,7 +506,7 @@ yq w -i spicedb-secret.yaml metadata.namespace "default"
524
506
yq d -i spicedb-secret.yaml metadata.creationTimestamp
525
507
yq d -i spicedb-secret.yaml metadata.uid
526
508
yq d -i spicedb-secret.yaml metadata.resourceVersion
527
- kubectl --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " --context " ${ PREVIEW_K3S_KUBE_CONTEXT}" apply -f spicedb-secret.yaml
509
+ diff-apply " ${PREVIEW_K3S_KUBE_CONTEXT} " spicedb-secret.yaml
528
510
rm -f spicedb-secret.yaml
529
511
530
512
#
@@ -552,6 +534,8 @@ installer --debug-version-file="/tmp/versions.yaml" render \
552
534
--namespace " ${PREVIEW_NAMESPACE} " \
553
535
--config " ${INSTALLER_CONFIG_PATH} " > " ${INSTALLER_RENDER_PATH} "
554
536
537
+ cp " ${INSTALLER_RENDER_PATH} " /workspace/gitpod/k8s.yaml
538
+
555
539
# ===============
556
540
# Post-processing
557
541
# ===============
@@ -625,8 +609,22 @@ rm -f /tmp/public-api
625
609
626
610
log_info " Applying manifests (installing)"
627
611
612
+ echo " ${INSTALLER_RENDER_PATH} "
613
+
628
614
kubectl --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " --context " ${PREVIEW_K3S_KUBE_CONTEXT} " delete -n " ${PREVIEW_NAMESPACE} " job migrations || true
629
- kubectl --kubeconfig " ${PREVIEW_K3S_KUBE_PATH} " --context " ${PREVIEW_K3S_KUBE_CONTEXT} " apply -f " ${INSTALLER_RENDER_PATH} "
615
+
616
+ # export the function so we can use it in xargs
617
+ export -f diff-apply
618
+ mkdir temp-installer || true
619
+ pushd temp-installer
620
+ # this will split the big yaml produced by the installer, so we can diff individual parts of it and run them in parallel
621
+ yq4 -s ' .kind + "_" + .metadata.name' " ../${INSTALLER_RENDER_PATH} "
622
+ rm .yml || true # this one is a leftover from the split
623
+ # shellcheck disable=SC2038
624
+ find . | xargs -n 1 -I {} -P 5 bash -c " diff-apply ${PREVIEW_K3S_KUBE_CONTEXT} {}"
625
+ log_info " Applied all"
626
+ popd
627
+ rm -rf temp-installer
630
628
rm -f " ${INSTALLER_RENDER_PATH} "
631
629
632
630
# =========================
0 commit comments