Skip to content

Commit 0d95c20

Browse files
authored
Merge pull request #1142 from oracle/introspect-status
Improve domain status to include all servers in the domain and to give status of clusters
2 parents c0e5400 + ad84e08 commit 0d95c20

File tree

25 files changed

+670
-367
lines changed

25 files changed

+670
-367
lines changed

docs/domains/Domain.json

Lines changed: 75 additions & 44 deletions
Large diffs are not rendered by default.

docs/domains/Domain.md

Lines changed: 53 additions & 43 deletions
Large diffs are not rendered by default.

docs/domains/index.html

Lines changed: 75 additions & 44 deletions
Large diffs are not rendered by default.

integration-tests/src/test/java/oracle/kubernetes/operator/ItPodTemplates.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
import java.util.Map;
1414
import java.util.logging.Level;
1515

16-
import org.junit.AfterClass;
17-
import org.junit.BeforeClass;
18-
import org.junit.FixMethodOrder;
19-
import org.junit.Test;
20-
import org.junit.Assume;
21-
import org.junit.runners.MethodSorters;
2216
import oracle.kubernetes.operator.utils.Domain;
2317
import oracle.kubernetes.operator.utils.DomainCrd;
2418
import oracle.kubernetes.operator.utils.ExecResult;
2519
import oracle.kubernetes.operator.utils.Operator;
2620
import oracle.kubernetes.operator.utils.TestUtils;
21+
import org.junit.AfterClass;
22+
import org.junit.Assume;
23+
import org.junit.BeforeClass;
24+
import org.junit.FixMethodOrder;
25+
import org.junit.Test;
26+
import org.junit.runners.MethodSorters;
2727

2828
/**
2929
* Simple JUnit test file used for testing domain pod templates.

model/src/main/java/oracle/kubernetes/weblogic/domain/model/AdminServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
import org.apache.commons.lang3.builder.HashCodeBuilder;
1414
import org.apache.commons.lang3.builder.ToStringBuilder;
1515

16-
@Description("AdminServer represents the operator configuration for the admin server.")
16+
@Description("AdminServer represents the operator configuration for the Administration Server.")
1717
public class AdminServer extends Server {
1818

1919
@Description(
20-
"Configures which of the admin server's WebLogic admin channels should be exposed outside"
20+
"Configures which of the Administration Server's WebLogic admin channels should be exposed outside"
2121
+ " the Kubernetes cluster via a node port service.")
2222
private AdminService adminService;
2323

model/src/main/java/oracle/kubernetes/weblogic/domain/model/AdminService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
public class AdminService implements ServiceConfigurator {
2121
@SerializedName("channels")
2222
@Description(
23-
"Specifies which of the admin server's WebLogic channels should be exposed outside "
23+
"Specifies which of the Administration Server's WebLogic channels should be exposed outside "
2424
+ "the Kubernetes cluster via a node port service, along with the node port for "
25-
+ "each channel. If not specified, the admin server's node port service will "
25+
+ "each channel. If not specified, the Administration Server's node port service will "
2626
+ "not be created.")
2727
private List<Channel> channels = new ArrayList<>();
2828

29-
@Description("Labels to associate with the external channel service")
29+
@Description("Labels to associate with the external channel service.")
3030
private Map<String, String> labels = new HashMap<>();
3131

32-
@Description("Annotations to associate with the external channel service")
32+
@Description("Annotations to associate with the external channel service.")
3333
private Map<String, String> annotations = new HashMap<>();
3434

3535
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
*/
3434
public abstract class BaseConfiguration {
3535

36-
@Description("Configuration affecting server pods")
36+
@Description("Configuration affecting server pods.")
3737
private ServerPod serverPod = new ServerPod();
3838

3939
@Description(
40-
"Customization affecting ClusterIP Kubernetes services for WebLogic server instances.")
40+
"Customization affecting ClusterIP Kubernetes services for WebLogic Server instances.")
4141
@SerializedName("serverService")
4242
@Expose
4343
private ServerService serverService = new ServerService();

model/src/main/java/oracle/kubernetes/weblogic/domain/model/Channel.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
import org.apache.commons.lang3.builder.HashCodeBuilder;
1313
import org.apache.commons.lang3.builder.ToStringBuilder;
1414

