Skip to content

Commit 97b54fe

Browse files
committed
Merge remote-tracking branch 'origin/develop' into introspect-status
2 parents 74ed3d8 + c0e5400 commit 97b54fe

File tree

17 files changed

+601
-113
lines changed

17 files changed

+601
-113
lines changed

docs-source/content/userguide/managing-domains/domain-resource.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ pre = "<b> </b>"
88

99

1010

11-
Use this document to set up and configure your own [domain resource](https://github.com/oracle/weblogic-kubernetes-operator/blob/master/docs/domains/Domain.md) which can be used to configure your WLS domain. Then, you can use the domain resource to start the Kubernetes artifacts of the corresponding domain.
11+
Use this document to set up and configure your own [domain resource](https://github.com/oracle/weblogic-kubernetes-operator/blob/master/docs/domains/Domain.md) which can be used to configure the operation of your WebLogic domain. The domain resource does not replace the traditional configuration of WebLogic domains found in the domain configuration files, but instead cooperates with those files to describe the Kubernetes artifacts of the corresponding domain. For instance, the WebLogic domain configuration will still specify deployed applications, data sources, and most other details about the domain while the domain resource will specify the number of cluster members currently running or the persistent volumes that will be mounted into the containers running WebLogic Server instances.
12+
13+
Many of the samples accompanying the operator project include scripts to generate an initial domain resource from a set of simplified inputs; however, the domain resource is the actual source of truth for how the WebLogic operator will manage each WebLogic domain. You are encouraged to either start with the domain resource YAML files generated by the various samples or create domain resources manually or by using other tools based on the schema referenced here or this documentation.
1214

1315
Swagger documentation is available [here](https://oracle.github.io/weblogic-kubernetes-operator/swagger/index.html).
1416

@@ -41,3 +43,66 @@ To confirm that the domain resource was created, use this command:
4143
```
4244
$ kubectl describe domain [domain name] -n [namespace]
4345
```
46+
47+
#### Domain resource overview
48+
49+
The domain resource, like all [Kubernetes objects](https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/), is described by three sections: `metadata`, `spec`, and `status`.
50+
51+
The `metadata` section names the domain resource and its namespace. The name of the domain resource is the default value for the "domain UID" which is used by the operator to distinguish domains running in the Kubernetes cluster that may have the same domain name. The domain resource name is required to be unique in the namespace and the domain UID should be unique across the cluster. The domain UID, domain resource name, and domain name (from the WebLogic domain configuration) may all be different.
52+
53+
The `spec` section describes the intended running state of the domain, including intended runtime state of server instances, number of cluster members started, and details about Kubernetes pod or service generation, such as resource constraints, scheduling requirements, or volume mounts.
54+
55+
The `status` section is updated by the operator and describes the actual running state of the domain, including WebLogic Server instance runtime states and current health.
56+
57+
#### Domain resource spec elements
58+
59+
The domain resource `spec` section contains elements for configuring the domain operation and sub-sections specific to the Administration Server, specific clusters or specific Managed Servers.
60+
61+
Elements related to domain identification, Docker image, and domain home:
62+
* `domainUID`: The domain unique identifier. Must be unique across the Kubernetes cluster. Not required. Defaults to the value of `metadata.name`.
63+
* `image`: The WebLogic Docker image. Required when `domainHomeInImage` is true; otherwise, defaults to "container-registry.oracle.com/middleware/weblogic:12.2.1.3".
64+
* `imagePullPolicy`: The image pull policy for the WebLogic Docker image. Legal values are `Always`, `Never` and `IfNotPresent`. Defaults to `Always` if image ends in ":latest", `IfNotPresent` otherwise.
65+
* `imagePullSecrets`: A list of image pull secrets for the WebLogic Docker image.
66+
* `domainHome`: The folder for the WebLogic Domain. Not required. Defaults to "/shared/domains/domains/domainUID" if `domainHomeInImage` is false. Defaults to "/u01/oracle/user_projects/domains/" if `domainHomeInImage` is true.
67+
* `domainHomeInImage`: True if this domain's home is defined in the Docker image for the domain. Defaults to true.
68+
69+
Elements related to logging:
70+
* `includeServerOutInPodLog`: If true (the default), the server ".out" file will be included in the pod's stdout.
71+
* `logHome`: The in-pod name of the directory in which to store the domain, Node Manager, server logs, and server ".out" files.
72+
* `logHomeEnabled`: Specifies whether the log home folder is enabled. Not required. Defaults to true if `domainHomeInImage` is false. Defaults to false if `domainHomeInImage` is true.
73+
74+
Elements related to security:
75+
* `webLogicCredentialsSecret`: The name of a pre-created Kubernetes secret, in the domain resource's namespace, that holds the user name and password needed to boot WebLogic Server under the 'username' and 'password' fields.
76+
77+
Elements related to domain [startup and shutdown](domain-lifecycle/startup.md):
78+
* `serverStartPolicy`: The strategy for deciding whether to start a server. Legal values are `ADMIN_ONLY`, `NEVER`, or `IF_NEEDED`.
79+
* `serverStartState`: The state in which the server is to be started. Use `ADMIN` if server should start in the admin state. Defaults to `RUNNING`.
80+
* `restartVersion`: If present, every time this value is updated, the operator will restart the required servers.
81+
* `replicas`: The number of Managed Servers to run in any cluster that does not specify a `replicas` count.
82+
83+
Elements related to overriding WebLogic domain configuration:
84+
* `configOverrides`: The name of the config map for optional WebLogic configuration overrides.
85+
* `configOverrideSecrets`: A list of names of the secrets for optional WebLogic configuration overrides.
86+
87+
Elements related to Kubernetes pod and service generation:
88+
* `serverPod`: Configuration affecting server pods.
89+
* `serverService`: Customization affecting ClusterIP Kubernetes services for WebLogic Server instances.
90+
91+
Sub-sections related to the Administration Server, specific clusters or specific Managed Servers:
92+
* `adminServer`: Configuration for the Administration Server.
93+
* `clusters`: Configuration for specific clusters.
94+
* `managedServers`: Configuration for specific Managed Servers.
95+
96+
The elements `serverStartPolicy`, `serverStartState`, `serverPod` and `serverService` are repeated under `adminServer` and under each entry of `clusters` or `managedServers`. The values directly under `spec` set the defaults for the entire domain. The values under a specific entry under `clusters` set the defaults for cluster members of that cluster. The values under `adminServer` or an entry under `managedServers` set the values for that specific server. Values from the domain scope and values from the cluster (for cluster members) are merged with or overridden by the setting for the specific server depending on the element. See the [startup and shutdown](domain-lifecycle/startup.md) documentation for details about `serverStartPolicy` combination.
97+
98+
### Pod generation
99+
100+
The operator creates a pod for each running WebLogic Server instance. This pod will have a container based on the Docker image specified by the `image` field. Additional pod or container content can be specified using the elements under `serverPod`. This includes Kubernetes labels and annotations, additional volumes on the pod or volume mounts on the container, [resource requirements](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) or [security context](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/).
101+
102+
Prior to creating a pod, the operator replaces variable references allowing the pod content to be templates. The format of these variable references is `$(VARIABLE_NAME)` where *VARIABLE_NAME* is one of the variable names available in the container for the WebLogic Server instance. The default set of environment variables includes:
103+
* DOMAIN_NAME: The WebLogic domain name
104+
* DOMAIN_UID: The domain unique identifier
105+
* DOMAIN_HOME: The domain home location as a file system path within the container
106+
* SERVER_NAME: The WebLogic Server name
107+
* CLUSTER_NAME: The WebLogic cluster name, if this is a cluster member
108+
* LOG_HOME: The WebLogic log location as a file system path within the container

integration-tests/USECASES.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,7 @@ Configuration Overrides Usecases
144144
| Upgrade 2.1 operator to develop | Upgrade the 2.1 operator running a Weblogic domain to develop version of the Operator and verify apiVersion of the domain CRD shows latest version |
145145
| Upgrade 2.2.0 operator to develop | Upgrade the 2.2.0 operator running a Weblogic domain to develop version of the Operator and verify apiVersion of the domain CRD shows latest version |
146146
| Upgrade 2.2.1 operator to develop | Upgrade the 2.2.1 operator running a Weblogic domain to develop version of the Operator and verify apiVersion of the domain CRD shows latest version |
147+
148+
| Pod Templates | Use Case |
149+
| --- | --- |
150+
| Using pod templates/variables | Use DOMAIN_UID, DOMAIN_NAME, DOMAIN_HOME, SERVER_NAME, LOG_HOME variables at domain level and CLUSTER_NAME at cluster level. Bring up the domain and make sure domain started successfully when pod templates are used |

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ public void testWeblogicLogSearch() throws Exception {
227227
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
228228
logTestBegin(testMethodName);
229229

230-
Map<String, Object> domainMap = domain.getDomainMap();
231-
String domainUid = domain.getDomainUid();
230+
final Map<String, Object> domainMap = domain.getDomainMap();
231+
final String domainUid = domain.getDomainUid();
232232
final String adminServerName = (String) domainMap.get("adminServerName");
233233
final String adminServerPodName = domainUid + "-" + adminServerName;
234234
final String managedServerNameBase = domainMap.get("managedServerNameBase").toString();

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

Lines changed: 21 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ private static void gitCloneMonitoringExporter() throws Exception {
169169
}
170170

171171
/**
172-
* Build monitoring exporter app
172+
* Build monitoring exporter app.
173173
*
174174
* @throws Exception if could not run the command successfully to clone from github
175175
*/
176176
private static void buildMonitoringExporter() throws Exception {
177177
String monitoringExporterSrcDir = monitoringExporterDir + "/src";
178178
// target dir for monitoring exporter webapp
179-
String monitoringExporterWar =
179+
final String monitoringExporterWar =
180180
monitoringExporterDir + "/apps/monitoringexporter/wls-exporter.war";
181181

182182
// build monitoring exporter project
@@ -798,7 +798,7 @@ public void test18_ChangeConfigEmptyPass() throws Exception {
798798
}
799799

800800
/**
801-
* Test End to End example from MonitoringExporter github project
801+
* Test End to End example from MonitoringExporter github project.
802802
*
803803
* @throws Exception if test fails
804804
*/
@@ -815,18 +815,18 @@ public void test19_EndToEndViaChart() throws Exception {
815815
}
816816
gitCloneMonitoringExporter();
817817
try {
818-
setupPVMYSQL();
818+
setupPvMysql();
819819
} catch (Exception ex) {
820820
deletePvDir();
821821
throw new RuntimeException("FAILURE: failed to install database ");
822822
}
823-
createWLSImageAndDeploy();
823+
createWlsImageAndDeploy();
824824
installWebHookAndAlertManager();
825825
installPrometheusGrafanaViaChart();
826826
fireAlert();
827827
} finally {
828828
uninstallWebHookPrometheusGrafanaViaChart();
829-
uninstallMySQL();
829+
uninstallMysql();
830830

831831
String crdCmd =
832832
" kubectl delete -f " + monitoringExporterEndToEndDir + "/demo-domains/domain1.yaml";
@@ -858,7 +858,7 @@ private void fireAlert() throws Exception {
858858
String command = "kubectl -n webhook logs " + webhookPod;
859859
ExecResult webhookResult = TestUtils.exec(command);
860860
logger.info(" webhook log " + webhookResult.stdout());
861-
assertTrue( webhookResult.stdout().contains("Some WLS cluster has only one running server for more than 1 minutes"));
861+
assertTrue(webhookResult.stdout().contains("Some WLS cluster has only one running server for more than 1 minutes"));
862862
}
863863

864864
private static String getPodName(String app, String namespace) throws Exception {
@@ -952,11 +952,11 @@ private HtmlPage submitConfigureForm(
952952

953953
/**
954954
* Remove monitoring exporter directory if exists and clone latest from github for monitoring
955-
* exporter code
955+
* exporter code.
956956
*
957957
* @throws Exception if could not run the command successfully to install database
958958
*/
959-
private static void setupPVMYSQL() throws Exception {
959+
private static void setupPvMysql() throws Exception {
960960
String pvDir = monitoringExporterEndToEndDir + "pvDir";
961961
if (new File(pvDir).exists()) {
962962
logger.info(" PV dir already exists , cleaning ");
@@ -1042,11 +1042,11 @@ private static void setupPVMYSQL() throws Exception {
10421042
}
10431043

10441044
/**
1045-
* Install wls image tool and update wls pods
1045+
* Install wls image tool and update wls pods.
10461046
*
10471047
* @throws Exception if could not run the command successfully to create WLSImage and deploy
10481048
*/
1049-
private static void createWLSImageAndDeploy() throws Exception {
1049+
private static void createWlsImageAndDeploy() throws Exception {
10501050
operator1 = TestUtils.createOperator(OPERATOR1_YAML);
10511051

10521052
String command =
@@ -1086,7 +1086,7 @@ private static void createWLSImageAndDeploy() throws Exception {
10861086
}
10871087

10881088
/**
1089-
* Install Prometheus and Grafana using helm chart
1089+
* Install Prometheus and Grafana using helm chart.
10901090
*
10911091
* @throws Exception if could not run the command successfully to install Prometheus and Grafana
10921092
*/
@@ -1112,7 +1112,8 @@ private static void installPrometheusGrafanaViaChart() throws Exception {
11121112
crdCmd = "kubectl apply -f " + monitoringExporterEndToEndDir + "/grafana/persistence.yaml";
11131113
TestUtils.exec(crdCmd);
11141114
crdCmd =
1115-
"kubectl --namespace monitoring create secret generic grafana-secret --from-literal=username=admin --from-literal=password=12345678";
1115+
"kubectl --namespace monitoring create secret generic grafana-secret"
1116+
+ " --from-literal=username=admin --from-literal=password=12345678";
11161117
TestUtils.exec(crdCmd);
11171118
logger.info("calling helm install for grafana");
11181119
crdCmd =
@@ -1145,7 +1146,7 @@ private static void installPrometheusGrafanaViaChart() throws Exception {
11451146
}
11461147

11471148
/**
1148-
* Install Prometheus and Grafana using helm chart
1149+
* Install Prometheus and Grafana using helm chart.
11491150
*
11501151
* @throws Exception if could not run the command successfully to install webhook and alert manager
11511152
*/
@@ -1168,7 +1169,7 @@ private static void installWebHookAndAlertManager() throws Exception {
11681169
}
11691170

11701171
/**
1171-
* Uninstall Prometheus and Grafana using helm chart
1172+
* Uninstall Prometheus and Grafana using helm chart.
11721173
*
11731174
* @throws Exception if could not run the command successfully to uninstall deployments
11741175
*/
@@ -1205,11 +1206,11 @@ private static void uninstallWebHookPrometheusGrafanaViaChart() throws Exception
12051206
}
12061207

12071208
/**
1208-
* Unnstall MYSQL
1209+
* Uninstall MYSQL.
12091210
*
12101211
* @throws Exception if could not run the command successfully to uninstall MySQL
12111212
*/
1212-
private static void uninstallMySQL() throws Exception {
1213+
private static void uninstallMysql() throws Exception {
12131214
String monitoringExporterEndToEndDir =
12141215
monitoringExporterDir + "/src/samples/kubernetes/end2end/";
12151216
// unnstall mysql
@@ -1224,7 +1225,7 @@ private static void uninstallMySQL() throws Exception {
12241225
}
12251226

12261227
/**
1227-
* Delete PvDir via docker
1228+
* Delete PvDir via docker.
12281229
*
12291230
* @throws Exception if could not run the command successfully to delete PV
12301231
*/
@@ -1244,7 +1245,7 @@ private static void deletePvDir() throws Exception {
12441245
}
12451246

12461247
/**
1247-
* A utility method to sed files
1248+
* A utility method to sed files.
12481249
*
12491250
* @throws IOException when copying files from source location to staging area fails
12501251
*/
@@ -1260,28 +1261,7 @@ private static void replaceStringInFile(String filePath, String oldValue, String
12601261
}
12611262

12621263
/**
1263-
* A utility method to copy Cross Namespaces RBAC yaml template file replacing the DOMAIN_NS,
1264-
* OPERATOR_NS
1265-
*
1266-
* @throws IOException when copying files from source location to staging area fails
1267-
*/
1268-
private static void createCrossNSRBACFile(String domainNS, String operatorNS) throws IOException {
1269-
String samplesDir = monitoringExporterDir + "/src/samples/kubernetes/deployments/";
1270-
Path src = Paths.get(samplesDir + "/crossnsrbac.yaml");
1271-
Path dst = Paths.get(samplesDir + "/crossnsrbac_" + domainNS + "_" + operatorNS + ".yaml");
1272-
if (!dst.toFile().exists()) {
1273-
logger.log(Level.INFO, "Copying {0}", src.toString());
1274-
Charset charset = StandardCharsets.UTF_8;
1275-
String content = new String(Files.readAllBytes(src), charset);
1276-
content = content.replaceAll("weblogic-domain", domainNS);
1277-
content = content.replaceAll("weblogic-operator", operatorNS);
1278-
logger.log(Level.INFO, "to {0}", dst.toString());
1279-
Files.write(dst, content.getBytes(charset));
1280-
}
1281-
}
1282-
1283-
/**
1284-
* call operator to scale to specified number of replicas
1264+
* call operator to scale to specified number of replicas.
12851265
*
12861266
* @param replicas - number of managed servers
12871267
* @throws Exception if scaling fails

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ public void testTwoDomainsManagedByOneOperatorSharingPV() throws Exception {
257257
operator1 = TestUtils.createOperator(OPERATOR1_YAML);
258258
}
259259

260-
Domain domain1 = null, domain2 = null;
260+
Domain domain1 = null;
261+
Domain domain2 = null;
261262
boolean testCompletedSuccessfully = false;
262263
try {
263264
// load input yaml to map and add configOverrides

0 commit comments

Comments
 (0)