Skip to content

Commit bc88a87

Browse files
committed
Doc. updates
1 parent 4907ccc commit bc88a87

File tree

2 files changed

+75
-4
lines changed

2 files changed

+75
-4
lines changed

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

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The following prerequisites must be fulfilled before proceeding with the creatio
2020

2121
* Make sure the WebLogic operator is running.
2222
* Create a Kubernetes namespace for the domain resource unless the intention is to use the default namespace.
23-
* Create the Kubernetes secrets `username` and `password` of the administrative account in the same Kubernetes namespace as the domain resource.
23+
* Create the Kubernetes secrets containing the `username` and `password` of the administrative account in the same Kubernetes namespace as the domain resource.
2424

2525
#### YAML files
2626

@@ -85,7 +85,7 @@ Elements related to overriding WebLogic domain configuration:
8585
* `configOverrideSecrets`: A list of names of the secrets for optional WebLogic configuration overrides.
8686

8787
Elements related to Kubernetes pod and service generation:
88-
* `serverPod`: Configuration affecting server pods.
88+
* `serverPod`: Configuration affecting server pods for WebLogic Server instances. Most entries specify standard Kubernetes content for pods that you may want the operator to include in pods generated for WebLogic Server instances, such as labels, annotations, volumes, or scheduling constraints, including anti-affinity.
8989
* `serverService`: Customization affecting ClusterIP Kubernetes services for WebLogic Server instances.
9090

9191
Sub-sections related to the Administration Server, specific clusters or specific Managed Servers:
@@ -97,7 +97,7 @@ The elements `serverStartPolicy`, `serverStartState`, `serverPod` and `serverSer
9797

9898
### Pod generation
9999

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/).
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 sidecar and init containers, labels, annotations, volumes, volume mounts, scheduling constraints, including anti-affinity, [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/).
101101

102102
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:
103103
* DOMAIN_NAME: The WebLogic domain name
@@ -106,3 +106,72 @@ Prior to creating a pod, the operator replaces variable references allowing the
106106
* SERVER_NAME: The WebLogic Server name
107107
* CLUSTER_NAME: The WebLogic cluster name, if this is a cluster member
108108
* LOG_HOME: The WebLogic log location as a file system path within the container
109+
110+
This example domain YAML specifies that pods for WebLogic Server instances in the "cluster-1" cluster will have a per-managed server volume and volume mount (similar to a Kubernetes StatefulSet), an init container to initialize some files in that volume, and anti-affinity scheduling so that the server instances are scheduled as much as possible on different nodes:
111+
112+
```
113+
# Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
114+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
115+
#
116+
apiVersion: "weblogic.oracle/v5"
117+
kind: Domain
118+
metadata:
119+
name: domain1
120+
namespace: domains23
121+
labels:
122+
weblogic.resourceVersion: domain-v2
123+
weblogic.domainUID: domain1
124+
spec:
125+
domainHome: /u01/oracle/user_projects/domains/domain1
126+
domainHomeInImage: true
127+
image: "phx.ocir.io/weblogick8s/my-domain-home-in-image:12.2.1.3"
128+
imagePullPolicy: "IfNotPresent"
129+
imagePullSecrets:
130+
- name: ocirsecret
131+
webLogicCredentialsSecret:
132+
name: domain1-weblogic-credentials
133+
includeServerOutInPodLog: true
134+
serverStartPolicy: "IF_NEEDED"
135+
serverPod:
136+
env:
137+
- name: JAVA_OPTIONS
138+
value: "-Dweblogic.StdoutDebugEnabled=false"
139+
- name: USER_MEM_ARGS
140+
value: "-XX:+UseContainerSupport -Djava.security.egd=file:/dev/./urandom "
141+
142+
adminServer:
143+
serverStartState: "RUNNING"
144+
145+
clusters:
146+
- clusterName: cluster-1
147+
serverStartState: "RUNNING"
148+
serverPod:
149+
affinity:
150+
podAntiAffinity:
151+
preferredDuringSchedulingIgnoredDuringExecution:
152+
- labelSelector:
153+
matchExpressions:
154+
- key: "weblogic.clusterName"
155+
operator: In
156+
values:
157+
- cluster-1
158+
topologyKey: "kubernetes.io/hostname"
159+
volumes:
160+
- name: $(SERVER_NAME)-volume
161+
emptyDir: {}
162+
volumeMounts:
163+
- mountPath: /server-volume
164+
name: $(SERVER_NAME)-volume
165+
initContainers:
166+
- name: volumeinit
167+
image: "oraclelinux:7-slim"
168+
imagePullPolicy: IfNotPresent
169+
command: ["/usr/bin/sh"]
170+
args: ["echo", "Replace with command to initialize files in /init-volume"]
171+
volumeMounts:
172+
- mountPath: /init-volume
173+
name: $(SERVER_NAME)-volume
174+
replicas: 2
175+
```
176+
177+
The operator uses an "introspection" job to discover details about the WebLogic domain configuration, such as the list of clusters and network access points. The job pod for the introspector is generated using the `serverPod` entries for the administration server. Because the administration server name is not known until the introspection step is complete, the value of the `$(SERVER_NAME)` variable for the introspection job will be "introspector".

operator/src/main/java/oracle/kubernetes/operator/helpers/JobStepContext.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ protected String getMainContainerName() {
8484

8585
@Override
8686
protected Map<String, String> augmentSubVars(Map<String, String> vars) {
87-
// HERE: placeholder that needs to be documented
87+
// For other introspector job pod content, we use the values that would apply administration server; however,
88+
// since we won't know the name of the administation server from the domain configuration until introspection
89+
// has run, we will use the hardcoded value "introspector" as the server name.
8890
vars.put("SERVER_NAME", "introspector");
8991
return vars;
9092
}

0 commit comments

Comments
 (0)