Skip to content

Commit 7d0a100

Browse files
committed
Readiness probe use ready app endpoint
1 parent 682f5da commit 7d0a100

File tree

4 files changed

+15
-38
lines changed

4 files changed

+15
-38
lines changed

operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66

77
import static oracle.kubernetes.operator.LabelConstants.forDomainUid;
88

9+
import io.kubernetes.client.custom.IntOrString;
910
import io.kubernetes.client.models.V1ConfigMapVolumeSource;
1011
import io.kubernetes.client.models.V1Container;
1112
import io.kubernetes.client.models.V1ContainerPort;
1213
import io.kubernetes.client.models.V1DeleteOptions;
1314
import io.kubernetes.client.models.V1EnvVar;
1415
import io.kubernetes.client.models.V1ExecAction;
16+
import io.kubernetes.client.models.V1HTTPGetAction;
1517
import io.kubernetes.client.models.V1Handler;
1618
import io.kubernetes.client.models.V1Lifecycle;
1719
import io.kubernetes.client.models.V1ObjectMeta;
@@ -58,9 +60,10 @@ public abstract class PodStepContext implements StepContextConstants {
5860

5961
private static final String STOP_SERVER = "/weblogic-operator/scripts/stopServer.sh";
6062
private static final String START_SERVER = "/weblogic-operator/scripts/startServer.sh";
61-
private static final String READINESS_PROBE = "/weblogic-operator/scripts/readinessProbe.sh";
6263
private static final String LIVENESS_PROBE = "/weblogic-operator/scripts/livenessProbe.sh";
6364

65+
private static final String READINESS_PATH = "/weblogic";
66+
6467
private final DomainPresenceInfo info;
6568
private final Step conflictStep;
6669
private V1Pod podModel;
@@ -762,10 +765,16 @@ private V1Probe createReadinessProbe(TuningParameters.PodTuning tuning) {
762765
.timeoutSeconds(getReadinessProbeTimeoutSeconds(tuning))
763766
.periodSeconds(getReadinessProbePeriodSeconds(tuning))
764767
.failureThreshold(FAILURE_THRESHOLD)
765-
.exec(execAction(READINESS_PROBE));
768+
.httpGet(httpGetAction(READINESS_PATH, getPort()));
766769
return readinessProbe;
767770
}
768771

772+
private V1HTTPGetAction httpGetAction(String path, int port) {
773+
V1HTTPGetAction getAction = new V1HTTPGetAction();
774+
getAction.path(path).port(new IntOrString(port));
775+
return getAction;
776+
}
777+
769778
private int getReadinessProbePeriodSeconds(TuningParameters.PodTuning tuning) {
770779
return Optional.ofNullable(getServerSpec().getReadinessProbe().getPeriodSeconds())
771780
.orElse(tuning.readinessProbePeriodSeconds);

operator/src/main/resources/scripts/readinessProbe.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

operator/src/test/java/oracle/kubernetes/operator/helpers/ConfigMapHelperTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public class ConfigMapHelperTest {
5858
private static final String DOMAIN_UID = "domainUID1";
5959
static final String[] SCRIPT_NAMES = {
6060
"livenessProbe.sh",
61-
"readinessProbe.sh",
6261
"readState.sh",
6362
"start-server.py",
6463
"startServer.sh",

operator/src/test/java/oracle/kubernetes/operator/helpers/PodHelperTestBase.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import io.kubernetes.client.models.V1ContainerPort;
3535
import io.kubernetes.client.models.V1EnvVar;
3636
import io.kubernetes.client.models.V1ExecAction;
37+
import io.kubernetes.client.models.V1HTTPGetAction;
3738
import io.kubernetes.client.models.V1Handler;
3839
import io.kubernetes.client.models.V1HostPathVolumeSource;
3940
import io.kubernetes.client.models.V1Lifecycle;
@@ -303,9 +304,9 @@ public void whenPodCreated_livenessProbeHasDefinedTuning() {
303304

304305
@Test
305306
public void whenPodCreated_readinessProbeHasReadinessCommand() {
306-
assertThat(
307-
getCreatedPodSpecContainer().getReadinessProbe().getExec().getCommand(),
308-
contains("/weblogic-operator/scripts/readinessProbe.sh"));
307+
V1HTTPGetAction getAction = getCreatedPodSpecContainer().getReadinessProbe().getHttpGet();
308+
assertThat(getAction.getPath(), equalTo("/weblogic"));
309+
assertThat(getAction.getPort().getIntValue(), equalTo(listenPort));
309310
}
310311

311312
@Test

0 commit comments

Comments
 (0)