Skip to content

Commit c0658b2

Browse files
committed
Support customization of readiness probe get action
1 parent f7539c4 commit c0658b2

File tree

16 files changed

+213
-19
lines changed

16 files changed

+213
-19
lines changed

documentation/domains/Cluster.json

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,39 @@
194194
}
195195
}
196196
},
197+
"ReadinessProbe": {
198+
"type": "object",
199+
"properties": {
200+
"failureThreshold": {
201+
"default": 1,
202+
"description": "Number of times the check is performed before giving up. Giving up in case of liveness probe means restarting the container. In case of readiness probe, the Pod will be marked Unready. Defaults to 1.",
203+
"type": "integer",
204+
"minimum": 1
205+
},
206+
"httpGetActionPath": {
207+
"description": "Path to access for the readiness probe. Defaults to /weblogic/ready",
208+
"type": "string"
209+
},
210+
"periodSeconds": {
211+
"description": "The number of seconds between checks.",
212+
"type": "integer"
213+
},
214+
"timeoutSeconds": {
215+
"description": "The number of seconds with no response that indicates a failure.",
216+
"type": "integer"
217+
},
218+
"successThreshold": {
219+
"default": 1,
220+
"description": "Minimum number of times the check needs to pass for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness Probe.",
221+
"type": "integer",
222+
"minimum": 1
223+
},
224+
"initialDelaySeconds": {
225+
"description": "The number of seconds before the first check is performed.",
226+
"type": "integer"
227+
}
228+
}
229+
},
197230
"ServerPod": {
198231
"type": "object",
199232
"properties": {
@@ -261,7 +294,7 @@
261294
},
262295
"readinessProbe": {
263296
"description": "Settings for the readiness probe associated with a WebLogic Server instance.",
264-
"$ref": "#/definitions/ProbeTuning"
297+
"$ref": "#/definitions/ReadinessProbe"
265298
},
266299
"containerSecurityContext": {
267300
"description": "Container-level security attributes. Will override any matching Pod-level attributes. See `kubectl explain pods.spec.containers.securityContext`. Beginning with operator version 4.0.5, if no value is specified for this field, the operator will use default content for container-level `securityContext`. More info: https://oracle.github.io/weblogic-kubernetes-operator/security/domain-security/pod-and-container/.",

documentation/domains/Cluster.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The specification of the operation of the WebLogic cluster. Required.
7070
| `podSecurityContext` | [Pod Security Context](k8s1.13.5.md#pod-security-context) | Pod-level security attributes. See `kubectl explain pods.spec.securityContext`. Beginning with operator version 4.0.5, if no value is specified for this field, the operator will use default content for the pod-level `securityContext`. More info: https://oracle.github.io/weblogic-kubernetes-operator/security/domain-security/pod-and-container/. |
7171
| `priorityClassName` | string | If specified, indicates the Pod's priority. "system-node-critical" and "system-cluster-critical" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be the default or zero, if there is no default. See `kubectl explain pods.spec.priorityClassName`. |
7272
| `readinessGates` | Array of [Pod Readiness Gate](k8s1.13.5.md#pod-readiness-gate) | If specified, all readiness gates will be evaluated for Pod readiness. A Pod is ready when all its containers are ready AND all conditions specified in the readiness gates have a status equal to "True". More info: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md. |
73-
| `readinessProbe` | [Probe Tuning](#probe-tuning) | Settings for the readiness probe associated with a WebLogic Server instance. |
73+
| `readinessProbe` | [Readiness Probe](#readiness-probe) | Settings for the readiness probe associated with a WebLogic Server instance. |
7474
| `resources` | [Resource Requirements](k8s1.13.5.md#resource-requirements) | Memory and CPU minimum requirements and limits for the WebLogic Server instance. See `kubectl explain pods.spec.containers.resources`. |
7575
| `restartPolicy` | string | Restart policy for all containers within the Pod. One of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy. See `kubectl explain pods.spec.restartPolicy`. |
7676
| `runtimeClassName` | string | RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this Pod. If no RuntimeClass resource matches the named class, the Pod will not be run. If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://github.com/kubernetes/community/blob/master/keps/sig-node/0014-runtime-class.md This is an alpha feature and may change in the future. See `kubectl explain pods.spec.runtimeClassName`. |
@@ -109,6 +109,17 @@ The specification of the operation of the WebLogic cluster. Required.
109109
| `successThreshold` | integer | Minimum number of times the check needs to pass for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness Probe. |
110110
| `timeoutSeconds` | integer | The number of seconds with no response that indicates a failure. |
111111

112+
### Readiness Probe
113+
114+
| Name | Type | Description |
115+
| --- | --- | --- |
116+
| `failureThreshold` | integer | Number of times the check is performed before giving up. Giving up in case of liveness probe means restarting the container. In case of readiness probe, the Pod will be marked Unready. Defaults to 1. |
117+
| `httpGetActionPath` | string | Path to access for the readiness probe. Defaults to /weblogic/ready |
118+
| `initialDelaySeconds` | integer | The number of seconds before the first check is performed. |
119+
| `periodSeconds` | integer | The number of seconds between checks. |
120+
| `successThreshold` | integer | Minimum number of times the check needs to pass for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness Probe. |
121+
| `timeoutSeconds` | integer | The number of seconds with no response that indicates a failure. |
122+
112123
### Shutdown
113124

114125
| Name | Type | Description |

documentation/domains/Domain.json

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,39 @@
10351035
}
10361036
}
10371037
},
1038+
"ReadinessProbe": {
1039+
"type": "object",
1040+
"properties": {
1041+
"failureThreshold": {
1042+
"default": 1,
1043+
"description": "Number of times the check is performed before giving up. Giving up in case of liveness probe means restarting the container. In case of readiness probe, the Pod will be marked Unready. Defaults to 1.",
1044+
"type": "integer",
1045+
"minimum": 1
1046+
},
1047+
"httpGetActionPath": {
1048+
"description": "Path to access for the readiness probe. Defaults to /weblogic/ready",
1049+
"type": "string"
1050+
},
1051+
"periodSeconds": {
1052+
"description": "The number of seconds between checks.",
1053+
"type": "integer"
1054+
},
1055+
"timeoutSeconds": {
1056+
"description": "The number of seconds with no response that indicates a failure.",
1057+
"type": "integer"
1058+
},
1059+
"successThreshold": {
1060+
"default": 1,
1061+
"description": "Minimum number of times the check needs to pass for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness Probe.",
1062+
"type": "integer",
1063+
"minimum": 1
1064+
},
1065+
"initialDelaySeconds": {
1066+
"description": "The number of seconds before the first check is performed.",
1067+
"type": "integer"
1068+
}
1069+
}
1070+
},
10381071
"ServerHealth": {
10391072
"type": "object",
10401073
"properties": {
@@ -1122,7 +1155,7 @@
11221155
},
11231156
"readinessProbe": {
11241157
"description": "Settings for the readiness probe associated with a WebLogic Server instance.",
1125-
"$ref": "#/definitions/ProbeTuning"
1158+
"$ref": "#/definitions/ReadinessProbe"
11261159
},
11271160
"containerSecurityContext": {
11281161
"description": "Container-level security attributes. Will override any matching Pod-level attributes. See `kubectl explain pods.spec.containers.securityContext`. Beginning with operator version 4.0.5, if no value is specified for this field, the operator will use default content for container-level `securityContext`. More info: https://oracle.github.io/weblogic-kubernetes-operator/security/domain-security/pod-and-container/.",

documentation/domains/Domain.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ The current status of the operation of the WebLogic domain. Updated automaticall
171171
| `podSecurityContext` | [Pod Security Context](k8s1.13.5.md#pod-security-context) | Pod-level security attributes. See `kubectl explain pods.spec.securityContext`. Beginning with operator version 4.0.5, if no value is specified for this field, the operator will use default content for the pod-level `securityContext`. More info: https://oracle.github.io/weblogic-kubernetes-operator/security/domain-security/pod-and-container/. |
172172
| `priorityClassName` | string | If specified, indicates the Pod's priority. "system-node-critical" and "system-cluster-critical" are two special keywords which indicate the highest priorities with the former being the highest priority. Any other name must be defined by creating a PriorityClass object with that name. If not specified, the pod priority will be the default or zero, if there is no default. See `kubectl explain pods.spec.priorityClassName`. |
173173
| `readinessGates` | Array of [Pod Readiness Gate](k8s1.13.5.md#pod-readiness-gate) | If specified, all readiness gates will be evaluated for Pod readiness. A Pod is ready when all its containers are ready AND all conditions specified in the readiness gates have a status equal to "True". More info: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md. |
174-
| `readinessProbe` | [Probe Tuning](#probe-tuning) | Settings for the readiness probe associated with a WebLogic Server instance. |
174+
| `readinessProbe` | [Readiness Probe](#readiness-probe) | Settings for the readiness probe associated with a WebLogic Server instance. |
175175
| `resources` | [Resource Requirements](k8s1.13.5.md#resource-requirements) | Memory and CPU minimum requirements and limits for the WebLogic Server instance. See `kubectl explain pods.spec.containers.resources`. |
176176
| `restartPolicy` | string | Restart policy for all containers within the Pod. One of Always, OnFailure, Never. Default to Always. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy. See `kubectl explain pods.spec.restartPolicy`. |
177177
| `runtimeClassName` | string | RuntimeClassName refers to a RuntimeClass object in the node.k8s.io group, which should be used to run this Pod. If no RuntimeClass resource matches the named class, the Pod will not be run. If unset or empty, the "legacy" RuntimeClass will be used, which is an implicit class with an empty definition that uses the default runtime handler. More info: https://github.com/kubernetes/community/blob/master/keps/sig-node/0014-runtime-class.md This is an alpha feature and may change in the future. See `kubectl explain pods.spec.runtimeClassName`. |
@@ -290,6 +290,17 @@ The current status of the operation of the WebLogic domain. Updated automaticall
290290
| `successThreshold` | integer | Minimum number of times the check needs to pass for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness Probe. |
291291
| `timeoutSeconds` | integer | The number of seconds with no response that indicates a failure. |
292292

293+
### Readiness Probe
294+
295+
| Name | Type | Description |
296+
| --- | --- | --- |
297+
| `failureThreshold` | integer | Number of times the check is performed before giving up. Giving up in case of liveness probe means restarting the container. In case of readiness probe, the Pod will be marked Unready. Defaults to 1. |
298+
| `httpGetActionPath` | string | Path to access for the readiness probe. Defaults to /weblogic/ready |
299+
| `initialDelaySeconds` | integer | The number of seconds before the first check is performed. |
300+
| `periodSeconds` | integer | The number of seconds between checks. |
301+
| `successThreshold` | integer | Minimum number of times the check needs to pass for the probe to be considered successful after having failed. Defaults to 1. Must be 1 for liveness Probe. |
302+
| `timeoutSeconds` | integer | The number of seconds with no response that indicates a failure. |
303+
293304
### Shutdown
294305

295306
| Name | Type | Description |

kubernetes/crd/cluster-crd.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: apiextensions.k8s.io/v1
55
kind: CustomResourceDefinition
66
metadata:
77
annotations:
8-
weblogic.sha256: 7146de067298f75bf803e2c8acf9f88980d1d5770e375122bcbb1fe4e6f9a64b
8+
weblogic.sha256: c9c6b797a06a2cf665deeac0185d0b184217e11f76c5ac30d31119f097f5b643
99
name: clusters.weblogic.oracle
1010
spec:
1111
group: weblogic.oracle
@@ -274,6 +274,10 @@ spec:
274274
be marked Unready. Defaults to 1.
275275
minimum: 1
276276
type: integer
277+
httpGetActionPath:
278+
description: Path to access for the readiness probe. Defaults
279+
to /weblogic/ready
280+
type: string
277281
periodSeconds:
278282
description: The number of seconds between checks.
279283
type: integer

kubernetes/crd/domain-crd.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apiVersion: apiextensions.k8s.io/v1
55
kind: CustomResourceDefinition
66
metadata:
77
annotations:
8-
weblogic.sha256: 8eb63425366f1b880048f26915d7a1943d788a13ed7a483aeb8081848d4ea971
8+
weblogic.sha256: 653439a5d1ec2d78f02b8003d36a1c022f46b16d3bfe070a2b2cb49030c5c4b9
99
name: domains.weblogic.oracle
1010
spec:
1111
group: weblogic.oracle
@@ -1370,6 +1370,10 @@ spec:
13701370
the Pod will be marked Unready. Defaults to 1.
13711371
minimum: 1
13721372
type: integer
1373+
httpGetActionPath:
1374+
description: Path to access for the readiness probe. Defaults
1375+
to /weblogic/ready
1376+
type: string
13731377
periodSeconds:
13741378
description: The number of seconds between checks.
13751379
type: integer
@@ -4465,6 +4469,10 @@ spec:
44654469
be marked Unready. Defaults to 1.
44664470
minimum: 1
44674471
type: integer
4472+
httpGetActionPath:
4473+
description: Path to access for the readiness probe. Defaults
4474+
to /weblogic/ready
4475+
type: string
44684476
periodSeconds:
44694477
description: The number of seconds between checks.
44704478
type: integer
@@ -7207,6 +7215,10 @@ spec:
72077215
1.
72087216
type: integer
72097217
minimum: 1
7218+
httpGetActionPath:
7219+
description: Path to access for the readiness probe.
7220+
Defaults to /weblogic/ready
7221+
type: string
72107222
periodSeconds:
72117223
description: The number of seconds between checks.
72127224
type: integer

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@ private V1Probe createReadinessProbe(PodTuning tuning) {
923923
readinessProbe =
924924
readinessProbe.httpGet(
925925
httpGetAction(
926-
READINESS_PATH,
926+
getReadinessProbeHttpGetAction(),
927927
getLocalAdminProtocolChannelPort(),
928928
isLocalAdminProtocolChannelSecure()));
929929
} catch (Exception e) {
@@ -967,6 +967,10 @@ private int getReadinessProbeFailureThreshold(PodTuning tuning) {
967967
.orElse(tuning.getReadinessProbeFailureThreshold());
968968
}
969969

970+
private String getReadinessProbeHttpGetAction() {
971+
return Optional.ofNullable(getServerSpec().getReadinessProbe().getHttpGetActionPath()).orElse(READINESS_PATH);
972+
}
973+
970974
private V1Probe createLivenessProbe(PodTuning tuning) {
971975
V1Probe livenessProbe = new V1Probe()
972976
.initialDelaySeconds(getLivenessProbeInitialDelaySeconds(tuning))

operator/src/main/java/oracle/kubernetes/operator/processing/EffectiveServerSpec.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
1+
// Copyright (c) 2018, 2024, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.operator.processing;
@@ -22,6 +22,7 @@
2222
import io.kubernetes.client.openapi.models.V1Volume;
2323
import io.kubernetes.client.openapi.models.V1VolumeMount;
2424
import oracle.kubernetes.weblogic.domain.model.ProbeTuning;
25+
import oracle.kubernetes.weblogic.domain.model.ReadinessProbe;
2526
import oracle.kubernetes.weblogic.domain.model.Shutdown;
2627

2728
public interface EffectiveServerSpec {
@@ -91,7 +92,7 @@ public interface EffectiveServerSpec {
9192
ProbeTuning getLivenessProbe();
9293

9394
@Nonnull
94-
ProbeTuning getReadinessProbe();
95+
ReadinessProbe getReadinessProbe();
9596

9697
@Nonnull
9798
Shutdown getShutdown();

operator/src/main/java/oracle/kubernetes/weblogic/domain/ServerConfigurator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
1+
// Copyright (c) 2018, 2024, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.weblogic.domain;
@@ -33,6 +33,8 @@ public interface ServerConfigurator extends ServiceConfigurator {
3333

3434
ServerConfigurator withReadinessProbeThresholds(Integer successThreshold, Integer failureThreshold);
3535

36+
ServerConfigurator withReadinessProbeHttpGetActionPath(String httpGetActionPath);
37+
3638
/**
3739
* Add a node label to the Servers' node selector.
3840
*

operator/src/main/java/oracle/kubernetes/weblogic/domain/model/BaseConfiguration.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
1+
// Copyright (c) 2018, 2024, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.weblogic.domain.model;
@@ -158,7 +158,11 @@ void setReadinessProbeThresholds(Integer successThreshold, Integer failureThresh
158158
serverPod.setReadinessProbeThresholds(successThreshold, failureThreshold);
159159
}
160160

161-
ProbeTuning getReadinessProbe() {
161+
void setReadinessProbeHttpGetActionPath(String httpGetActionPath) {
162+
serverPod.setReadinessProbeHttpGetActionPath(httpGetActionPath);
163+
}
164+
165+
ReadinessProbe getReadinessProbe() {
162166
return serverPod.getReadinessProbeTuning();
163167
}
164168

operator/src/main/java/oracle/kubernetes/weblogic/domain/model/EffectiveServerSpecCommonImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018, 2023, Oracle and/or its affiliates.
1+
// Copyright (c) 2018, 2024, Oracle and/or its affiliates.
22
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33

44
package oracle.kubernetes.weblogic.domain.model;
@@ -158,7 +158,7 @@ public ProbeTuning getLivenessProbe() {
158158

159159
@Nonnull
160160
@Override
161-
public ProbeTuning getReadinessProbe() {
161+
public ReadinessProbe getReadinessProbe() {
162162
return server.getReadinessProbe();
163163
}
164164

0 commit comments

Comments
 (0)