Skip to content

Commit 01c1b84

Browse files
committed
Merge branch 'master' into feature/dynamic-cluster
2 parents d886140 + de8015f commit 01c1b84

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+537
-335
lines changed

README.md

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

docs/apidocs/constant-values.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ <h2 title="oracle.kubernetes">oracle.kubernetes.*</h2>
202202
<!-- -->
203203
</a><code>public&nbsp;static&nbsp;final&nbsp;<a href="https://docs.oracle.com/javase/9/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
204204
<th class="colSecond" scope="row"><code><a href="oracle/kubernetes/operator/KubernetesConstants.html#DOMAIN_CONFIG_MAP_NAME">DOMAIN_CONFIG_MAP_NAME</a></code></th>
205-
<td class="colLast"><code>"weblogic-domain-config-map"</code></td>
205+
<td class="colLast"><code>"weblogic-domain-cm"</code></td>
206206
</tr>
207207
<tr class="altColor">
208208
<td class="colFirst"><a name="oracle.kubernetes.operator.KubernetesConstants.DOMAIN_GROUP">

kubernetes/internal/create-weblogic-domain-job-template.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
apiVersion: v1
44
kind: ConfigMap
55
metadata:
6-
name: domain-%DOMAIN_UID%-scripts
6+
name: %DOMAIN_UID%-create-weblogic-domain-job-cm
77
namespace: %NAMESPACE%
88
labels:
99
weblogic.domainUID: %DOMAIN_UID%
10+
weblogic.domainName: %DOMAIN_NAME%
1011
data:
1112
utility.sh: |-
1213
#!/bin/bash
@@ -278,42 +279,43 @@ data:
278279
apiVersion: batch/v1
279280
kind: Job
280281
metadata:
281-
name: domain-%DOMAIN_UID%-job
282+
name: %DOMAIN_UID%-create-weblogic-domain-job
282283
namespace: %NAMESPACE%
283284
spec:
284285
template:
285286
metadata:
286287
labels:
287-
app: domain-%DOMAIN_UID%-job
288288
weblogic.domainUID: %DOMAIN_UID%
289+
weblogic.domainName: %DOMAIN_NAME%
290+
app: %DOMAIN_UID%-create-weblogic-domain-job
289291
spec:
290292
restartPolicy: Never
291293
containers:
292-
- name: domain-job
294+
- name: create-weblogic-domain-job
293295
image: store/oracle/weblogic:12.2.1.3
294296
imagePullPolicy: IfNotPresent
295297
ports:
296298
- containerPort: 7001
297299
volumeMounts:
298300
- mountPath: /u01/weblogic
299-
name: config-map-scripts
301+
name: create-weblogic-domain-job-cm-volume
300302
- mountPath: /shared
301-
name: pv-storage
303+
name: weblogic-domain-storage-volume
302304
- mountPath: /weblogic-operator/secrets
303-
name: secrets
305+
name: weblogic-credentials-volume
304306
command: ["/bin/sh"]
305307
args: ["/u01/weblogic/create-domain-job.sh"]
306308
env:
307309
- name: SHARED_PATH
308310
value: "/shared"
309311
volumes:
310-
- name: config-map-scripts
312+
- name: create-weblogic-domain-job-cm-volume
311313
configMap:
312-
name: domain-%DOMAIN_UID%-scripts
313-
- name: pv-storage
314+
name: %DOMAIN_UID%-create-weblogic-domain-job-cm
315+
- name: weblogic-domain-storage-volume
314316
persistentVolumeClaim:
315317
claimName: %DOMAIN_UID%-weblogic-domain-pvc
316-
- name: secrets
318+
- name: weblogic-credentials-volume
317319
secret:
318320
secretName: %WEBLOGIC_CREDENTIALS_SECRET_NAME%
319321
%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%imagePullSecrets:

