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: quarkusio#26516
(cherry picked from commit c808a4f)
  • Loading branch information
geoand authored and gsmet committed Jul 18, 2022
1 parent 7f962ea commit d4c724b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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 d4c724b

Please sign in to comment.