@@ -39,6 +39,12 @@ cp "${PROJECT_DIR}/chart/Chart.yaml" "${OUTPUT_DIR}/"
3939cp " ${PROJECT_DIR} /chart/values.yaml" " ${OUTPUT_DIR} /"
4040cp " ${PROJECT_DIR} /chart/.helmignore" " ${OUTPUT_DIR} /"
4141
42+ # Transient CRDs that should NOT have clusterctl labels (to prevent move during cluster migration).
43+ # The move label causes clusterctl to discover and move these resources during cluster move.
44+ # When moved, they arrive with empty status (clusterctl only moves spec) causing controllers
45+ # to re-process them
46+ SKIP_CLUSTERCTL_LABELS=" tinkerbell.org_workflows.yaml bmc.tinkerbell.org_jobs.yaml bmc.tinkerbell.org_tasks.yaml"
47+
4248# Copy all CRDs from mono-repo
4349for crd_file in " ${REPO_ROOT} " /crd/bases/* .yaml; do
4450 filename=$( basename " $crd_file " )
@@ -51,9 +57,11 @@ for crd_file in "${REPO_ROOT}"/crd/bases/*.yaml; do
5157 # This prevents Helm from deleting CRDs on uninstall
5258 yq -i ' .metadata.annotations["helm.sh/resource-policy"] = "keep"' " ${OUTPUT_DIR} /templates/${filename} "
5359
54- # Add clusterctl labels for CAPI move operations
55- yq -i ' .metadata.labels["clusterctl.cluster.x-k8s.io"] = ""' " ${OUTPUT_DIR} /templates/${filename} "
56- yq -i ' .metadata.labels["clusterctl.cluster.x-k8s.io/move"] = ""' " ${OUTPUT_DIR} /templates/${filename} "
60+ # Add clusterctl labels (skip for transient CRDs)
61+ if [[ ! " ${SKIP_CLUSTERCTL_LABELS} " =~ " ${filename} " ]]; then
62+ yq -i ' .metadata.labels["clusterctl.cluster.x-k8s.io"] = ""' " ${OUTPUT_DIR} /templates/${filename} "
63+ yq -i ' .metadata.labels["clusterctl.cluster.x-k8s.io/move"] = ""' " ${OUTPUT_DIR} /templates/${filename} "
64+ fi
5765done
5866
5967echo " Generated tinkerbell-crds chart with $( ls -1 " ${OUTPUT_DIR} /templates/" | wc -l | tr -d ' ' ) CRDs"
0 commit comments