Skip to content

Commit bdde759

Browse files
authored
Replace deprecated kustomize label command with yq (#10)
1 parent e84b447 commit bdde759

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,14 @@ docker-buildx: ## Build and push docker image for the manager for cross-platform
209209
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
210210
mkdir -p dist
211211
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
212-
@if [ -n "$(VERSION_LABEL)" ]; then \
213-
cd config/default && $(KUSTOMIZE) edit add label app.kubernetes.io/version:$(VERSION_LABEL) --force; \
214-
fi
215-
@if [ -n "$(GIT_SHA_LABEL)" ]; then \
216-
cd config/default && $(KUSTOMIZE) edit add label app.kubernetes.io/commit:$(GIT_SHA_LABEL) --force; \
212+
@if [ -n "$(VERSION_LABEL)" ] || [ -n "$(GIT_SHA_LABEL)" ]; then \
213+
yq write --inplace config/default/kustomization.yaml 'labels[+].includeSelectors' true; \
214+
if [ -n "$(VERSION_LABEL)" ]; then \
215+
yq write --inplace config/default/kustomization.yaml 'labels[0].pairs[app.kubernetes.io/version]' '$(VERSION_LABEL)'; \
216+
fi; \
217+
if [ -n "$(GIT_SHA_LABEL)" ]; then \
218+
yq write --inplace config/default/kustomization.yaml 'labels[0].pairs[app.kubernetes.io/commit]' '$(GIT_SHA_LABEL)'; \
219+
fi; \
217220
fi
218221
$(KUSTOMIZE) build config/default > dist/install.yaml
219222
@if [ -n "$(VERSION_LABEL)" ] || [ -n "$(GIT_SHA_LABEL)" ]; then \

0 commit comments

Comments
 (0)