Skip to content

Commit

Permalink
Merge branch 'startup-probes' into 'main'
Browse files Browse the repository at this point in the history
Support configuring of startup probes

See merge request weblogic-cloud/weblogic-kubernetes-operator!4748
  • Loading branch information
rjeberhard committed Jul 8, 2024
2 parents f6b0ae6 + b1f33fb commit f0f13fa
Show file tree
Hide file tree
Showing 12 changed files with 327 additions and 7 deletions.
4 changes: 4 additions & 0 deletions documentation/domains/Cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.28.2/_definitions.json#/definitions/io.k8s.api.core.v1.HostAlias"
}
},
"startupProbe": {
"description": "Settings for the startup probe associated with a WebLogic Server instance. If not specified, the operator will not create a default startup probe.",
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.28.2/_definitions.json#/definitions/io.k8s.api.core.v1.Probe"
},
"nodeSelector": {
"description": "Selector which must match a Node\u0027s labels for the Pod to be scheduled on that Node. See `kubectl explain pods.spec.nodeSelector`.",
"additionalProperties": {
Expand Down
1 change: 1 addition & 0 deletions documentation/domains/Cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ The specification of the operation of the WebLogic cluster. Required.
| `schedulerName` | string | If specified, the Pod will be dispatched by the specified scheduler. If not specified, the Pod will be dispatched by the default scheduler. See `kubectl explain pods.spec.schedulerName`. |
| `serviceAccountName` | string | Name of the ServiceAccount to be used to run this Pod. If it is not set, default ServiceAccount will be used. The ServiceAccount has to exist at the time the Pod is created. See `kubectl explain pods.spec.serviceAccountName`. |
| `shutdown` | [Shutdown](#shutdown) | Configures how the operator should shut down the server instance. |
| `startupProbe` | [Probe](k8s1.28.2.md#probe) | Settings for the startup probe associated with a WebLogic Server instance. If not specified, the operator will not create a default startup probe. |
| `tolerations` | Array of [Toleration](k8s1.28.2.md#toleration) | If specified, the Pod's tolerations. See `kubectl explain pods.spec.tolerations`. |
| `topologySpreadConstraints` | Array of [Topology Spread Constraint](k8s1.28.2.md#topology-spread-constraint) | TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed. |
| `volumeMounts` | Array of [Volume Mount](k8s1.28.2.md#volume-mount) | Additional volume mounts for the container running a WebLogic Server instance. See `kubectl explain pods.spec.containers.volumeMounts`. |
Expand Down
4 changes: 4 additions & 0 deletions documentation/domains/Domain.json
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,10 @@
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.28.2/_definitions.json#/definitions/io.k8s.api.core.v1.HostAlias"
}
},
"startupProbe": {
"description": "Settings for the startup probe associated with a WebLogic Server instance. If not specified, the operator will not create a default startup probe.",
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.28.2/_definitions.json#/definitions/io.k8s.api.core.v1.Probe"
},
"nodeSelector": {
"description": "Selector which must match a Node\u0027s labels for the Pod to be scheduled on that Node. See `kubectl explain pods.spec.nodeSelector`.",
"additionalProperties": {
Expand Down
1 change: 1 addition & 0 deletions documentation/domains/Domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ The current status of the operation of the WebLogic domain. Updated automaticall
| `schedulerName` | string | If specified, the Pod will be dispatched by the specified scheduler. If not specified, the Pod will be dispatched by the default scheduler. See `kubectl explain pods.spec.schedulerName`. |
| `serviceAccountName` | string | Name of the ServiceAccount to be used to run this Pod. If it is not set, default ServiceAccount will be used. The ServiceAccount has to exist at the time the Pod is created. See `kubectl explain pods.spec.serviceAccountName`. |
| `shutdown` | [Shutdown](#shutdown) | Configures how the operator should shut down the server instance. |
| `startupProbe` | [Probe](k8s1.28.2.md#probe) | Settings for the startup probe associated with a WebLogic Server instance. If not specified, the operator will not create a default startup probe. |
| `tolerations` | Array of [Toleration](k8s1.28.2.md#toleration) | If specified, the Pod's tolerations. See `kubectl explain pods.spec.tolerations`. |
| `topologySpreadConstraints` | Array of [Topology Spread Constraint](k8s1.28.2.md#topology-spread-constraint) | TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed. |
| `volumeMounts` | Array of [Volume Mount](k8s1.28.2.md#volume-mount) | Additional volume mounts for the container running a WebLogic Server instance. See `kubectl explain pods.spec.containers.volumeMounts`. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ The operator will restart servers when any of the follow fields on the Domain th
* `readinessProbe`
* `resources`
* `restartVersion`
* `startupProbe`
* `volumes`
* `volumeMounts`

Expand Down
70 changes: 69 additions & 1 deletion kubernetes/crd/cluster-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
weblogic.sha256: 25a60de9429ea0f9bad45b3083d18c9ff56c86c62a123cdff67af4bacf82eec5
weblogic.sha256: 2f9c1cd88595595fecef563dbc9a149f318eab7146b63cb6142c45279ad4f9e7
name: clusters.weblogic.oracle
spec:
group: weblogic.oracle
Expand Down Expand Up @@ -207,6 +207,74 @@ spec:
items:
type: string
type: array
startupProbe:
description: Settings for the startup probe associated with a
WebLogic Server instance. If not specified, the operator will
not create a default startup probe.
properties:
terminationGracePeriodSeconds:
type: integer
failureThreshold:
type: integer
periodSeconds:
type: integer
tcpSocket:
properties:
port:
x-kubernetes-int-or-string: true
host:
type: string
required:
- port
type: object
timeoutSeconds:
type: integer
successThreshold:
type: integer
initialDelaySeconds:
type: integer
exec:
properties:
command:
items:
type: string
type: array
type: object
grpc:
properties:
port:
type: integer
service:
type: string
required:
- port
type: object
httpGet:
properties:
path:
type: string
scheme:
type: string
port:
x-kubernetes-int-or-string: true
host:
type: string
httpHeaders:
items:
type: object
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: array
required:
- port
type: object
type: object
nodeSelector:
additionalProperties:
type: string
Expand Down
206 changes: 205 additions & 1 deletion kubernetes/crd/domain-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
weblogic.sha256: ee0c6f79288b000cd61aa9438ab7f24f63b6334072e3520f25ee454f8bff6175
weblogic.sha256: b48d0f17054d017bd3d9df2d30929bab24882235a628b715f59092f288dd569e
name: domains.weblogic.oracle
spec:
group: weblogic.oracle
Expand Down Expand Up @@ -1301,6 +1301,74 @@ spec:
items:
type: string
type: array
startupProbe:
description: Settings for the startup probe associated with
a WebLogic Server instance. If not specified, the operator
will not create a default startup probe.
properties:
terminationGracePeriodSeconds:
type: integer
failureThreshold:
type: integer
periodSeconds:
type: integer
tcpSocket:
properties:
port:
x-kubernetes-int-or-string: true
host:
type: string
required:
- port
type: object
timeoutSeconds:
type: integer
successThreshold:
type: integer
initialDelaySeconds:
type: integer
exec:
properties:
command:
items:
type: string
type: array
type: object
grpc:
properties:
port:
type: integer
service:
type: string
required:
- port
type: object
httpGet:
properties:
path:
type: string
scheme:
type: string
port:
x-kubernetes-int-or-string: true
host:
type: string
httpHeaders:
items:
type: object
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: array
required:
- port
type: object
type: object
nodeSelector:
additionalProperties:
type: string
Expand Down Expand Up @@ -4482,6 +4550,74 @@ spec:
items:
type: string
type: array
startupProbe:
description: Settings for the startup probe associated with a
WebLogic Server instance. If not specified, the operator will
not create a default startup probe.
properties:
terminationGracePeriodSeconds:
type: integer
failureThreshold:
type: integer
periodSeconds:
type: integer
tcpSocket:
properties:
port:
x-kubernetes-int-or-string: true
host:
type: string
required:
- port
type: object
timeoutSeconds:
type: integer
successThreshold:
type: integer
initialDelaySeconds:
type: integer
exec:
properties:
command:
items:
type: string
type: array
type: object
grpc:
properties:
port:
type: integer
service:
type: string
required:
- port
type: object
httpGet:
properties:
path:
type: string
scheme:
type: string
port:
x-kubernetes-int-or-string: true
host:
type: string
httpHeaders:
items:
type: object
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: array
required:
- port
type: object
type: object
nodeSelector:
additionalProperties:
type: string
Expand Down Expand Up @@ -7303,6 +7439,74 @@ spec:
type: array
items:
type: string
startupProbe:
description: Settings for the startup probe associated with
a WebLogic Server instance. If not specified, the operator
will not create a default startup probe.
type: object
properties:
terminationGracePeriodSeconds:
type: integer
failureThreshold:
type: integer
periodSeconds:
type: integer
tcpSocket:
type: object
properties:
port:
x-kubernetes-int-or-string: true
host:
type: string
required:
- port
timeoutSeconds:
type: integer
successThreshold:
type: integer
initialDelaySeconds:
type: integer
exec:
type: object
properties:
command:
type: array
items:
type: string
grpc:
type: object
properties:
port:
type: integer
service:
type: string
required:
- port
httpGet:
type: object
properties:
path:
type: string
scheme:
type: string
port:
x-kubernetes-int-or-string: true
host:
type: string
httpHeaders:
type: array
items:
type: object
properties:
name:
type: string
value:
type: string
required:
- name
- value
required:
- port
nodeSelector:
description: Selector which must match a Node's labels for
the Pod to be scheduled on that Node. See `kubectl explain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,8 @@ protected V1Container createPrimaryContainer() {
V1Container v1Container = super.createPrimaryContainer()
.ports(getContainerPorts())
.lifecycle(createLifecycle())
.livenessProbe(createLivenessProbe(podTuning));
.livenessProbe(createLivenessProbe(podTuning))
.startupProbe(getStartupProbe());

if (!mockWls()) {
v1Container.readinessProbe(createReadinessProbe(podTuning));
Expand Down Expand Up @@ -996,6 +997,10 @@ private V1Probe getLivenessProbe() {
.map(V1ProbeBuilder::new).map(V1ProbeBuilder::build).orElse(new V1Probe());
}

private V1Probe getStartupProbe() {
return getServerSpec().getStartupProbe();
}

private boolean mockWls() {
return Boolean.getBoolean("mockWLS");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public interface EffectiveServerSpec {
@Nonnull
V1Probe getReadinessProbe();

V1Probe getStartupProbe();

@Nonnull
Shutdown getShutdown();

Expand Down
Loading

0 comments on commit f0f13fa

Please sign in to comment.