15-
@Description("Describes a single channel used by the admin server.")
15+
@Description("Describes a single channel used by the Administration Server.")
1616
public class Channel implements Comparable<Channel> {
1717
@SerializedName("channelName")
1818
@Description(
19-
"Name of channel.\n'default' refers to the admin server's default channel (configured "
19+
"Name of channel.\n'default' refers to the Administration Server's default channel (configured "
2020
+ "via the ServerMBean's ListenPort) "
21-
+ "\n'default-secure' refers to the admin server's default secure channel "
21+
+ "\n'default-secure' refers to the Administration Server's default secure channel "
2222
+ "(configured via the ServerMBean's SSLMBean's ListenPort) "
23-
+ "\n'default-admin' refers to the admin server's default administrative channel "
23+
+ "\n'default-admin' refers to the Administration Server's default administrative channel "
2424
+ "(configured via the DomainMBean's AdministrationPort) "
25-
+ "\nOtherwise, the name is the name of one of the admin server's network access points "
25+
+ "\nOtherwise, the name is the name of one of the Administration Server's network access points "
2626
+ "(configured via the ServerMBean's NetworkAccessMBeans).")
2727
@Nonnull
2828
private String channelName;

model/src/main/java/oracle/kubernetes/weblogic/domain/model/Cluster.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class Cluster extends BaseConfiguration implements Comparable<Cluster> {
3131
private String clusterName;
3232

3333
/** The number of replicas to run in the cluster, if specified. */
34-
@Description("The number of managed servers to run in this cluster.")
34+
@Description("The number of cluster members to run.")
3535
@Range(minimum = 0)
3636
private Integer replicas;
3737

@@ -53,7 +53,7 @@ public class Cluster extends BaseConfiguration implements Comparable<Cluster> {
5353
@Range(minimum = 1)
5454
private Integer maxUnavailable;
5555

56-
@Description("Customization affecting ClusterIP Kubernetes services for WebLogic cluster.")
56+
@Description("Customization affecting ClusterIP Kubernetes services for the WebLogic cluster.")
5757
@SerializedName("clusterService")
5858
@Expose
5959
private KubernetesResource clusterService = new KubernetesResource();
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
// Copyright 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
// Licensed under the Universal Permissive License v 1.0 as shown at
3+
// http://oss.oracle.com/licenses/upl.
4+
5+
package oracle.kubernetes.weblogic.domain.model;
6+
7+
import com.google.gson.annotations.Expose;
8+
import com.google.gson.annotations.SerializedName;
9+
import oracle.kubernetes.json.Description;
10+
import oracle.kubernetes.json.Range;
11+
import org.apache.commons.lang3.builder.EqualsBuilder;
12+
import org.apache.commons.lang3.builder.HashCodeBuilder;
13+
import org.apache.commons.lang3.builder.ToStringBuilder;
14+
15+
/** ServerStatus describes the current status of a specific WebLogic Server. */
16+
public class ClusterStatus implements Comparable<ClusterStatus> {
17+
18+
@Description("WebLogic cluster name. Required.")
19+
@SerializedName("clusterName")
20+
@Expose
21+
private String clusterName;
22+
23+
/** The number of intended cluster members. Required. */
24+
@Description("The number of intended cluster members. Required.")
25+
@Range(minimum = 0)
26+
private Integer replicas;
27+
28+
/** The number of ready cluster members. Required. */
29+
@Description("The number of ready cluster members. Required.")
30+
@Range(minimum = 0)
31+
private Integer readyReplicas;
32+
33+
/** The maximum number of cluster members. Required. */
34+
@Description("The maximum number of cluster members. Required.")
35+
@Range(minimum = 0)
36+
private Integer maximumReplicas;
37+
38+
/**
39+
* WebLogic cluster name. Required.
40+
*
41+
* @return cluster name
42+
*/
43+
public String getClusterName() {
44+
return clusterName;
45+
}
46+
47+
/**
48+
* WebLogic cluster name. Required.
49+
*
50+
* @param clusterName cluster name
51+
*/
52+
public void setClusterName(String clusterName) {
53+
this.clusterName = clusterName;
54+
}
55+
56+
/**
57+
* WebLogic cluster name. Required.
58+
*
59+
* @param clusterName cluster name
60+
* @return this
61+
*/
62+
public ClusterStatus withClusterName(String clusterName) {
63+
this.clusterName = clusterName;
64+
return this;
65+
}
66+
67+
public Integer getReplicas() {
68+
return replicas;
69+
}
70+
71+
public void setReplicas(Integer replicas) {
72+
this.replicas = replicas;
73+
}
74+
75+
public ClusterStatus withReplicas(Integer replicas) {
76+
this.replicas = replicas;
77+
return this;
78+
}
79+
80+
public Integer getReadyReplicas() {
81+
return readyReplicas;
82+
}
83+
84+
public void setReadyReplicas(Integer readyReplicas) {
85+
this.readyReplicas = readyReplicas;
86+
}
87+
88+
public ClusterStatus withReadyReplicas(Integer readyReplicas) {
89+
this.readyReplicas = readyReplicas;
90+
return this;
91+
}
92+
93+
public Integer getMaximumReplicas() {
94+
return maximumReplicas;
95+
}
96+
97+
public void setMaximumReplicas(Integer maximumReplicas) {
98+
this.maximumReplicas = maximumReplicas;
99+
}
100+
101+
public ClusterStatus withMaximumReplicas(Integer maximumReplicas) {
102+
this.maximumReplicas = maximumReplicas;
103+
return this;
104+
}
105+
106+
@Override
107+
public String toString() {
108+
return new ToStringBuilder(this)
109+
.append("clusterName", clusterName)
110+
.append("replicas", replicas)
111+
.append("readyReplicas", readyReplicas)
112+
.append("maximumReplicas", maximumReplicas)
113+
.toString();
114+
}
115+
116+
@Override
117+
public int hashCode() {
118+
return new HashCodeBuilder()
119+
.append(clusterName)
120+
.append(replicas)
121+
.append(readyReplicas)
122+
.append(maximumReplicas)
123+
.toHashCode();
124+
}
125+
126+
@Override
127+
public boolean equals(Object other) {
128+
if (other == this) {
129+
return true;
130+
}
131+
if (!(other instanceof ClusterStatus)) {
132+
return false;
133+
}
134+
ClusterStatus rhs = ((ClusterStatus) other);
135+
return new EqualsBuilder()
136+
.append(clusterName, rhs.clusterName)
137+
.append(replicas, rhs.replicas)
138+
.append(readyReplicas, rhs.readyReplicas)
139+
.append(maximumReplicas, rhs.maximumReplicas)
140+
.isEquals();
141+
}
142+
143+
@Override
144+
public int compareTo(ClusterStatus o) {
145+
return clusterName.compareTo(o.clusterName);
146+
}
147+
}

0 commit comments

Comments
 (0)