kubernetes/internal/create-weblogic-domain.sh

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ function initAndValidateOutputDir {
9696
${domainOutputDir} \
9797
${valuesInputFile} \
9898
create-weblogic-domain-inputs.yaml \
99-
weblogic-domain-persistent-volume.yaml \
100-
weblogic-domain-persistent-volume-claim.yaml \
99+
weblogic-domain-pv.yaml \
100+
weblogic-domain-pvc.yaml \
101+
weblogic-domain-traefik-${clusterNameLC}.yaml \
102+
weblogic-domain-traefik-security-${clusterNameLC}.yaml \
101103
create-weblogic-domain-job.yaml \
102-
domain-custom-resource.yaml \
103-
traefik.yaml
104+
domain-custom-resource.yaml
104105
}
105106

106107
#
@@ -308,12 +309,12 @@ function initialize {
308309
fi
309310
fi
310311

311-
domainPVInput="${scriptDir}/weblogic-domain-persistent-volume-template.yaml"
312+
domainPVInput="${scriptDir}/weblogic-domain-pv-template.yaml"
312313
if [ ! -f ${domainPVInput} ]; then
313314
validationError "The template file ${domainPVInput} for generating a persistent volume was not found"
314315
fi
315316

316-
domainPVCInput="${scriptDir}/weblogic-domain-persistent-volume-claim-template.yaml"
317+
domainPVCInput="${scriptDir}/weblogic-domain-pvc-template.yaml"
317318
if [ ! -f ${domainPVCInput} ]; then
318319
validationError "The template file ${domainPVCInput} for generating a persistent volume claim was not found"
319320
fi
@@ -328,12 +329,12 @@ function initialize {
328329
validationError "The template file ${dcrInput} for creating the domain custom resource was not found"
329330
fi
330331

331-
traefikSecurityInput="${scriptDir}/traefik-security-template.yaml"
332+
traefikSecurityInput="${scriptDir}/weblogic-domain-traefik-security-template.yaml"
332333
if [ ! -f ${traefikSecurityInput} ]; then
333334
validationError "The file ${traefikSecurityInput} for generating the traefik RBAC was not found"
334335
fi
335336

336-
traefikInput="${scriptDir}/traefik-template.yaml"
337+
traefikInput="${scriptDir}/weblogic-domain-traefik-template.yaml"
337338
if [ ! -f ${traefikInput} ]; then
338339
validationError "The template file ${traefikInput} for generating the traefik deployment was not found"
339340
fi
@@ -400,12 +401,12 @@ function createYamlFiles {
400401
# (if needed) and copy the inputs file there.
401402
copyInputsFileToOutputDirectory ${valuesInputFile} "${domainOutputDir}/create-weblogic-domain-inputs.yaml"
402403

403-
domainPVOutput="${domainOutputDir}/weblogic-domain-persistent-volume.yaml"
404-
domainPVCOutput="${domainOutputDir}/weblogic-domain-persistent-volume-claim.yaml"
404+
domainPVOutput="${domainOutputDir}/weblogic-domain-pv.yaml"
405+
domainPVCOutput="${domainOutputDir}/weblogic-domain-pvc.yaml"
405406
jobOutput="${domainOutputDir}/create-weblogic-domain-job.yaml"
406407
dcrOutput="${domainOutputDir}/domain-custom-resource.yaml"
407-
traefikSecurityOutput="${domainOutputDir}/traefik-security.yaml"
408-
traefikOutput="${domainOutputDir}/traefik.yaml"
408+
traefikSecurityOutput="${domainOutputDir}/weblogic-domain-traefik-security-${clusterNameLC}.yaml"
409+
traefikOutput="${domainOutputDir}/weblogic-domain-traefik-${clusterNameLC}.yaml"
409410

410411
enabledPrefix="" # uncomment the feature
411412
disabledPrefix="# " # comment out the feature
@@ -424,6 +425,7 @@ function createYamlFiles {
424425
fi
425426

426427
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${domainPVOutput}
428+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${domainPVOutput}
427429
sed -i -e "s:%NAMESPACE%:$namespace:g" ${domainPVOutput}
428430
sed -i -e "s:%WEBLOGIC_DOMAIN_STORAGE_PATH%:${weblogicDomainStoragePath}:g" ${domainPVOutput}
429431
sed -i -e "s:%WEBLOGIC_DOMAIN_STORAGE_RECLAIM_POLICY%:${weblogicDomainStorageReclaimPolicy}:g" ${domainPVOutput}
@@ -437,6 +439,7 @@ function createYamlFiles {
437439
cp ${domainPVCInput} ${domainPVCOutput}
438440
sed -i -e "s:%NAMESPACE%:$namespace:g" ${domainPVCOutput}
439441
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${domainPVCOutput}
442+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${domainPVCOutput}
440443
sed -i -e "s:%WEBLOGIC_DOMAIN_STORAGE_SIZE%:${weblogicDomainStorageSize}:g" ${domainPVCOutput}
441444

442445
# Generate the yaml to create the kubernetes job that will create the weblogic domain
@@ -495,8 +498,9 @@ function createYamlFiles {
495498
echo Generating ${traefikOutput}
496499
sed -i -e "s:%NAMESPACE%:$namespace:g" ${traefikOutput}
497500
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${traefikOutput}
498-
sed -i -e "s:%CLUSTER_NAME_LC%:${clusterNameLC}:g" ${traefikOutput}
501+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${traefikOutput}
499502
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${traefikOutput}
503+
sed -i -e "s:%CLUSTER_NAME_LC%:${clusterNameLC}:g" ${traefikOutput}
500504
sed -i -e "s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort:g" ${traefikOutput}
501505
sed -i -e "s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort:g" ${traefikOutput}
502506

@@ -505,6 +509,8 @@ function createYamlFiles {
505509
echo Generating ${traefikSecurityOutput}
506510
sed -i -e "s:%NAMESPACE%:$namespace:g" ${traefikSecurityOutput}
507511
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${traefikSecurityOutput}
512+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${traefikSecurityOutput}
513+
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${traefikSecurityOutput}
508514
sed -i -e "s:%CLUSTER_NAME_LC%:${clusterNameLC}:g" ${traefikSecurityOutput}
509515

510516
# Remove any "...yaml-e" files left over from running sed
@@ -547,7 +553,7 @@ function createDomainPVC {
547553
function createDomain {
548554

549555
# There is no way to re-run a kubernetes job, so first delete any prior job
550-
JOB_NAME="domain-${domainUID}-job"
556+
JOB_NAME="${domainUID}-create-weblogic-domain-job"
551557
deleteK8sObj job $JOB_NAME ${jobOutput}
552558

553559
echo Creating the domain by creating the job ${jobOutput}
@@ -560,8 +566,8 @@ function createDomain {
560566
while [ "$JOB_STATUS" != "Completed" -a $count -lt $max ] ; do
561567
sleep 30
562568
count=`expr $count + 1`
563-
JOB_STATUS=`kubectl get pods --show-all -n ${namespace} | grep "domain-${domainUID}" | awk ' { print $3; } '`
564-
JOB_INFO=`kubectl get pods --show-all -n ${namespace} | grep "domain-${domainUID}" | awk ' { print "pod", $1, "status is", $3; } '`
569+
JOB_STATUS=`kubectl get pods --show-all -n ${namespace} | grep ${JOB_NAME} | awk ' { print $3; } '`
570+
JOB_INFO=`kubectl get pods --show-all -n ${namespace} | grep ${JOB_NAME} | awk ' { print "pod", $1, "status is", $3; } '`
565571
echo "status on iteration $count of $max"
566572
echo "$JOB_INFO"
567573

@@ -579,7 +585,7 @@ function createDomain {
579585
done
580586

581587
# Confirm the job pod is status completed
582-
JOB_POD=`kubectl get pods --show-all -n ${namespace} | grep "domain-${domainUID}" | awk ' { print $1; } '`
588+
JOB_POD=`kubectl get pods --show-all -n ${namespace} | grep ${JOB_NAME} | awk ' { print $1; } '`
583589
if [ "$JOB_STATUS" != "Completed" ]; then
584590
echo The create domain job is not showing status completed after waiting 300 seconds
585591
echo Check the log output for errors

kubernetes/internal/create-weblogic-operator.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ dirname "${script}"
306306
generatedKeyFile="${generatedCertDir}/weblogic-operator.key.pem"
307307

308308
# Always generate a self-signed cert for the internal operator REST port
309-
internal_host="internal-weblogic-operator-service"
309+
internal_host="internal-weblogic-operator-svc"
310310
internal_sans="DNS:${internal_host},DNS:${internal_host}.${namespace},DNS:${internal_host}.${namespace}.svc,DNS:${internal_host}.${namespace}.svc.cluster.local"
311311
echo "Generating a self-signed certificate for the operator's internal https port with the subject alternative names ${internal_sans}"
312312
${genOprCertScript} ${internal_sans}
@@ -570,8 +570,8 @@ function deployOperator {
570570
fi
571571

572572
echo Checking the operator labels
573-
LABEL=`kubectl describe deploy weblogic-operator -n ${namespace} | grep "^Labels:" | awk ' { print $2; } '`
574-
if [ "$LABEL" != "app=weblogic-operator" ]; then
573+
LABEL=`kubectl get deploy weblogic-operator -n ${namespace} -o jsonpath='{.spec.template.metadata.labels.app}'`
574+
if [ "$LABEL" != "weblogic-operator" ]; then
575575
fail "The weblogic-operator deployment should have the label app=weblogic-operator"
576576
fi
577577

kubernetes/internal/domain-custom-resource-template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ metadata:
1010
namespace: %NAMESPACE%
1111
labels:
1212
weblogic.domainUID: %DOMAIN_UID%
13+
weblogic.domainName: %DOMAIN_NAME%
1314
spec:
1415
# The domainUID must be unique across the entire Kubernetes Cluster. Each WebLogic Domain must
1516
# have its own unique domainUID. This does not have to be the same as the Domain Name. It is allowed

kubernetes/internal/generate-security-policy.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ apiVersion: v1
6666
kind: Namespace
6767
metadata:
6868
name: ${NAMESPACE}
69+
labels:
70+
weblogic.operatorName: ${NAMESPACE}
6971
---
7072
#
7173
# Service Account for WebLogic Operator
@@ -75,6 +77,8 @@ kind: ServiceAccount
7577
metadata:
7678
namespace: ${NAMESPACE}
7779
name: ${ACCOUNT_NAME}
80+
labels:
81+
weblogic.operatorName: ${NAMESPACE}
7882
---
7983
EOF
8084

@@ -86,6 +90,8 @@ kind: ClusterRole
8690
apiVersion: rbac.authorization.k8s.io/v1beta1
8791
metadata:
8892
name: weblogic-operator-cluster-role
93+
labels:
94+
weblogic.operatorName: ${NAMESPACE}
8995
rules:
9096
- apiGroups: [""]
9197
resources: ["namespaces", "persistentvolumes"]
@@ -107,6 +113,8 @@ kind: ClusterRole
107113
apiVersion: rbac.authorization.k8s.io/v1beta1
108114
metadata:
109115
name: weblogic-operator-cluster-role-nonresource
116+
labels:
117+
weblogic.operatorName: ${NAMESPACE}
110118
rules:
111119
- nonResourceURLs: ["/version/*"]
112120
verbs: ["get"]
@@ -118,6 +126,8 @@ kind: ClusterRoleBinding
118126
apiVersion: rbac.authorization.k8s.io/v1beta1
119127
metadata:
120128
name: ${NAMESPACE}-operator-rolebinding
129+
labels:
130+
weblogic.operatorName: ${NAMESPACE}
121131
subjects:
122132
- kind: ServiceAccount
123133
name: ${ACCOUNT_NAME}
@@ -132,6 +142,8 @@ kind: ClusterRoleBinding
132142
apiVersion: rbac.authorization.k8s.io/v1beta1
133143
metadata:
134144
name: ${NAMESPACE}-operator-rolebinding-nonresource
145+
labels:
146+
weblogic.operatorName: ${NAMESPACE}
135147
subjects:
136148
- kind: ServiceAccount
137149
name: ${ACCOUNT_NAME}
@@ -146,6 +158,8 @@ kind: ClusterRoleBinding
146158
apiVersion: rbac.authorization.k8s.io/v1beta1
147159
metadata:
148160
name: ${NAMESPACE}-operator-rolebinding-discovery
161+
labels:
162+
weblogic.operatorName: ${NAMESPACE}
149163
subjects:
150164
- kind: ServiceAccount
151165
name: ${ACCOUNT_NAME}
@@ -160,6 +174,8 @@ kind: ClusterRoleBinding
160174
apiVersion: rbac.authorization.k8s.io/v1beta1
161175
metadata:
162176
name: ${NAMESPACE}-operator-rolebinding-auth-delegator
177+
labels:
178+
weblogic.operatorName: ${NAMESPACE}
163179
subjects:
164180
- kind: ServiceAccount
165181
name: ${ACCOUNT_NAME}
@@ -177,6 +193,8 @@ kind: ClusterRole
177193
apiVersion: rbac.authorization.k8s.io/v1beta1
178194
metadata:
179195
name: weblogic-operator-namespace-role
196+
labels:
197+
weblogic.operatorName: ${NAMESPACE}
180198
rules:
181199
- apiGroups: [""]
182200
resources: ["secrets", "persistentvolumeclaims"]
@@ -214,6 +232,8 @@ apiVersion: rbac.authorization.k8s.io/v1beta1
214232
metadata:
215233
name: weblogic-operator-rolebinding
216234
namespace: ${i}
235+
labels:
236+
weblogic.operatorName: ${NAMESPACE}
217237
subjects:
218238
- kind: ServiceAccount
219239
name: ${ACCOUNT_NAME}

kubernetes/internal/weblogic-domain-persistent-volume-template.yaml renamed to kubernetes/internal/weblogic-domain-pv-template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ metadata:
77
name: %DOMAIN_UID%-weblogic-domain-pv
88
labels:
99
weblogic.domainUID: %DOMAIN_UID%
10+
weblogic.domainName: %DOMAIN_NAME%
1011
spec:
1112
storageClassName: %DOMAIN_UID%-weblogic-domain-storage-class
1213
capacity:

kubernetes/internal/weblogic-domain-persistent-volume-claim-template.yaml renamed to kubernetes/internal/weblogic-domain-pvc-template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ metadata:
88
namespace: %NAMESPACE%
99
labels:
1010
weblogic.domainUID: %DOMAIN_UID%
11+
weblogic.domainName: %DOMAIN_NAME%
1112
spec:
1213
storageClassName: %DOMAIN_UID%-weblogic-domain-storage-class
1314
accessModes:

kubernetes/internal/traefik-security-template.yaml renamed to kubernetes/internal/weblogic-domain-traefik-security-template.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ metadata:
55
name: %DOMAIN_UID%-%CLUSTER_NAME_LC%-traefik
66
labels:
77
weblogic.domainUID: %DOMAIN_UID%
8+
weblogic.domainName: %DOMAIN_NAME%
9+
weblogic.clusterName: %CLUSTER_NAME%
810
rules:
911
- apiGroups:
1012
- ""
@@ -32,7 +34,8 @@ metadata:
3234
name: %DOMAIN_UID%-%CLUSTER_NAME_LC%-traefik
3335
labels:
3436
weblogic.domainUID: %DOMAIN_UID%
35-
weblogic.clusterName: %CLUSTER_NAME_LC%
37+
weblogic.domainName: %DOMAIN_NAME%
38+
weblogic.clusterName: %CLUSTER_NAME%
3639
roleRef:
3740
apiGroup: rbac.authorization.k8s.io
3841
kind: ClusterRole

0 commit comments

Comments
 (0)