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

Ensure that labels for different k8s targets don't interfere with each other #26561

Merged
merged 1 commit into from Jul 6, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -172,7 +172,8 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic
});

if (config.clusterLocal) {
if (labels.stream().noneMatch(l -> l.getKey().equals(KNATIVE_DEV_VISIBILITY))) {
if (labels.stream().filter(l -> KNATIVE.equals(l.getTarget()))
.noneMatch(l -> l.getKey().equals(KNATIVE_DEV_VISIBILITY))) {
result.add(new DecoratorBuildItem(KNATIVE,
new AddLabelDecorator(name, KNATIVE_DEV_VISIBILITY, "cluster-local")));
}
Expand Down
Expand Up @@ -198,7 +198,8 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic
if (config.flavor == v3) {
//Openshift 3.x doesn't recognize 'app.kubernetes.io/name', it uses 'app' instead.
//The decorator will be applied even on non-openshift resources is it may affect for example: knative
if (labels.stream().noneMatch(l -> l.getKey().equals(OPENSHIFT_V3_APP))) {
if (labels.stream().filter(l -> OPENSHIFT.equals(l.getTarget()))
.noneMatch(l -> l.getKey().equals(OPENSHIFT_V3_APP))) {
result.add(new DecoratorBuildItem(new AddLabelDecorator(name, OPENSHIFT_V3_APP, name)));
}

Expand Down Expand Up @@ -250,7 +251,8 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic

result.add(new DecoratorBuildItem(OPENSHIFT, new ApplyImagePullPolicyDecorator(name, config.getImagePullPolicy())));

if (labels.stream().noneMatch(l -> l.getKey().equals(OPENSHIFT_APP_RUNTIME))) {
if (labels.stream().filter(l -> OPENSHIFT.equals(l.getTarget()))
.noneMatch(l -> l.getKey().equals(OPENSHIFT_APP_RUNTIME))) {
result.add(new DecoratorBuildItem(OPENSHIFT, new AddLabelDecorator(name, OPENSHIFT_APP_RUNTIME, QUARKUS)));
}

Expand Down
@@ -1,2 +1,4 @@
quarkus.kubernetes.deployment-target=openshift
quarkus.openshift.flavor=v3
quarkus.openshift.flavor=v3
# used in order to ensure that the non-openshift label does not interfere with the openshift manifest generation
quarkus.knative.labels."app.openshift.io/runtime"=test