Skip to content

Commit a6c5cc1

Browse files
authored
Add domain.spec.maxClusterUnavailable (#3649)
* Add domain.spec.maxClusterUnavailable
1 parent ca2d19c commit a6c5cc1

File tree

12 files changed

+113
-10
lines changed

12 files changed

+113
-10
lines changed

documentation/domains/Cluster.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
"$ref": "#/definitions/ServerService"
158158
},
159159
"maxUnavailable": {
160-
"description": "The maximum number of cluster members that can be temporarily unavailable. Defaults to 1.",
160+
"description": "The maximum number of cluster members that can be temporarily unavailable. Defaults to `domain.spec.maxClusterUnavailable`, which defaults to 1.",
161161
"type": "integer",
162162
"minimum": 1
163163
},
@@ -387,6 +387,12 @@
387387
"description": "The directory containing the WebLogic domain configuration inside the container. Defaults to /shared/domains/\u003cdomainUID\u003e if `domainHomeSourceType` is PersistentVolume. Defaults to /u01/oracle/user_projects/domains/ if `domainHomeSourceType` is Image. Defaults to /u01/domains/\u003cdomainUID\u003e if `domainHomeSourceType` is FromModel.",
388388
"type": "string"
389389
},
390+
"maxClusterUnavailable": {
391+
"default": 1,
392+
"description": "The maximum number of cluster members that can be temporarily unavailable. You can override this default on a per cluster basis by setting the cluster\u0027s `maxUnavailable` field. Defaults to 1.",
393+
"type": "integer",
394+
"minimum": 1
395+
},
390396
"logHomeLayout": {
391397
"default": "ByServers",
392398
"description": "Control how log files under `logHome` are organized when logHome is set and `logHomeEnabled` is true. `Flat` specifies that all files are kept directly in the `logHome` root directory. `ByServers` specifies that domain log files and `introspector.out` are at the `logHome` root level, all other files are organized under the respective server name logs directory `logHome/servers/\u003cserver name\u003e/logs`. Defaults to `ByServers`.",

documentation/domains/Cluster.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The specification of the operation of the WebLogic cluster. Required.
2020
| `clusterService` | [Cluster Service](#cluster-service) | Customization affecting Kubernetes Service generated for this WebLogic cluster. |
2121
| `maxConcurrentShutdown` | integer | The maximum number of WebLogic Server instances that will shut down in parallel for this cluster when it is being partially shut down by lowering its replica count. A value of 0 means there is no limit. Defaults to `spec.maxClusterConcurrentShutdown`, which defaults to 1. |
2222
| `maxConcurrentStartup` | integer | The maximum number of Managed Servers instances that the operator will start in parallel for this cluster in response to a change in the `replicas` count. If more Managed Server instances must be started, the operator will wait until a Managed Server Pod is in the `Ready` state before starting the next Managed Server instance. A value of 0 means all Managed Server instances will start in parallel. Defaults to `domain.spec.maxClusterConcurrentStartup`, which defaults to 0. |
23-
| `maxUnavailable` | integer | The maximum number of cluster members that can be temporarily unavailable. Defaults to 1. |
23+
| `maxUnavailable` | integer | The maximum number of cluster members that can be temporarily unavailable. Defaults to `domain.spec.maxClusterUnavailable`, which defaults to 1. |
2424
| `replicas` | integer | The number of cluster member Managed Server instances to start for this WebLogic cluster. The operator will sort cluster member Managed Server names from the WebLogic domain configuration by normalizing any numbers in the Managed Server name and then sorting alphabetically. This is done so that server names such as "managed-server10" come after "managed-server9". The operator will then start Managed Server instances from the sorted list, up to the `replicas` count, unless specific Managed Servers are specified as starting in their entry under the `managedServers` field. In that case, the specified Managed Server instances will be started and then additional cluster members will be started, up to the `replicas` count, by finding further cluster members in the sorted list that are not already started. If cluster members are started because of their related entries under `managedServers`, then this cluster may have more cluster members running than its `replicas` count. Defaults to `domain.spec.replicas`, which defaults 1. |
2525
| `restartVersion` | string | Changes to this field cause the operator to restart WebLogic Server instances. More info: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#restarting-servers. |
2626
| `serverPod` | [Server Pod](#server-pod) | Customization affecting the generation of Pods for WebLogic Server instances. |

documentation/domains/Domain.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@
306306
"description": "The directory containing the WebLogic domain configuration inside the container. Defaults to /shared/domains/\u003cdomainUID\u003e if `domainHomeSourceType` is PersistentVolume. Defaults to /u01/oracle/user_projects/domains/ if `domainHomeSourceType` is Image. Defaults to /u01/domains/\u003cdomainUID\u003e if `domainHomeSourceType` is FromModel.",
307307
"type": "string"
308308
},
309+
"maxClusterUnavailable": {
310+
"default": 1,
311+
"description": "The maximum number of cluster members that can be temporarily unavailable. You can override this default on a per cluster basis by setting the cluster\u0027s `maxUnavailable` field. Defaults to 1.",
312+
"type": "integer",
313+
"minimum": 1
314+
},
309315
"logHomeLayout": {
310316
"default": "ByServers",
311317
"description": "Control how log files under `logHome` are organized when logHome is set and `logHomeEnabled` is true. `Flat` specifies that all files are kept directly in the `logHome` root directory. `ByServers` specifies that domain log files and `introspector.out` are at the `logHome` root level, all other files are organized under the respective server name logs directory `logHome/servers/\u003cserver name\u003e/logs`. Defaults to `ByServers`.",

documentation/domains/Domain.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The specification of the operation of the WebLogic domain. Required.
3939
| `managedServers` | Array of [Managed Server](#managed-server) | Lifecycle options for individual Managed Servers, including Java options, environment variables, additional Pod content, and the ability to explicitly start, stop, or restart a named server instance. The `serverName` field of each entry must match a Managed Server that already exists in the WebLogic domain configuration or that matches a dynamic cluster member based on the server template. |
4040
| `maxClusterConcurrentShutdown` | integer | The default maximum number of WebLogic Server instances that a cluster will shut down in parallel when it is being partially shut down by lowering its replica count. You can override this default on a per cluster basis by setting the cluster's `maxConcurrentShutdown` field. A value of 0 means there is no limit. Defaults to 1. |
4141
| `maxClusterConcurrentStartup` | integer | The maximum number of cluster member Managed Server instances that the operator will start in parallel for a given cluster, if `maxConcurrentStartup` is not specified for a specific cluster under the `clusters` field. A value of 0 means there is no configured limit. Defaults to 0. |
42+
| `maxClusterUnavailable` | integer | The maximum number of cluster members that can be temporarily unavailable. You can override this default on a per cluster basis by setting the cluster's `maxUnavailable` field. Defaults to 1. |
4243
| `monitoringExporter` | [Monitoring Exporter Specification](#monitoring-exporter-specification) | Automatic deployment and configuration of the WebLogic Monitoring Exporter. If specified, the operator will deploy a sidecar container alongside each WebLogic Server instance that runs the exporter. WebLogic Server instances that are already running when the `monitoringExporter` field is created or deleted, will not be affected until they are restarted. When any given server is restarted for another reason, such as a change to the `restartVersion`, then the newly created pod will have the exporter sidecar or not, as appropriate. See https://github.com/oracle/weblogic-monitoring-exporter. |
4344
| `replicas` | integer | The default number of cluster member Managed Server instances to start for each WebLogic cluster in the domain configuration, unless `replicas` is specified for that cluster under the `clusters` field. For each cluster, the operator will sort cluster member Managed Server names from the WebLogic domain configuration by normalizing any numbers in the Managed Server name and then sorting alphabetically. This is done so that server names such as "managed-server10" come after "managed-server9". The operator will then start Managed Servers from the sorted list, up to the `replicas` count, unless specific Managed Servers are specified as starting in their entry under the `managedServers` field. In that case, the specified Managed Servers will be started and then additional cluster members will be started, up to the `replicas` count, by finding further cluster members in the sorted list that are not already started. If cluster members are started because of their entries under `managedServers`, then a cluster may have more cluster members running than its `replicas` count. Defaults to 1. |
4445
| `restartVersion` | string | Changes to this field cause the operator to restart WebLogic Server instances. More info: https://oracle.github.io/weblogic-kubernetes-operator/userguide/managing-domains/domain-lifecycle/startup/#restarting-servers. |

documentation/domains/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,12 @@
12221222
"description": "The directory containing the WebLogic domain configuration inside the container. Defaults to /shared/domains/\u003cdomainUID\u003e if `domainHomeSourceType` is PersistentVolume. Defaults to /u01/oracle/user_projects/domains/ if `domainHomeSourceType` is Image. Defaults to /u01/domains/\u003cdomainUID\u003e if `domainHomeSourceType` is FromModel.",
12231223
"type": "string"
12241224
},
1225+
"maxClusterUnavailable": {
1226+
"default": 1.0,
1227+
"description": "The maximum number of cluster members that can be temporarily unavailable. You can override this default on a per cluster basis by setting the cluster\u0027s `maxUnavailable` field. Defaults to 1.",
1228+
"type": "integer",
1229+
"minimum": 1.0
1230+
},
12251231
"logHomeLayout": {
12261232
"default": "ByServers",
12271233
"description": "Control how log files under `logHome` are organized when logHome is set and `logHomeEnabled` is true. `Flat` specifies that all files are kept directly in the `logHome` root directory. `ByServers` specifies that domain log files and `introspector.out` are at the `logHome` root level, all other files are organized under the respective server name logs directory `logHome/servers/\u003cserver name\u003e/logs`. Defaults to `ByServers`.",

kubernetes/crd/cluster-crd.yaml

Lines changed: 3 additions & 2 deletions
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: 53299f8b85e950b6c69b5fabd130221c735761f914d2b7fa46882cdee8da6715
8+
weblogic.sha256: 6b6e7832ef6cdeef81d2c704a38636f9d1eb3b9c5fa76be64391d1939943003b
99
name: clusters.weblogic.oracle
1010
spec:
1111
group: weblogic.oracle
@@ -57,7 +57,8 @@ spec:
5757
type: object
5858
maxUnavailable:
5959
description: The maximum number of cluster members that can be temporarily
60-
unavailable. Defaults to 1.
60+
unavailable. Defaults to `domain.spec.maxClusterUnavailable`, which
61+
defaults to 1.
6162
minimum: 1
6263
type: integer
6364
replicas:

kubernetes/crd/domain-crd.yaml

Lines changed: 8 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: 57dd4476255aa691791bccf16629c0cc5a5aceb1da44c5fefac307ac3428734b
8+
weblogic.sha256: 3a81ece5d88c85957a5d5e4a1b6c068cdca4355afd80a5a6598cbfade313871f
99
name: domains.weblogic.oracle
1010
spec:
1111
group: weblogic.oracle
@@ -502,6 +502,13 @@ spec:
502502
if `domainHomeSourceType` is Image. Defaults to /u01/domains/<domainUID>
503503
if `domainHomeSourceType` is FromModel.
504504
type: string
505+
maxClusterUnavailable:
506+
default: 1
507+
description: The maximum number of cluster members that can be temporarily
508+
unavailable. You can override this default on a per cluster basis
509+
by setting the cluster's `maxUnavailable` field. Defaults to 1.
510+
minimum: 1
511+
type: integer
505512
logHomeLayout:
506513
default: ByServers
507514
description: Control how log files under `logHome` are organized when

operator/src/main/java/oracle/kubernetes/operator/KubernetesConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public interface KubernetesConstants {
3737
boolean DEFAULT_INCLUDE_SERVER_OUT_IN_POD_LOG = true;
3838
int DEFAULT_MAX_CLUSTER_CONCURRENT_START_UP = 0;
3939
int DEFAULT_MAX_CLUSTER_CONCURRENT_SHUTDOWN = 1;
40+
int DEFAULT_MAX_CLUSTER_UNAVAILABLE = 1;
4041
int MINIMUM_CLUSTER_COUNT = 0;
4142

4243
String WLS_CONTAINER_NAME = "weblogic-server";

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public class ClusterSpec extends BaseConfiguration implements Comparable<Cluster
6161
+ "domain-lifecycle/startup/#starting-and-stopping-servers.")
6262
private ServerStartPolicy serverStartPolicy;
6363

64-
@Description(
65-
"The maximum number of cluster members that can be temporarily unavailable. Defaults to 1.")
64+
@Description("The maximum number of cluster members that can be temporarily unavailable. "
65+
+ "Defaults to `domain.spec.maxClusterUnavailable`, which defaults to 1.")
6666
@Range(minimum = 1)
6767
private Integer maxUnavailable;
6868

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import static oracle.kubernetes.operator.KubernetesConstants.DEFAULT_IMAGE;
4141
import static oracle.kubernetes.operator.KubernetesConstants.DEFAULT_MAX_CLUSTER_CONCURRENT_SHUTDOWN;
4242
import static oracle.kubernetes.operator.KubernetesConstants.DEFAULT_MAX_CLUSTER_CONCURRENT_START_UP;
43+
import static oracle.kubernetes.operator.KubernetesConstants.DEFAULT_MAX_CLUSTER_UNAVAILABLE;
4344
import static oracle.kubernetes.weblogic.domain.model.Model.DEFAULT_WDT_INSTALL_HOME;
4445
import static oracle.kubernetes.weblogic.domain.model.Model.DEFAULT_WDT_MODEL_HOME;
4546

@@ -258,6 +259,14 @@ public class DomainSpec extends BaseConfiguration {
258259
@Default(intDefault = 1)
259260
private Integer maxClusterConcurrentShutdown;
260261

262+
@Description(
263+
"The maximum number of cluster members that can be temporarily unavailable. You can override this default "
264+
+ "on a per cluster basis by setting the cluster's `maxUnavailable` field. Defaults to 1."
265+
)
266+
@Range(minimum = 1)
267+
@Default(intDefault = 1)
268+
private Integer maxClusterUnavailable;
269+
261270
@Description("The wait time in seconds before the start of the next retry after a Severe failure. Defaults to 120.")
262271
@Range(minimum = 0)
263272
@Default(intDefault = 120)
@@ -799,6 +808,11 @@ public Integer getMaxClusterConcurrentShutdown() {
799808
.orElse(DEFAULT_MAX_CLUSTER_CONCURRENT_SHUTDOWN);
800809
}
801810

811+
public Integer getMaxClusterUnavailable() {
812+
return Optional.ofNullable(maxClusterUnavailable)
813+
.orElse(DEFAULT_MAX_CLUSTER_UNAVAILABLE);
814+
}
815+
802816
@Nullable
803817
String getConfigOverrides() {
804818
return Optional.ofNullable(configuration).map(Configuration::getOverridesConfigMap).orElse(null);
@@ -970,8 +984,9 @@ public String toString() {
970984
.append("logHomeLayout", logHomeLayout)
971985
.append("logHomeEnabled", logHomeEnabled)
972986
.append("managedServers", managedServers)
973-
.append("maxClusterConcurrentShutdown",maxClusterConcurrentShutdown)
974-
.append("maxClusterConcurrentStartup",maxClusterConcurrentStartup)
987+
.append("maxClusterConcurrentShutdown", maxClusterConcurrentShutdown)
988+
.append("maxClusterConcurrentStartup", maxClusterConcurrentStartup)
989+
.append("maxClusterUnavailable", maxClusterUnavailable)
975990
.append("monitoringExporter", monitoringExporter)
976991
.append("replicas", replicas)
977992
.append("serverStartPolicy", serverStartPolicy)
@@ -1003,6 +1018,7 @@ public int hashCode() {
10031018
.append(managedServers)
10041019
.append(maxClusterConcurrentShutdown)
10051020
.append(maxClusterConcurrentStartup)
1021+
.append(maxClusterUnavailable)
10061022
.append(monitoringExporter)
10071023
.append(replicas)
10081024
.append(serverStartPolicy)
@@ -1046,6 +1062,7 @@ public boolean equals(Object other) {
10461062
.append(includeServerOutInPodLog, rhs.includeServerOutInPodLog)
10471063
.append(getMaxClusterConcurrentStartup(), rhs.getMaxClusterConcurrentStartup())
10481064
.append(getMaxClusterConcurrentShutdown(), rhs.getMaxClusterConcurrentShutdown())
1065+
.append(getMaxClusterUnavailable(), rhs.getMaxClusterUnavailable())
10491066
.append(fluentdSpecification, rhs.getFluentdSpecification());
10501067
return builder.isEquals();
10511068
}
@@ -1074,6 +1091,10 @@ public void setMaxClusterConcurrentShutdown(Integer maxClusterConcurrentShutdown
10741091
this.maxClusterConcurrentShutdown = maxClusterConcurrentShutdown;
10751092
}
10761093

1094+
public void setMaxClusterUnavailable(Integer maxClusterUnavailable) {
1095+
this.maxClusterUnavailable = maxClusterUnavailable;
1096+
}
1097+
10771098
public AdminServer getAdminServer() {
10781099
return adminServer;
10791100
}
@@ -1142,7 +1163,7 @@ private int getMaxConcurrentStartupFor(ClusterSpec clusterSpec) {
11421163
}
11431164

11441165
private int getMaxUnavailableFor(ClusterSpec clusterSpec) {
1145-
return hasMaxUnavailable(clusterSpec) ? clusterSpec.getMaxUnavailable() : 1;
1166+
return hasMaxUnavailable(clusterSpec) ? clusterSpec.getMaxUnavailable() : getMaxClusterUnavailable();
11461167
}
11471168

11481169
private int getReplicaCountFor(ClusterSpec clusterSpec) {

0 commit comments

Comments
 (0)