Skip to content

Commit 1f2cc98

Browse files
committed
use pvc name for ls, imagepullpolicy for operator
1 parent 90ce644 commit 1f2cc98

File tree

4 files changed

+51
-26
lines changed

4 files changed

+51
-26
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,10 @@ public void createDomainOnExistingDirectory() throws Exception {
644644
+ domainMap.get("persistentVolumeClaimName")
645645
+ ":/pvc-"
646646
+ domainMap.get("domainUID")
647-
+ " -c \"ls -ltr "
648-
+ domainDir
647+
+ " -c \"ls -ltr /pvc-"
648+
+ domainMap.get("domainUID")
649+
+ "/domains/"
650+
+ domainMap.get("domainUID")
649651
+ "\"";
650652
logger.info("making sure the domain directory exists by running " + cmd);
651653
ExecResult result = TestUtils.exec(cmd);

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Operator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ public Map<String, Object> getOperatorMap() {
297297
}
298298

299299
public void callHelmInstall() throws Exception {
300+
String imagePullPolicy = System.getenv("IMAGE_PULL_POLICY_OPERATOR");
300301
StringBuffer cmd = new StringBuffer("cd ");
301302
cmd.append(BaseTest.getProjectRoot())
302303
.append(" && helm install kubernetes/charts/weblogic-operator ");
@@ -306,7 +307,9 @@ public void callHelmInstall() throws Exception {
306307
.append(generatedInputYamlFile)
307308
.append(" --namespace ")
308309
.append(operatorNS)
309-
.append(" --set \"imagePullPolicy=Always\" --wait --timeout 60");
310+
.append(" --set \"imagePullPolicy=")
311+
.append(imagePullPolicy)
312+
.append("\" --wait --timeout 60");
310313
logger.info("Running " + cmd);
311314
ExecResult result = ExecCommand.exec(cmd.toString());
312315
if (result.exitValue() != 0) {

integration-tests/src/test/resources/build_push_operator_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
function build_push_operator_image {
77
if [ -z "$REPO_REGISTRY" ] || [ -z "$REPO_USERNAME" ] || [ -z "$REPO_PASSWORD" ]; then
8-
echo "Provide Docker login details using REPO_REGISTRY, REPO_USERNAME & REPO_PASSWORD env variables to push the Operator image to the repository.
8+
echo "Provide Docker login details using REPO_REGISTRY, REPO_USERNAME & REPO_PASSWORD env variables to push the Operator image to the repository."
99
exit 1
1010
fi
1111

integration-tests/src/test/resources/setupenv.sh

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ if [ -z "$BRANCH_NAME" ]; then
207207
fi
208208
export IMAGE_TAG_OPERATOR=${IMAGE_TAG_OPERATOR:-`echo "test_${BRANCH_NAME}" | sed "s#/#_#g"`}
209209
export IMAGE_NAME_OPERATOR=${IMAGE_NAME_OPERATOR:-weblogic-kubernetes-operator}
210+
export IMAGE_PULL_POLICY_OPERATOR=${IMAGE_PULL_POLICY_OPERATOR:-Always}
211+
export IMAGE_PULL_SECRET_OPERATOR=${IMAGE_PULL_SECRET_OPERATOR:-ocir-operator}
210212

211213
cd $PROJECT_ROOT
212214
if [ $? -ne 0 ]; then
@@ -217,7 +219,6 @@ fi
217219
export JAR_VERSION="`grep -m1 "<version>" pom.xml | cut -f2 -d">" | cut -f1 -d "<"`"
218220

219221
echo IMAGE_NAME_OPERATOR $IMAGE_NAME_OPERATOR IMAGE_TAG_OPERATOR $IMAGE_TAG_OPERATOR JAR_VERSION $JAR_VERSION
220-
221222

222223
if [ "$SHARED_CLUSTER" = "true" ]; then
223224

@@ -228,37 +229,56 @@ if [ "$SHARED_CLUSTER" = "true" ]; then
228229
if [ "$JRF_ENABLED" = true ] ; then
229230
pull_tag_images_jrf
230231
else
232+
export IMAGE_PULL_SECRET_OPERATOR=$IMAGE_PULL_SECRET_OPERATOR
233+
export IMAGE_PULL_SECRET_WEBLOGIC=$IMAGE_PULL_SECRET_WEBLOGIC
234+
235+
236+
if [ "$IMAGE_PULL_POLICY_OPERATOR" = "Always" ]; then
237+
if [ -z "$REPO_REGISTRY" ] || [ -z "$REPO_USERNAME" ] || [ -z "$REPO_PASSWORD" ] || [ -z "$REPO_EMAIL" ]; then
238+
echo "Provide Docker login details using REPO_REGISTRY, REPO_USERNAME, REPO_PASSWORD & REPO_EMAIL env variables to push the Operator image to the repository."
239+
exit 1
240+
fi
241+
242+
echo "Creating Registry Secret"
243+
kubectl create secret docker-registry $IMAGE_PULL_SECRET_OPERATOR \
244+
--docker-server=$REPO_REGISTRY \
245+
--docker-username=$REPO_USERNAME \
246+
--docker-password=$REPO_PASSWORD \
247+
--docker-email=$REPO_EMAIL
231248

232-
export IMAGE_PULL_SECRET_OPERATOR=$IMAGE_PULL_SECRET_OPERATOR
233-
export IMAGE_PULL_SECRET_WEBLOGIC=$IMAGE_PULL_SECRET_WEBLOGIC
249+
echo "Checking Secret"
250+
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_OPERATOR | grep $IMAGE_PULL_SECRET_OPERATOR | wc | awk ' { print $1; }'`"
251+
if [ "$SECRET" != "1" ]; then
252+
echo "secret $IMAGE_PULL_SECRET_OPERATOR was not created successfully"
253+
exit 1
254+
fi
255+
fi
256+
257+
if [ -z "$DOCKER_USERNAME" ] || [ -z "$DOCKER_PASSWORD" ] || [ -z "$DOCKER_EMAIL" ]; then
258+
echo "Provide Docker login details using DOCKER_USERNAME, DOCKER_PASSWORD & DOCKER_EMAIL env variables to push the Operator image to the repository."
259+
exit 1
260+
fi
234261

235-
echo "Creating Docker Secret"
262+
echo "Creating Docker Secret"
236263
kubectl create secret docker-registry $IMAGE_PULL_SECRET_WEBLOGIC \
237264
--docker-server=index.docker.io/v1/ \
238265
--docker-username=$DOCKER_USERNAME \
239266
--docker-password=$DOCKER_PASSWORD \
240267
--docker-email=$DOCKER_EMAIL
241268

242-
echo "Checking Secret"
243-
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_WEBLOGIC | grep $IMAGE_PULL_SECRET_WEBLOGIC | wc | awk ' { print $1; }'`"
244-
if [ "$SECRET" != "1" ]; then
245-
echo "secret $IMAGE_PULL_SECRET_WEBLOGIC was not created successfully"
269+
echo "Checking Secret"
270+
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_WEBLOGIC | grep $IMAGE_PULL_SECRET_WEBLOGIC | wc | awk ' { print $1; }'`"
271+
if [ "$SECRET" != "1" ]; then
272+
echo "secret $IMAGE_PULL_SECRET_WEBLOGIC was not created successfully"
246273
exit 1
247-
fi
248-
249-
echo "Creating Registry Secret"
250-
kubectl create secret docker-registry $IMAGE_PULL_SECRET_OPERATOR \
251-
--docker-server=$REPO_REGISTRY \
252-
--docker-username=$REPO_USERNAME \
253-
--docker-password=$REPO_PASSWORD \
254-
--docker-email=$REPO_EMAIL
274+
fi
275+
276+
if [ -z "$K8S_NODEPORT_HOST" ]; then
277+
echo "When running in shared cluster option, provide DNS name or IP of a Kubernetes worker node using K8S_NODEPORT_HOST env variable"
278+
exit 1
279+
fi
280+
255281

256-
echo "Checking Secret"
257-
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_OPERATOR | grep $IMAGE_PULL_SECRET_OPERATOR | wc | awk ' { print $1; }'`"
258-
if [ "$SECRET" != "1" ]; then
259-
echo "secret $IMAGE_PULL_SECRET_OPERATOR was not created successfully"
260-
exit 1
261-
fi
262282
fi
263283
setup_shared_cluster
264284
get_wlthint3client_from_image

0 commit comments

Comments
 (0)