From 6e7e16381c7974a2d5624123617885db899c2baf Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 29 Mar 2023 09:51:17 +0200 Subject: [PATCH] Fix typo in OpenShift liveness probe Fix https://github.com/quarkusio/quarkus/issues/32135 --- .../deployment/ApplyHttpGetActionPortDecorator.java | 6 ++---- .../java/io/quarkus/kubernetes/deployment/Constants.java | 4 ++++ .../quarkus/kubernetes/deployment/DevClusterHelper.java | 9 ++++++--- .../kubernetes/deployment/OpenshiftProcessor.java | 9 ++++++--- .../deployment/VanillaKubernetesProcessor.java | 9 ++++++--- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/ApplyHttpGetActionPortDecorator.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/ApplyHttpGetActionPortDecorator.java index 1afe6e7aa81b6f..75c08c859eda6a 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/ApplyHttpGetActionPortDecorator.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/ApplyHttpGetActionPortDecorator.java @@ -6,8 +6,7 @@ import java.util.Map; import java.util.Optional; -import io.dekorate.kubernetes.decorator.AddLivenessProbeDecorator; -import io.dekorate.kubernetes.decorator.AddReadinessProbeDecorator; +import io.dekorate.kubernetes.decorator.AbstractAddProbeDecorator; import io.dekorate.kubernetes.decorator.AddSidecarDecorator; import io.dekorate.kubernetes.decorator.Decorator; import io.dekorate.kubernetes.decorator.ResourceProvidingDecorator; @@ -106,7 +105,6 @@ public void visit(HTTPGetActionFluent action) { @Override public Class[] after() { - return new Class[] { ResourceProvidingDecorator.class, AddSidecarDecorator.class, - AddLivenessProbeDecorator.class, AddReadinessProbeDecorator.class }; + return new Class[] { ResourceProvidingDecorator.class, AddSidecarDecorator.class, AbstractAddProbeDecorator.class }; } } diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/Constants.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/Constants.java index 47aa05a3db065b..101d3a5ff7a63b 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/Constants.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/Constants.java @@ -59,6 +59,10 @@ public final class Constants { public static final int MIN_NODE_PORT_VALUE = 30000; public static final int MAX_NODE_PORT_VALUE = 31999; + public static final String LIVENESS_PROBE = "livenessProbe"; + public static final String READINESS_PROBE = "readinessProbe"; + public static final String STARTUP_PROBE = "startupProbe"; + private Constants() { } } diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/DevClusterHelper.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/DevClusterHelper.java index 3e837624d5e7f5..77bc359390b6bf 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/DevClusterHelper.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/DevClusterHelper.java @@ -2,10 +2,13 @@ package io.quarkus.kubernetes.deployment; import static io.quarkus.kubernetes.deployment.Constants.KUBERNETES; +import static io.quarkus.kubernetes.deployment.Constants.LIVENESS_PROBE; import static io.quarkus.kubernetes.deployment.Constants.MAX_NODE_PORT_VALUE; import static io.quarkus.kubernetes.deployment.Constants.MAX_PORT_NUMBER; import static io.quarkus.kubernetes.deployment.Constants.MIN_NODE_PORT_VALUE; import static io.quarkus.kubernetes.deployment.Constants.MIN_PORT_NUMBER; +import static io.quarkus.kubernetes.deployment.Constants.READINESS_PROBE; +import static io.quarkus.kubernetes.deployment.Constants.STARTUP_PROBE; import java.math.BigInteger; import java.nio.charset.StandardCharsets; @@ -128,15 +131,15 @@ public static List createDecorators(String clusterKind, //Probe port handling result.add( - KubernetesCommonHelper.createProbeHttpPortDecorator(name, clusterKind, "livenessProbe", config.livenessProbe, + KubernetesCommonHelper.createProbeHttpPortDecorator(name, clusterKind, LIVENESS_PROBE, config.livenessProbe, portName, ports)); result.add( - KubernetesCommonHelper.createProbeHttpPortDecorator(name, clusterKind, "readinessProbe", config.readinessProbe, + KubernetesCommonHelper.createProbeHttpPortDecorator(name, clusterKind, READINESS_PROBE, config.readinessProbe, portName, ports)); result.add( - KubernetesCommonHelper.createProbeHttpPortDecorator(name, clusterKind, "startupProbe", config.startupProbe, + KubernetesCommonHelper.createProbeHttpPortDecorator(name, clusterKind, STARTUP_PROBE, config.startupProbe, portName, ports)); 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 5bbb03e9828926..199b54be05228c 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 @@ -2,10 +2,13 @@ package io.quarkus.kubernetes.deployment; import static io.quarkus.kubernetes.deployment.Constants.DEFAULT_S2I_IMAGE_NAME; +import static io.quarkus.kubernetes.deployment.Constants.LIVENESS_PROBE; import static io.quarkus.kubernetes.deployment.Constants.OPENSHIFT; import static io.quarkus.kubernetes.deployment.Constants.OPENSHIFT_APP_RUNTIME; import static io.quarkus.kubernetes.deployment.Constants.QUARKUS; +import static io.quarkus.kubernetes.deployment.Constants.READINESS_PROBE; import static io.quarkus.kubernetes.deployment.Constants.ROUTE; +import static io.quarkus.kubernetes.deployment.Constants.STARTUP_PROBE; import static io.quarkus.kubernetes.deployment.OpenshiftConfig.OpenshiftFlavor.v3; import static io.quarkus.kubernetes.spi.KubernetesDeploymentTargetBuildItem.DEFAULT_PRIORITY; @@ -310,15 +313,15 @@ public List createDecorators(ApplicationInfoBuildItem applic } // Probe port handling - result.add(KubernetesCommonHelper.createProbeHttpPortDecorator(name, OPENSHIFT, "livenssProbe", config.livenessProbe, + result.add(KubernetesCommonHelper.createProbeHttpPortDecorator(name, OPENSHIFT, LIVENESS_PROBE, config.livenessProbe, portName, ports)); result.add( - KubernetesCommonHelper.createProbeHttpPortDecorator(name, OPENSHIFT, "readinessProbe", config.readinessProbe, + KubernetesCommonHelper.createProbeHttpPortDecorator(name, OPENSHIFT, READINESS_PROBE, config.readinessProbe, portName, ports)); result.add( - KubernetesCommonHelper.createProbeHttpPortDecorator(name, OPENSHIFT, "startupProbe", config.startupProbe, + KubernetesCommonHelper.createProbeHttpPortDecorator(name, OPENSHIFT, STARTUP_PROBE, config.startupProbe, portName, ports)); diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/VanillaKubernetesProcessor.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/VanillaKubernetesProcessor.java index 031d4a9e9530fd..ca88fe0eff3ecb 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/VanillaKubernetesProcessor.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/VanillaKubernetesProcessor.java @@ -5,6 +5,9 @@ import static io.quarkus.kubernetes.deployment.Constants.DEPLOYMENT_VERSION; import static io.quarkus.kubernetes.deployment.Constants.INGRESS; import static io.quarkus.kubernetes.deployment.Constants.KUBERNETES; +import static io.quarkus.kubernetes.deployment.Constants.LIVENESS_PROBE; +import static io.quarkus.kubernetes.deployment.Constants.READINESS_PROBE; +import static io.quarkus.kubernetes.deployment.Constants.STARTUP_PROBE; import static io.quarkus.kubernetes.spi.KubernetesDeploymentTargetBuildItem.VANILLA_KUBERNETES_PRIORITY; import java.util.ArrayList; @@ -252,15 +255,15 @@ public List createDecorators(ApplicationInfoBuildItem applic // Probe port handling result.add( - KubernetesCommonHelper.createProbeHttpPortDecorator(name, KUBERNETES, "livenessProbe", config.livenessProbe, + KubernetesCommonHelper.createProbeHttpPortDecorator(name, KUBERNETES, LIVENESS_PROBE, config.livenessProbe, portName, ports)); result.add( - KubernetesCommonHelper.createProbeHttpPortDecorator(name, KUBERNETES, "readinessProbe", config.readinessProbe, + KubernetesCommonHelper.createProbeHttpPortDecorator(name, KUBERNETES, READINESS_PROBE, config.readinessProbe, portName, ports)); result.add( - KubernetesCommonHelper.createProbeHttpPortDecorator(name, KUBERNETES, "startupProbe", config.startupProbe, + KubernetesCommonHelper.createProbeHttpPortDecorator(name, KUBERNETES, STARTUP_PROBE, config.startupProbe, portName, ports));