diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KnativeProcessor.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KnativeProcessor.java index 0d47692d9e713..a8689796a425e 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KnativeProcessor.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KnativeProcessor.java @@ -79,6 +79,7 @@ public class KnativeProcessor { private static final String KNATIVE_UTILIZATION_PERCENTAGE = "autoscaling.knative.dev/target-utilization-percentage"; private static final String KNATIVE_AUTOSCALING_TARGET = "autoscaling.knative.dev/target"; private static final String KNATIVE_CONTAINER_CONCURRENCY = "container-concurrency"; + private static final String KNATIVE_DEV_VISIBILITY = "networking.knative.dev/visibility"; @BuildStep public void checkKnative(ApplicationInfoBuildItem applicationInfo, KnativeConfig config, @@ -174,8 +175,11 @@ public List createDecorators(ApplicationInfoBuildItem applic }); if (config.clusterLocal) { - result.add(new DecoratorBuildItem(KNATIVE, - new AddLabelDecorator(name, "networking.knative.dev/visibility", "cluster-local"))); + if (labels.stream().noneMatch(l -> l.getKey().equals(KNATIVE_DEV_VISIBILITY))) { + result.add(new DecoratorBuildItem(KNATIVE, + new AddLabelDecorator(name, KNATIVE_DEV_VISIBILITY, "cluster-local"))); + } + } /** diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftProcessor.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftProcessor.java index 1062d9a749a57..f2cf12fe65613 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftProcessor.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenshiftProcessor.java @@ -67,6 +67,7 @@ public class OpenshiftProcessor { private static final int OPENSHIFT_PRIORITY = DEFAULT_PRIORITY; private static final String OPENSHIFT_INTERNAL_REGISTRY = "image-registry.openshift-image-registry.svc:5000"; private static final String DOCKERIO_REGISTRY = "docker.io"; + private static final String OPENSHIFT_V3_APP = "app"; @BuildStep public void checkOpenshift(ApplicationInfoBuildItem applicationInfo, OpenshiftConfig config, @@ -197,7 +198,9 @@ public List 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 - result.add(new DecoratorBuildItem(new AddLabelDecorator(name, "app", name))); + if (labels.stream().noneMatch(l -> l.getKey().equals(OPENSHIFT_V3_APP))) { + result.add(new DecoratorBuildItem(new AddLabelDecorator(name, OPENSHIFT_V3_APP, name))); + } // The presence of optional is causing issues in OCP 3.11, so we better remove them. // The following 4 decorator will set the optional property to null, so that it won't make it into the file.