diff --git a/documentation/domains/Cluster.json b/documentation/domains/Cluster.json index 4bbd509d605..556206bdec3 100644 --- a/documentation/domains/Cluster.json +++ b/documentation/domains/Cluster.json @@ -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": { diff --git a/documentation/domains/Cluster.md b/documentation/domains/Cluster.md index bc8173ac90d..43bb35d7b99 100644 --- a/documentation/domains/Cluster.md +++ b/documentation/domains/Cluster.md @@ -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`. | diff --git a/documentation/domains/Domain.json b/documentation/domains/Domain.json index 6e52837c257..fbb59bbadf8 100644 --- a/documentation/domains/Domain.json +++ b/documentation/domains/Domain.json @@ -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": { diff --git a/documentation/domains/Domain.md b/documentation/domains/Domain.md index 69353f18487..860a75555e6 100644 --- a/documentation/domains/Domain.md +++ b/documentation/domains/Domain.md @@ -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`. | diff --git a/documentation/site/content/managing-domains/domain-lifecycle/startup.md b/documentation/site/content/managing-domains/domain-lifecycle/startup.md index 0c13789e942..16f39c2a10d 100644 --- a/documentation/site/content/managing-domains/domain-lifecycle/startup.md +++ b/documentation/site/content/managing-domains/domain-lifecycle/startup.md @@ -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` diff --git a/kubernetes/crd/cluster-crd.yaml b/kubernetes/crd/cluster-crd.yaml index 96e1c5b11b5..aea21d23ed4 100644 --- a/kubernetes/crd/cluster-crd.yaml +++ b/kubernetes/crd/cluster-crd.yaml @@ -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 @@ -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 diff --git a/kubernetes/crd/domain-crd.yaml b/kubernetes/crd/domain-crd.yaml index 7f9557e629b..239a5314da6 100644 --- a/kubernetes/crd/domain-crd.yaml +++ b/kubernetes/crd/domain-crd.yaml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java index c260fa80754..d69580d29c4 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/PodStepContext.java @@ -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)); @@ -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"); } diff --git a/operator/src/main/java/oracle/kubernetes/operator/processing/EffectiveServerSpec.java b/operator/src/main/java/oracle/kubernetes/operator/processing/EffectiveServerSpec.java index 6acc8c009e8..405fbbe5d2e 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/processing/EffectiveServerSpec.java +++ b/operator/src/main/java/oracle/kubernetes/operator/processing/EffectiveServerSpec.java @@ -93,6 +93,8 @@ public interface EffectiveServerSpec { @Nonnull V1Probe getReadinessProbe(); + V1Probe getStartupProbe(); + @Nonnull Shutdown getShutdown(); diff --git a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/BaseConfiguration.java b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/BaseConfiguration.java index cee13da3b04..0168fe1787a 100644 --- a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/BaseConfiguration.java +++ b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/BaseConfiguration.java @@ -148,7 +148,7 @@ public void setLivenessProbeThresholds(Integer successThreshold, Integer failure } V1Probe getLivenessProbe() { - return serverPod.getLivenessProbeTuning(); + return serverPod.getLivenessProbe(); } void setReadinessProbe(Integer initialDelay, Integer timeout, Integer period) { @@ -164,7 +164,11 @@ void setReadinessProbeHttpGetActionPath(String httpGetActionPath) { } V1Probe getReadinessProbe() { - return serverPod.getReadinessProbeTuning(); + return serverPod.getReadinessProbe(); + } + + V1Probe getStartupProbe() { + return serverPod.getStartupProbe(); } Shutdown getShutdown() { diff --git a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/EffectiveServerSpecCommonImpl.java b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/EffectiveServerSpecCommonImpl.java index 2de1c683491..d6e6b662451 100644 --- a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/EffectiveServerSpecCommonImpl.java +++ b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/EffectiveServerSpecCommonImpl.java @@ -163,6 +163,11 @@ public V1Probe getReadinessProbe() { return server.getReadinessProbe(); } + @Override + public V1Probe getStartupProbe() { + return server.getStartupProbe(); + } + @Nonnull @Override public Shutdown getShutdown() { diff --git a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/ServerPod.java b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/ServerPod.java index 13ea791fe95..80b9bf2d1d7 100644 --- a/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/ServerPod.java +++ b/operator/src/main/java/oracle/kubernetes/weblogic/domain/model/ServerPod.java @@ -108,6 +108,15 @@ class ServerPod extends KubernetesResource { + " defines a different action, such as a different HTTP path to access.") private V1Probe readinessProbe = null; + /** + * Defines the settings for a startup probe. + * + * @since 4.2.4 + */ + @Description("Settings for the startup probe associated with a WebLogic Server instance." + + " If not specified, the operator will not create a default startup probe.") + private V1Probe startupProbe = null; + /** * Defines the key-value pairs for the pod to fit on a node, the node must have each of the * indicated key-value pairs as labels. @@ -411,7 +420,7 @@ void setShutdown(ShutdownType shutdownType, Long timeoutSeconds, Boolean ignoreS .skipWaitingCohEndangeredState(skipWaitingCohEndangeredState); } - V1Probe getReadinessProbeTuning() { + V1Probe getReadinessProbe() { return this.readinessProbe; } @@ -433,7 +442,7 @@ void setReadinessProbeHttpGetActionPath(String httpGetActionPath) { .httpGet(new V1HTTPGetAction().path(httpGetActionPath)); } - V1Probe getLivenessProbeTuning() { + V1Probe getLivenessProbe() { return this.livenessProbe; } @@ -450,6 +459,10 @@ void setLivenessProbeThresholds(Integer successThreshold, Integer failureThresho .failureThreshold(failureThreshold); } + V1Probe getStartupProbe() { + return startupProbe; + } + public Long getMaxReadyWaitTimeSeconds() { return this.maxReadyWaitTimeSeconds; } @@ -486,6 +499,11 @@ void fillInFrom(ServerPod serverPod1) { } else { copyValues(readinessProbe, serverPod1.readinessProbe); } + if (startupProbe == null) { + startupProbe = serverPod1.startupProbe; + } else { + copyValues(startupProbe, serverPod1.startupProbe); + } shutdown.copyValues(serverPod1.shutdown); for (V1Volume volume : serverPod1.getAdditionalVolumes()) { addIfMissing(new V1VolumeBuilder(volume).build()); @@ -855,6 +873,7 @@ public String toString() { .append("envFrom", envFrom) .append("livenessProbe", livenessProbe) .append("readinessProbe", readinessProbe) + .append("startupProbe", startupProbe) .append("additionalVolumes", volumes) .append("additionalVolumeMounts", volumeMounts) .append("nodeSelector", nodeSelector) @@ -898,6 +917,7 @@ public boolean equals(Object o) { .append(envFrom, that.envFrom) .append(livenessProbe, that.livenessProbe) .append(readinessProbe, that.readinessProbe) + .append(startupProbe, that.startupProbe) .append( DomainResource.sortList(volumes, VOLUME_COMPARATOR), DomainResource.sortList(that.volumes, VOLUME_COMPARATOR)) @@ -933,6 +953,7 @@ public int hashCode() { .append(envFrom) .append(livenessProbe) .append(readinessProbe) + .append(startupProbe) .append(DomainResource.sortList(volumes, VOLUME_COMPARATOR)) .append(DomainResource.sortList(volumeMounts, VOLUME_MOUNT_COMPARATOR)) .append(nodeSelector)