Skip to content

Commit 5856075

Browse files
authored
fix: make deploy supports release branch (#981)
The deploy target's `kustomize edit set image` was never actually overriding the base kustomization's image tag. This was masked on non-release branches because the base newTag (latest) happened to match the hardcoded test image tag. On release branches, the base newTag changes to the release version, exposing the mismatch and causing e2e test pods to stay Pending (image not found in Kind). Fix by: - Copying kustomize to .output/ so edits don't modify tracked files - Matching both short name and registry-prefixed name to ensure the override works regardless of base kustomization state Extracted from #763. Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
1 parent 27b3c65 commit 5856075

4 files changed

Lines changed: 24 additions & 6 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Sessionx.vim
3333
*.elc
3434
.\#*
3535

36+
## Kustomize intermediate output
37+
**/kustomize/.output/
38+
3639
## macOS
3740
.DS_Store
3841
.AppleDouble

workspaces/backend/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,13 @@ $(GOLANGCI_LINT): $(LOCALBIN)
154154

155155
.PHONY: deploy
156156
deploy: kustomize ## Deploy backend to the K8s cluster specified in ~/.kube/config.
157-
cd manifests/kustomize/overlays/istio && $(KUSTOMIZE) edit set image workspaces-backend=${IMG}
158-
$(KUBECTL) apply -k manifests/kustomize/overlays/istio
157+
@echo "Copying kustomize directory structure to .output..."
158+
@rm -rf manifests/kustomize/.output
159+
@mkdir -p manifests/kustomize/.output
160+
@cp -r manifests/kustomize/* manifests/kustomize/.output/
161+
# Match both short name and registry-prefixed name (base kustomization may transform either)
162+
@cd manifests/kustomize/.output/overlays/istio && $(KUSTOMIZE) edit set image $(NAME)=${IMG} $(REGISTRY)/$(NAME)=${IMG}
163+
@$(KUBECTL) apply -k manifests/kustomize/.output/overlays/istio
159164

160165
.PHONY: undeploy
161166
undeploy: kustomize ## Undeploy backend from the K8s cluster specified in ~/.kube/config.

workspaces/controller/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,13 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
143143

144144
.PHONY: deploy
145145
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
146-
cd manifests/kustomize/overlays/istio && $(KUSTOMIZE) edit set image workspaces-controller=${IMG}
147-
$(KUBECTL) apply -k manifests/kustomize/overlays/istio
146+
@echo "Copying kustomize directory structure to .output..."
147+
@rm -rf manifests/kustomize/.output
148+
@mkdir -p manifests/kustomize/.output
149+
@cp -r manifests/kustomize/* manifests/kustomize/.output/
150+
# Match both short name and registry-prefixed name (base kustomization may transform either)
151+
@cd manifests/kustomize/.output/overlays/istio && $(KUSTOMIZE) edit set image $(NAME)=${IMG} $(REGISTRY)/$(NAME)=${IMG}
152+
@$(KUBECTL) apply -k manifests/kustomize/.output/overlays/istio
148153

149154
.PHONY: undeploy
150155
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.

workspaces/frontend/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,13 @@ docker-build-push-multi-arch:
5555

5656
.PHONY: deploy
5757
deploy: kustomize ## Deploy frontend to the K8s cluster specified in ~/.kube/config.
58-
cd manifests/kustomize/overlays/istio && $(KUSTOMIZE) edit set image workspaces-frontend=${IMG}
59-
$(KUBECTL) apply -k manifests/kustomize/overlays/istio
58+
@echo "Copying kustomize directory structure to .output..."
59+
@rm -rf manifests/kustomize/.output
60+
@mkdir -p manifests/kustomize/.output
61+
@cp -r manifests/kustomize/* manifests/kustomize/.output/
62+
# Match both short name and registry-prefixed name (base kustomization may transform either)
63+
@cd manifests/kustomize/.output/overlays/istio && $(KUSTOMIZE) edit set image $(NAME)=${IMG} $(REGISTRY)/$(NAME)=${IMG}
64+
@$(KUBECTL) apply -k manifests/kustomize/.output/overlays/istio
6065

6166
.PHONY: undeploy
6267
undeploy: kustomize ## Undeploy frontend from the K8s cluster specified in ~/.kube/config.

0 commit comments

Comments
 (0)