From 3ff0a640fdbd5a935d0796910d9fd3a8925bed9a Mon Sep 17 00:00:00 2001 From: pingqiu Date: Wed, 25 Nov 2026 18:21:01 -0800 Subject: [PATCH] fix(k8s-alpha): render the failback executor with the selected image Co-Authored-By: Claude Opus 5.5 --- seaweed-block/scripts/install-k8s-alpha.sh | 3 ++- seaweed-block/scripts/render-k8s-alpha-image.sh | 11 +++++++++++ seaweed-block/scripts/run-alpha-app-demo.sh | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 seaweed-block/scripts/render-k8s-alpha-image.sh diff --git a/seaweed-block/scripts/install-k8s-alpha.sh b/seaweed-block/scripts/install-k8s-alpha.sh index bb92c41e96..038bf2ad34 100755 --- a/seaweed-block/scripts/install-k8s-alpha.sh +++ b/seaweed-block/scripts/install-k8s-alpha.sh @@ -269,7 +269,8 @@ kubectl -n kube-system wait --for=condition=available deploy/sw-blockmaster --ti log "apply CSI components" kubectl apply -f "$ROOT/charts/seaweed-block/crds/swblockreplicafailbacks.block.seaweedfs.com.yaml" | tee "$ARTIFACT_DIR/apply-failback-crd.log" -kubectl apply -f "$ROOT/deploy/k8s/alpha/failback-executor.yaml" | tee "$ARTIFACT_DIR/apply-failback-executor.log" +bash "$ROOT/scripts/render-k8s-alpha-image.sh" "$IMAGE" "$ROOT/deploy/k8s/alpha/failback-executor.yaml" "$ARTIFACT_DIR/failback-executor.rendered.yaml" +kubectl apply -f "$ARTIFACT_DIR/failback-executor.rendered.yaml" | tee "$ARTIFACT_DIR/apply-failback-executor.log" kubectl apply -f "$ROOT/deploy/k8s/alpha/csi-driver.yaml" | tee "$ARTIFACT_DIR/apply-csidriver.log" kubectl apply -f "$CSI_CONTROLLER_RENDERED" | tee "$ARTIFACT_DIR/apply-csi-controller.log" kubectl apply -f "$CSI_NODE_RENDERED" | tee "$ARTIFACT_DIR/apply-csi-node.log" diff --git a/seaweed-block/scripts/render-k8s-alpha-image.sh b/seaweed-block/scripts/render-k8s-alpha-image.sh new file mode 100644 index 0000000000..d5db336401 --- /dev/null +++ b/seaweed-block/scripts/render-k8s-alpha-image.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# Renders an alpha manifest written for the local image (sw-block:local, +# imagePullPolicy: Never) with the selected image, the way the stack itself is +# rendered: usage: render-k8s-alpha-image.sh IMAGE IN OUT +set -euo pipefail +[[ $# -eq 3 ]] || { echo "usage: $0 IMAGE IN OUT" >&2; exit 2; } +image_sed="$(printf '%s' "$1" | sed 's/[\/&]/\&/g')" +sed -e "s/sw-block:local/${image_sed}/g" \ + -e "s/imagePullPolicy: Never/imagePullPolicy: IfNotPresent/g" \ + "$2" >"$3" +grep -q "image: $1\$" "$3" || { echo "render-k8s-alpha-image: $3 does not name image $1" >&2; exit 1; } diff --git a/seaweed-block/scripts/run-alpha-app-demo.sh b/seaweed-block/scripts/run-alpha-app-demo.sh index 967c8624c1..70cfc7ae4f 100755 --- a/seaweed-block/scripts/run-alpha-app-demo.sh +++ b/seaweed-block/scripts/run-alpha-app-demo.sh @@ -1546,7 +1546,8 @@ kubectl -n kube-system wait --for=condition=available deploy/sw-blockmaster --ti log "apply CSI manifests" kubectl apply -f "$ROOT/charts/seaweed-block/crds/swblockreplicafailbacks.block.seaweedfs.com.yaml" | tee "$ARTIFACT_DIR/apply-failback-crd.log" -kubectl apply -f "$ROOT/deploy/k8s/alpha/failback-executor.yaml" | tee "$ARTIFACT_DIR/apply-failback-executor.log" +bash "$ROOT/scripts/render-k8s-alpha-image.sh" "$IMAGE" "$ROOT/deploy/k8s/alpha/failback-executor.yaml" "$ARTIFACT_DIR/failback-executor.rendered.yaml" +kubectl apply -f "$ARTIFACT_DIR/failback-executor.rendered.yaml" | tee "$ARTIFACT_DIR/apply-failback-executor.log" kubectl apply -f "$ROOT/deploy/k8s/alpha/csi-driver.yaml" | tee "$ARTIFACT_DIR/apply-csidriver.log" kubectl apply -f "$CSI_CONTROLLER_RENDERED" | tee "$ARTIFACT_DIR/apply-csi-controller.log" kubectl apply -f "$CSI_NODE_RENDERED" | tee "$ARTIFACT_DIR/apply-csi-node.log"