Skip to content

Commit bfca5ba

Browse files
authored
Merge pull request #716 from oracle/sit-cfg-fixes3
POST-2.0-rc1: Sit-cfg override fixes:
2 parents f1fc62d + ddc2ef0 commit bfca5ba

File tree

14 files changed

+133
-42
lines changed

14 files changed

+133
-42
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ please consult this table of contents:
6363
various tasks related to the operator.
6464
* The [Developer guide](site/developer.md) provides details for people who want to understand how the operator is built, tested, and so on. Those who wish to contribute to the operator code will find useful information here. This section also includes
6565
API documentation (Javadoc) and Swagger/OpenAPI documentation for the REST APIs.
66-
* The [Contributing](#contributing-to-the-operator) section provides information about conribution requirements.
66+
* The [Contributing](#contributing-to-the-operator) section provides information about contribution requirements.
6767

6868

6969
# User guide

kubernetes/internal/utility.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,15 +184,35 @@ function toDNS1123Legal {
184184

185185
#
186186
# Function to check if a value is lowercase
187-
# $1 - value to check
188-
# $2 - name of object being checked
187+
# $1 - name of object being checked
188+
# $2 - value to check
189189
function validateLowerCase {
190190
local lcVal=$(toLower $2)
191191
if [ "$lcVal" != "$2" ]; then
192192
validationError "The value of $1 must be lowercase: $2"
193193
fi
194194
}
195195

196+
#
197+
# Function to lowercase a value and make it a legal DNS1123 name
198+
# $1 - value to convert to DNS legal name
199+
function toDNS1123Legal {
200+
local val=`echo $1 | tr "[:upper:]" "[:lower:]"`
201+
val=${val//"_"/"-"}
202+
echo "$val"
203+
}
204+
205+
#
206+
# Function to check if a value is lowercase and legal DNS name
207+
# $1 - name of object being checked
208+
# $2 - value to check
209+
function validateDNS1123LegalName {
210+
local val=$(toDNS1123Legal $2)
211+
if [ "$val" != "$2" ]; then
212+
validationError "The value of $1 contains invalid charaters (uppercase letters or "_"): $2"
213+
fi
214+
}
215+
196216
#
197217
# Function to check if a value is lowercase and legal DNS name
198218
# $1 - value to check

kubernetes/src/test/java/oracle/kubernetes/operator/utils/DomainValues.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ protected String convertNullToEmptyString(String val) {
8787
public DomainValues withTestDefaults() {
8888
return this.adminNodePort("30702")
8989
.adminPort("7002")
90-
.adminServerName("TestAdminServer")
91-
.clusterName("TestCluster")
90+
.adminServerName("test-admin-server")
91+
.clusterName("test-cluster")
9292
.clusterType(CLUSTER_TYPE_DYNAMIC)
9393
.domainName("TestDomain")
9494
.weblogicImage("store/oracle/weblogic:19.1.0.0")
@@ -97,7 +97,7 @@ public DomainValues withTestDefaults() {
9797
.loadBalancerDashboardPort("31315")
9898
.loadBalancerWebPort("31305")
9999
.configuredManagedServerCount("4")
100-
.managedServerNameBase("TestManagedServer")
100+
.managedServerNameBase("test-managed-server")
101101
.managedServerPort("8002")
102102
.initialManagedServerReplicas("3")
103103
.weblogicDomainStorageNFSServer("TestDomainStorageNFSServer")

operator/src/main/resources/scripts/introspectDomain.py

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,14 @@ def addServerTemplates(self):
603603
self.undent()
604604

605605
def addServerTemplate(self, serverTemplate):
606+
# TBD This looks wrong. It should match addClusteredServer.
607+
# It adds default port & listen address. But:
608+
# It's missing adding admin port, SSL, and NAPs.
609+
# It reports the wrong listen address (original rather than overridden).
610+
# Probably tests are passing fine, as it's likely (A)
611+
# the Operator.java is only reading the port, and (B) cluster tests
612+
# are only looking at the cluster default port.
613+
# So: Follow up and fix this, and file test JIRAs for tests.
606614
name=self.name(serverTemplate)
607615
self.writeln("- name: " + name)
608616
if serverTemplate.isListenPortEnabled():
@@ -803,28 +811,34 @@ def customizeServers(self):
803811
for server in self.env.getDomain().getServers():
804812
self.customizeServer(server)
805813

814+
def writeListenAddress(self, originalValue, newValue):
815+
repVerb="\"replace\""
816+
if originalValue is None or len(originalValue)==0:
817+
repVerb="\"add\""
818+
self.writeln("<d:listen-address f:combine-mode=" + repVerb + ">" + newValue + "</d:listen-address>")
819+
806820
def customizeServer(self, server):
807821
name=server.getName()
808822
listen_address=self.env.toDNS1123Legal(self.env.getDomainUID() + "-" + name)
809823
self.writeln("<d:server>")
810824
self.indent()
811825
self.writeln("<d:name>" + name + "</d:name>")
812-
self.writeln("<d:listen-address f:combine-mode=\"replace\">" + listen_address + "</d:listen-address>")
813-
if server.getSSL():
814-
self.writeln("<d:ssl>")
815-
self.indent()
816-
self.writeln("<d:listen-address f:combine-mode=\"replace\">" + listen_address + "</d:listen-address>")
817-
self.undent()
818-
self.writeln("</d:ssl>")
826+
self.customizeLog(name, server, false)
827+
self.writeListenAddress(server.getListenAddress(),listen_address)
819828
for nap in server.getNetworkAccessPoints():
829+
# Don't bother 'add' a nap listen-address, only do a 'replace'.
830+
# If we try 'add' this appears to mess up an attempt to
831+
# 'add' PublicAddress/Port via custom sit-cfg.
832+
# FWIW there's theoretically no need to 'add' or 'replace' when empty
833+
# since the runtime default is the server listen-address.
820834
nap_name=nap.getName()
821-
self.writeln("<d:network-access-point>")
822-
self.indent()
823-
self.writeln("<d:name>" + nap_name + "</d:name>")
824-
self.writeln("<d:listen-address f:combine-mode=\"replace\">" + listen_address + "</d:listen-address>")
825-
self.undent()
826-
self.writeln("</d:network-access-point>")
827-
self.customizeLog(name, server, false)
835+
if not (nap.getListenAddress() is None) and len(nap.getListenAddress()) > 0:
836+
self.writeln("<d:network-access-point>")
837+
self.indent()
838+
self.writeln("<d:name>" + nap_name + "</d:name>")
839+
self.writeListenAddress("force a replace",listen_address)
840+
self.undent()
841+
self.writeln("</d:network-access-point>")
828842
self.undent()
829843
self.writeln("</d:server>")
830844

@@ -839,8 +853,8 @@ def customizeServerTemplate(self, template):
839853
self.writeln("<d:server-template>")
840854
self.indent()
841855
self.writeln("<d:name>" + name + "</d:name>")
842-
self.writeln("<d:listen-address f:combine-mode=\"replace\">" + listen_address + "</d:listen-address>")
843856
self.customizeLog(server_name_prefix + "${id}", template, false)
857+
self.writeListenAddress(template.getListenAddress(),listen_address)
844858
self.undent()
845859
self.writeln("</d:server-template>")
846860

operator/src/main/resources/scripts/startNodeManager.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ createFolder ${NODEMGR_HOME}
111111

112112
NODEMGR_LOG_HOME=${NODEMGR_LOG_HOME:-${LOG_HOME:-${NODEMGR_HOME}/${DOMAIN_UID}}}
113113

114+
trace "Info: NODEMGR_HOME='${NODEMGR_HOME}'"
115+
trace "Info: LOG_HOME='${LOG_HOME}'"
116+
trace "Info: SERVER_NAME='${SERVER_NAME}'"
117+
trace "Info: DOMAIN_UID='${DOMAIN_UID}'"
118+
trace "Info: NODEMGR_LOG_HOME='${NODEMGR_LOG_HOME}'"
119+
114120
createFolder ${NODEMGR_LOG_HOME}
115121

116122
nodemgr_log_file=${NODEMGR_LOG_HOME}/${SERVER_NAME}_nodemanager.log

operator/src/test/java/oracle/kubernetes/operator/steps/ReadHealthStepTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import oracle.kubernetes.operator.ProcessingConstants;
2121
import oracle.kubernetes.operator.http.HttpClient;
2222
import oracle.kubernetes.operator.steps.ReadHealthStep.ReadHealthWithHttpClientStep;
23+
import oracle.kubernetes.operator.work.Component;
2324
import oracle.kubernetes.operator.work.NextAction;
2425
import oracle.kubernetes.operator.work.Packet;
2526
import oracle.kubernetes.operator.work.Step;
@@ -79,6 +80,12 @@ PacketStub withServerName(String serverName) {
7980
return this;
8081
}
8182

83+
PacketStub addSpi(Class clazz, Object spiObject) {
84+
Component component = Component.createFor(spiObject);
85+
this.getComponents().put(clazz.getName(), component);
86+
return this;
87+
}
88+
8289
@Override
8390
public Object get(Object key) {
8491
if (HttpClient.KEY.equals(key)) {

site/architecture.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ The operator consists of the following two main parts:
77
* The operator itself, a process that runs in a Docker container deployed into a Kubernetes pod and which performs the actual management tasks.
88
* A Kubernetes job which can be used to create a WebLogic domain.
99

10-
The operator is packaged in a Docker image `container-registry.oracle.com/middleware/weblogic-operator:latest`. This image can be deployed to a Kubernetes cluster. It is recommended that the operator be deployed in its own namespace. Only one operator is permitted in a namespace; however, multiple operators may be deployed in a Kubernetes cluster provided they are each in their own namespace and the list of namespaces they manage do not overlap.
10+
The operator is packaged in a [Docker image](https://hub.docker.com/r/oracle/weblogic-kubernetes-operator/) which you can access using the following `docker pull` command:
11+
12+
```
13+
14+
docker pull oracle/weblogic-kubernetes-operator:1.1
15+
16+
```
17+
18+
This image can be deployed to a Kubernetes cluster. It is recommended that the operator be deployed in its own namespace. Only one operator is permitted in a namespace; however, multiple operators may be deployed in a Kubernetes cluster provided they are each in their own namespace and the list of namespaces they manage do not overlap.
1119

1220
Scripts are provided to deploy the operator to a Kubernetes cluster. These scripts also provide options to install and configure a load balancer and Elastic Stack integration.
1321

site/helm-charts.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44

55
The WebLogic Kubernetes Operator uses Helm to create and deploy any necessary resources and then run the operator in a Kubernetes cluster. Helm helps you manage Kubernetes applications. Helm charts help you define and install applications into the Kubernetes cluster. The operator's Helm chart is located in the `kubernetes/charts/weblogic-operator` directory.
66

7+
> If you have an old version of the operator installed on your cluster you must remove
8+
it before installing this version. You should remove the deployment (for example `kubectl delete deploy weblogic-operator -n your-namespace`) and the custom
9+
resource definition (for example `kubectl delete crd domain`). If you do not remove
10+
the custom resource definition you may see errors like this:
11+
12+
`Error from server (BadRequest): error when creating "/scratch/output/uidomain/weblogic-domains/uidomain/domain.yaml":
13+
the API version in the data (weblogic.oracle/v2) does not match the expected API version (weblogic.oracle/v1`
14+
15+
716
## Install Helm and Tiller
817

918
Helm has two parts: a client (helm) and a server (tiller). Tiller runs inside of your Kubernetes cluster, and manages releases (installations) of your charts. See https://github.com/kubernetes/helm/blob/master/docs/install.md for detailed instructions on installing helm and tiller.

site/quickstart.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Use this quick start guide to create a WebLogic deployment in a Kubernetes clust
44
These instructions assume that you are already familiar with Kubernetes. If you need more detailed instructions, please
55
refer to the [User guide](user-guide.md).
66

7+
> If you have an old version of the operator installed on your cluster you must remove
8+
it before installing this version. You should remove the deployment (for example `kubectl delete deploy weblogic-operator -n your-namespace`) and the custom
9+
resource definition (for example `kubectl delete crd domain`). If you do not remove
10+
the custom resource definition you may see errors like this:
11+
12+
`Error from server (BadRequest): error when creating "/scratch/output/uidomain/weblogic-domains/uidomain/domain.yaml":
13+
the API version in the data (weblogic.oracle/v2) does not match the expected API version (weblogic.oracle/v1`
14+
715
## Prerequisites
816
For this exercise, you’ll need a Kubernetes cluster. If you need help setting one up, check out our [cheat sheet](k8s_setup.md).
917

@@ -164,9 +172,14 @@ domain namespace (`sample-domain1-ns`) and the `domainHomeImageBase` (`oracle/we
164172
For example, assuming you named your copy `my-inputs.yaml`:
165173
```
166174
$ cd kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image
167-
$ ./create-domain.sh -i my-inputs.yaml -o /some/output/directory -e -v
175+
$ ./create-domain.sh -i my-inputs.yaml -o /some/output/directory -u username -p password -e
168176
```
169177

178+
You need to provide the WebLogic administration username and password in the `-u` and `-p` options
179+
respectively, as shown in the example. If you specify the `-e` option, the script will generate the
180+
Kubernetes YAML files *and* apply them to your cluster. If you omit the `-e` option, the
181+
script will just generate the YAML files, but will not take any action on your cluster.
182+
170183
c. Confirm that the operator started the servers for the domain:
171184
* Use `kubectl` to show that the domain resource was created:
172185
```

site/v1.0/creating-domain.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ The following parameters must be provided in the input file.
109109
| `exposeAdminNodePort` | Boolean indicating if the Administration Server is exposed outside of the Kubernetes cluster. | `false` |
110110
| `exposeAdminT3Channel` | Boolean indicating if the T3 administrative channel is exposed outside the Kubernetes cluster. | `false` |
111111
| `initialManagedServerReplicas` | Number of Managed Servers to initially start for the domain. | `2` |
112-
| `javaOptions` | Java options for starting the Administration and Managed Servers. | `-Dweblogic.StdoutDebugEnabled=false` |
112+
| `javaOptions` | Java options for starting the Administration and Managed Servers. A Java option can have references to one or more of the following pre-defined variables to obtain WebLogic domain information: $(DOMAIN_NAME), $(DOMAIN_HOME), $(ADMIN_NAME), $(ADMIN_PORT), and $(SERVER_NAME). | `-Dweblogic.StdoutDebugEnabled=false` |
113113
| `loadBalancer` | Type of load balancer to create. Legal values are `NONE` and `TRAEFIK`. | `TRAEFIK` |
114114
| `loadBalancerDashboardPort` | Node port for the load balancer to accept dashboard traffic. | `30315` |
115115
| `loadBalancerWebPort` | Node port for the load balancer to accept user traffic. | `30305` |

0 commit comments

Comments
 (0)