Skip to content

Commit 66d6077

Browse files
authored
Merge pull request #176 from oracle/standardize-names-phase2
Standardize names phase2
2 parents 7d55f9e + 5d42ac3 commit 66d6077

Some content is hidden

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

42 files changed

+500
-309
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ To remove the operator from a Kubernetes cluster, issue the following commands:
182182

183183
```
184184
kubectl delete deploy weblogic-operator –n NAMESPACE
185-
kubectl delete service external-weblogic-operator-service –n NAMESPACE
186-
kubectl delete service internal-weblogic-operator-service –n NAMESPACE
185+
kubectl delete service external-weblogic-operator-svc –n NAMESPACE
186+
kubectl delete service internal-weblogic-operator-svc –n NAMESPACE
187187
```
188188

189189
Replace `NAMESPACE` with the namespace that the operator is running in.

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
@@ -508,42 +509,43 @@ data:
508509
apiVersion: batch/v1
509510
kind: Job
510511
metadata:
511-
name: domain-%DOMAIN_UID%-job
512+
name: %DOMAIN_UID%-create-weblogic-domain-job
512513
namespace: %NAMESPACE%
513514
spec:
514515
template:
515516
metadata:
516517
labels:
517-
app: domain-%DOMAIN_UID%-job
518518
weblogic.domainUID: %DOMAIN_UID%
519+
weblogic.domainName: %DOMAIN_NAME%
520+
app: %DOMAIN_UID%-create-weblogic-domain-job
519521
spec:
520522
restartPolicy: Never
521523
containers:
522-
- name: domain-job
524+
- name: create-weblogic-domain-job
523525
image: store/oracle/weblogic:12.2.1.3
524526
imagePullPolicy: IfNotPresent
525527
ports:
526528
- containerPort: 7001
527529
volumeMounts:
528530
- mountPath: /u01/weblogic
529-
name: config-map-scripts
531+
name: create-weblogic-domain-job-cm-volume
530532
- mountPath: /shared
531-
name: pv-storage
533+
name: weblogic-domain-storage-volume
532534
- mountPath: /weblogic-operator/secrets
533-
name: secrets
535+
name: weblogic-credentials-volume
534536
command: ["/bin/sh"]
535537
args: ["/u01/weblogic/create-domain-job.sh"]
536538
env:
537539
- name: SHARED_PATH
538540
value: "/shared"
539541
volumes:
540-
- name: config-map-scripts
542+
- name: create-weblogic-domain-job-cm-volume
541543
configMap:
542-
name: domain-%DOMAIN_UID%-scripts
543-
- name: pv-storage
544+
name: %DOMAIN_UID%-create-weblogic-domain-job-cm
545+
- name: weblogic-domain-storage-volume
544546
persistentVolumeClaim:
545547
claimName: %DOMAIN_UID%-weblogic-domain-pvc
546-
- name: secrets
548+
- name: weblogic-credentials-volume
547549
secret:
548550
secretName: %WEBLOGIC_CREDENTIALS_SECRET_NAME%
549551
%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
#
@@ -290,12 +291,12 @@ function initialize {
290291
fi
291292
fi
292293

293-
domainPVInput="${scriptDir}/weblogic-domain-persistent-volume-template.yaml"
294+
domainPVInput="${scriptDir}/weblogic-domain-pv-template.yaml"
294295
if [ ! -f ${domainPVInput} ]; then
295296
validationError "The template file ${domainPVInput} for generating a persistent volume was not found"
296297
fi
297298

298-
domainPVCInput="${scriptDir}/weblogic-domain-persistent-volume-claim-template.yaml"
299+
domainPVCInput="${scriptDir}/weblogic-domain-pvc-template.yaml"
299300
if [ ! -f ${domainPVCInput} ]; then
300301
validationError "The template file ${domainPVCInput} for generating a persistent volume claim was not found"
301302
fi
@@ -310,12 +311,12 @@ function initialize {
310311
validationError "The template file ${dcrInput} for creating the domain custom resource was not found"
311312
fi
312313

313-
traefikSecurityInput="${scriptDir}/traefik-security-template.yaml"
314+
traefikSecurityInput="${scriptDir}/weblogic-domain-traefik-security-template.yaml"
314315
if [ ! -f ${traefikSecurityInput} ]; then
315316
validationError "The file ${traefikSecurityInput} for generating the traefik RBAC was not found"
316317
fi
317318

318-
traefikInput="${scriptDir}/traefik-template.yaml"
319+
traefikInput="${scriptDir}/weblogic-domain-traefik-template.yaml"
319320
if [ ! -f ${traefikInput} ]; then
320321
validationError "The template file ${traefikInput} for generating the traefik deployment was not found"
321322
fi
@@ -381,12 +382,12 @@ function createYamlFiles {
381382
# (if needed) and copy the inputs file there.
382383
copyInputsFileToOutputDirectory ${valuesInputFile} "${domainOutputDir}/create-weblogic-domain-inputs.yaml"
383384

384-
domainPVOutput="${domainOutputDir}/weblogic-domain-persistent-volume.yaml"
385-
domainPVCOutput="${domainOutputDir}/weblogic-domain-persistent-volume-claim.yaml"
385+
domainPVOutput="${domainOutputDir}/weblogic-domain-pv.yaml"
386+
domainPVCOutput="${domainOutputDir}/weblogic-domain-pvc.yaml"
386387
jobOutput="${domainOutputDir}/create-weblogic-domain-job.yaml"
387388
dcrOutput="${domainOutputDir}/domain-custom-resource.yaml"
388-
traefikSecurityOutput="${domainOutputDir}/traefik-security.yaml"
389-
traefikOutput="${domainOutputDir}/traefik.yaml"
389+
traefikSecurityOutput="${domainOutputDir}/weblogic-domain-traefik-security-${clusterNameLC}.yaml"
390+
traefikOutput="${domainOutputDir}/weblogic-domain-traefik-${clusterNameLC}.yaml"
390391

391392
enabledPrefix="" # uncomment the feature
392393
disabledPrefix="# " # comment out the feature
@@ -405,6 +406,7 @@ function createYamlFiles {
405406
fi
406407

407408
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${domainPVOutput}
409+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${domainPVOutput}
408410
sed -i -e "s:%NAMESPACE%:$namespace:g" ${domainPVOutput}
409411
sed -i -e "s:%WEBLOGIC_DOMAIN_STORAGE_PATH%:${weblogicDomainStoragePath}:g" ${domainPVOutput}
410412
sed -i -e "s:%WEBLOGIC_DOMAIN_STORAGE_RECLAIM_POLICY%:${weblogicDomainStorageReclaimPolicy}:g" ${domainPVOutput}
@@ -418,6 +420,7 @@ function createYamlFiles {
418420
cp ${domainPVCInput} ${domainPVCOutput}
419421
sed -i -e "s:%NAMESPACE%:$namespace:g" ${domainPVCOutput}
420422
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${domainPVCOutput}
423+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${domainPVCOutput}
421424
sed -i -e "s:%WEBLOGIC_DOMAIN_STORAGE_SIZE%:${weblogicDomainStorageSize}:g" ${domainPVCOutput}
422425

423426
# Generate the yaml to create the kubernetes job that will create the weblogic domain
@@ -475,8 +478,9 @@ function createYamlFiles {
475478
echo Generating ${traefikOutput}
476479
sed -i -e "s:%NAMESPACE%:$namespace:g" ${traefikOutput}
477480
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${traefikOutput}
478-
sed -i -e "s:%CLUSTER_NAME_LC%:${clusterNameLC}:g" ${traefikOutput}
481+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${traefikOutput}
479482
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${traefikOutput}
483+
sed -i -e "s:%CLUSTER_NAME_LC%:${clusterNameLC}:g" ${traefikOutput}
480484
sed -i -e "s:%LOAD_BALANCER_WEB_PORT%:$loadBalancerWebPort:g" ${traefikOutput}
481485
sed -i -e "s:%LOAD_BALANCER_DASHBOARD_PORT%:$loadBalancerDashboardPort:g" ${traefikOutput}
482486

@@ -485,6 +489,8 @@ function createYamlFiles {
485489
echo Generating ${traefikSecurityOutput}
486490
sed -i -e "s:%NAMESPACE%:$namespace:g" ${traefikSecurityOutput}
487491
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${traefikSecurityOutput}
492+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${traefikSecurityOutput}
493+
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${traefikSecurityOutput}
488494
sed -i -e "s:%CLUSTER_NAME_LC%:${clusterNameLC}:g" ${traefikSecurityOutput}
489495

490496
# Remove any "...yaml-e" files left over from running sed
@@ -527,7 +533,7 @@ function createDomainPVC {
527533
function createDomain {
528534

529535
# There is no way to re-run a kubernetes job, so first delete any prior job
530-
JOB_NAME="domain-${domainUID}-job"
536+
JOB_NAME="${domainUID}-create-weblogic-domain-job"
531537
deleteK8sObj job $JOB_NAME ${jobOutput}
532538

533539
echo Creating the domain by creating the job ${jobOutput}
@@ -540,8 +546,8 @@ function createDomain {
540546
while [ "$JOB_STATUS" != "Completed" -a $count -lt $max ] ; do
541547
sleep 30
542548
count=`expr $count + 1`
543-
JOB_STATUS=`kubectl get pods --show-all -n ${namespace} | grep "domain-${domainUID}" | awk ' { print $3; } '`
544-
JOB_INFO=`kubectl get pods --show-all -n ${namespace} | grep "domain-${domainUID}" | awk ' { print "pod", $1, "status is", $3; } '`
549+
JOB_STATUS=`kubectl get pods --show-all -n ${namespace} | grep ${JOB_NAME} | awk ' { print $3; } '`
550+
JOB_INFO=`kubectl get pods --show-all -n ${namespace} | grep ${JOB_NAME} | awk ' { print "pod", $1, "status is", $3; } '`
545551
echo "status on iteration $count of $max"
546552
echo "$JOB_INFO"
547553

@@ -559,7 +565,7 @@ function createDomain {
559565
done
560566

561567
# Confirm the job pod is status completed
562-
JOB_POD=`kubectl get pods --show-all -n ${namespace} | grep "domain-${domainUID}" | awk ' { print $1; } '`
568+
JOB_POD=`kubectl get pods --show-all -n ${namespace} | grep ${JOB_NAME} | awk ' { print $1; } '`
563569
if [ "$JOB_STATUS" != "Completed" ]; then
564570
echo The create domain job is not showing status completed after waiting 300 seconds
565571
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)