Skip to content

Commit

Permalink
Ensure that labels for different k8s targets don't interfere with eac…
Browse files Browse the repository at this point in the history
…h other

Fixes: #26516
  • Loading branch information
geoand committed Jul 5, 2022
1 parent 380092c commit c808a4f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
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

0 comments on commit c808a4f

Please sign in to comment.