@@ -73,48 +73,24 @@ if [ "${missingRequiredOption}" == "true" ]; then
73
73
usage 1
74
74
fi
75
75
76
- #
77
- # Function to validate the domain secret
78
- #
79
- function validateDomainSecret {
80
- # Verify the secret exists
81
- local SECRET=` kubectl get secret ${secretName} -n ${namespace} | grep ${secretName} | wc | awk ' { print $1; }' `
82
- if [ " ${SECRET} " != " 1" ]; then
83
- fail " The secret ${secretName} was not found in namespace ${namespace} "
84
- fi
85
-
86
- # Verify the secret contains a username
87
- SECRET=` kubectl get secret ${secretName} -n ${namespace} -o jsonpath=' {.data}' | grep username: | wc | awk ' { print $1; }' `
88
- if [ " ${SECRET} " != " 1" ]; then
89
- fail " The domain secret ${secretName} in namespace ${namespace} does contain a username"
90
- fi
91
-
92
- # Verify the secret contains a password
93
- SECRET=` kubectl get secret ${secretName} -n ${namespace} -o jsonpath=' {.data}' | grep password: | wc | awk ' { print $1; }' `
94
- if [ " ${SECRET} " != " 1" ]; then
95
- fail " The domain secret ${secretName} in namespace ${namespace} does contain a password"
96
- fi
97
- echo " The secret ${secretName} has been successfully created in namespace ${namespace} "
98
- }
99
-
100
- #
101
- # Perform the following sequence of steps to create a domain
102
- #
103
-
76
+ # check and see if the secret already exists
104
77
result=` kubectl get secret ${secretName} -n ${namespace} --ignore-not-found=true | grep ${secretName} | wc | awk ' { print $1; }' `
105
78
if [ " ${result:= Error} " != " 0" ]; then
106
79
fail " The secret ${secretName} already exists in namespace ${namespace} ."
107
80
fi
108
81
82
+ # create the secret
109
83
kubectl -n $namespace create secret generic $secretName \
110
84
--from-literal=username=$username \
111
85
--from-literal=password=$password
112
86
87
+ # label the secret with domainUID
113
88
kubectl label secret ${secretName} -n $namespace weblogic.domainUID=$domainUID weblogic.domainName=$domainUID
114
89
115
- validateDomainSecret
116
-
117
- echo
118
- echo Completed
119
-
90
+ # Verify the secret exists
91
+ SECRET= ` kubectl get secret ${secretName} -n ${namespace} | grep ${secretName} | wc | awk ' { print $1; } ' `
92
+ if [ " ${SECRET} " != " 1 " ] ; then
93
+ fail " The secret ${secretName} was not found in namespace ${namespace} "
94
+ fi
120
95
96
+ echo " The secret ${secretName} has been successfully created in namespace ${namespace} "
0 commit comments