Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove app.kubernetes.io/version label from label selectors #1696

Merged
merged 5 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

### Improvements

- TODO ([#XXX](https://github.com/kedacore/keda/pull/XXXX))
- Remove app.kubernetes.io/version label from label selectors ([#1696](https://github.com/kedacore/keda/pull/1696))

### Breaking Changes

Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ release: manifests kustomize set-version
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda=${IMAGE_CONTROLLER}
cd config/metrics-server && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda-metrics-apiserver=${IMAGE_ADAPTER}
cd config/default && \
$(KUSTOMIZE) edit add label -f app.kubernetes.io/version:${VERSION}
# Need this workaround to mitigate a problem with inserting labels into selectors,
# until this issue is solved: https://github.com/kubernetes-sigs/kustomize/issues/1009
@sed -i".out" -e 's@version:[ ].*@version: $(VERSION)@g' config/default/kustomize-config/metadataLabelTransformer.yaml
rm -rf config/default/kustomize-config/metadataLabelTransformer.yaml.out
$(KUSTOMIZE) build config/default > keda-$(VERSION).yaml

.PHONY: set-version
Expand Down Expand Up @@ -122,8 +124,10 @@ deploy: manifests kustomize
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda=${IMAGE_CONTROLLER}
cd config/metrics-server && \
$(KUSTOMIZE) edit set image ghcr.io/kedacore/keda-metrics-apiserver=${IMAGE_ADAPTER}
cd config/default && \
$(KUSTOMIZE) edit add label -f app.kubernetes.io/version:${VERSION}
# Need this workaround to mitigate a problem with inserting labels into selectors,
# until this issue is solved: https://github.com/kubernetes-sigs/kustomize/issues/1009
@sed -i".out" -e 's@version:[ ].*@version: $(VERSION)@g' config/default/kustomize-config/metadataLabelTransformer.yaml
anggao marked this conversation as resolved.
Show resolved Hide resolved
rm -rf config/default/kustomize-config/metadataLabelTransformer.yaml.out
$(KUSTOMIZE) build config/default | kubectl apply -f -

# Undeploy controller
Expand Down
8 changes: 4 additions & 4 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
app.kubernetes.io/part-of: keda-operator
app.kubernetes.io/version: main

# Need this transformer to mitigate a problem with inserting labels into selectors,
# until this issue is solved: https://github.com/kubernetes-sigs/kustomize/issues/1009
transformers:
anggao marked this conversation as resolved.
Show resolved Hide resolved
- kustomize-config/metadataLabelTransformer.yaml

resources:
- ../crd
Expand Down
10 changes: 10 additions & 0 deletions config/default/kustomize-config/metadataLabelTransformer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: builtin
kind: LabelTransformer
metadata:
name: metadataLabelTransformer
labels:
app.kubernetes.io/version: main
app.kubernetes.io/part-of: keda-operator
fieldSpecs:
- path: metadata/labels
create: true