Skip to content

Commit 695e528

Browse files
authored
Revert "Apply gitpod resources if there's diff (#16517)" (#16642)
This reverts commit c487681.
1 parent b1ed3bf commit 695e528

File tree

3 files changed

+34
-36
lines changed

3 files changed

+34
-36
lines changed

dev/preview/workflow/lib/k8s-util.sh

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,3 @@ function readWerftSecret {
8686
get secret "${name}" -o jsonpath="{.data.${key}}" \
8787
| base64 -d
8888
}
89-
90-
function diff-apply {
91-
local context=$1
92-
shift
93-
local yaml=$1
94-
yaml=$(realpath "${yaml}")
95-
96-
if kubectl --context "${context}" diff -f "${yaml}" > /dev/null; then
97-
echo "Skipping ${yaml}, as it produced no diff"
98-
else
99-
kubectl --context "${context}" apply -f "${yaml}"
100-
fi
101-
}

dev/preview/workflow/preview/deploy-gitpod.sh

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,35 @@ EOF
135135
}
136136

137137
function installRookCeph {
138-
diff-apply "${PREVIEW_K3S_KUBE_CONTEXT}" "$ROOT/.werft/vm/manifests/rook-ceph/crds.yaml"
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
139142

140143
kubectl \
141144
--kubeconfig "${PREVIEW_K3S_KUBE_PATH}" \
142145
--context "${PREVIEW_K3S_KUBE_CONTEXT}" \
143146
wait --for condition=established --timeout=120s crd/cephclusters.ceph.rook.io
144147

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
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"
148167
}
149168

150169
# Install Fluent-Bit sending logs to GCP
@@ -357,7 +376,7 @@ then
357376
yq d -i admin-login-secret.yaml metadata.creationTimestamp
358377
yq d -i admin-login-secret.yaml metadata.uid
359378
yq d -i admin-login-secret.yaml metadata.resourceVersion
360-
diff-apply "${PREVIEW_K3S_KUBE_CONTEXT}" admin-login-secret.yaml
379+
kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" apply -f admin-login-secret.yaml
361380
rm -f admin-login-secret.yaml
362381

363382
yq w -i "${INSTALLER_CONFIG_PATH}" adminLoginSecret.kind "secret"
@@ -372,7 +391,7 @@ yq w -i stripe-api-keys.secret.yaml metadata.namespace "default"
372391
yq d -i stripe-api-keys.secret.yaml metadata.creationTimestamp
373392
yq d -i stripe-api-keys.secret.yaml metadata.uid
374393
yq d -i stripe-api-keys.secret.yaml metadata.resourceVersion
375-
diff-apply "${PREVIEW_K3S_KUBE_CONTEXT}" stripe-api-keys.secret.yaml
394+
kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" apply -f stripe-api-keys.secret.yaml
376395
rm -f stripe-api-keys.secret.yaml
377396

378397
#
@@ -382,9 +401,8 @@ kubectl --kubeconfig "${DEV_KUBE_PATH}" --context "${DEV_KUBE_CONTEXT}" --namesp
382401
| yq w - metadata.namespace ${PREVIEW_NAMESPACE} \
383402
| yq d - metadata.uid \
384403
| yq d - metadata.resourceVersion \
385-
| yq d - metadata.creationTimestamp > host-key.yaml
386-
diff-apply "${PREVIEW_K3S_KUBE_CONTEXT}" host-key.yaml
387-
rm -f host-key.yaml
404+
| yq d - metadata.creationTimestamp \
405+
| kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" apply -f -
388406

389407
yq w -i "${INSTALLER_CONFIG_PATH}" sshGatewayHostKey.kind "secret"
390408
yq w -i "${INSTALLER_CONFIG_PATH}" sshGatewayHostKey.name "host-key"
@@ -498,7 +516,7 @@ yq w -i spicedb-secret.yaml metadata.namespace "default"
498516
yq d -i spicedb-secret.yaml metadata.creationTimestamp
499517
yq d -i spicedb-secret.yaml metadata.uid
500518
yq d -i spicedb-secret.yaml metadata.resourceVersion
501-
diff-apply "${PREVIEW_K3S_KUBE_CONTEXT}" spicedb-secret.yaml
519+
kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" apply -f spicedb-secret.yaml
502520
rm -f spicedb-secret.yaml
503521

504522
#
@@ -600,18 +618,7 @@ rm -f /tmp/public-api
600618
log_info "Applying manifests (installing)"
601619

602620
kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" delete -n "${PREVIEW_NAMESPACE}" job migrations || true
603-
# export the function so we can use it in xargs
604-
export -f diff-apply
605-
mkdir temp-installer || true
606-
pushd temp-installer
607-
# this will split the big yaml produced by the installer, so we can diff individual parts of it and run them in parallel
608-
yq4 -s '.kind + "_" + .metadata.name' "../${INSTALLER_RENDER_PATH}"
609-
rm .yml || true # this one is a leftover from the split
610-
# shellcheck disable=SC2038
611-
find . | xargs -n 1 -I {} -P 5 bash -c "diff-apply ${PREVIEW_K3S_KUBE_CONTEXT} {}"
612-
log_info "Applied all"
613-
popd
614-
rm -rf temp-installer
621+
kubectl --kubeconfig "${PREVIEW_K3S_KUBE_PATH}" --context "${PREVIEW_K3S_KUBE_CONTEXT}" apply -f "${INSTALLER_RENDER_PATH}"
615622
rm -f "${INSTALLER_RENDER_PATH}"
616623

617624
# =========================

dev/preview/workflow/preview/deploy-monitoring-satellite.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ kubectl \
8585

8686
echo "Applying generated manifests"
8787
for f in "${manifests_dir}"/*.yaml; do
88-
diff-apply "${PREVIEW_K3S_KUBE_CONTEXT}" "${f}"
88+
echo "Applying $f"
89+
kubectl \
90+
--kubeconfig "${PREVIEW_K3S_KUBE_PATH}" \
91+
--context "${PREVIEW_K3S_KUBE_CONTEXT}" \
92+
apply --server-side -f "${f}"
8993
done
9094

9195
echo "Patching grafana deployment"

0 commit comments

Comments
 (0)