Skip to content

Commit 9726b2a

Browse files
committed
Merge remote-tracking branch 'origin/develop' into fix-take9
2 parents 51508df + 0c5f6ed commit 9726b2a

File tree

117 files changed

+7837
-2617
lines changed

Some content is hidden

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

117 files changed

+7837
-2617
lines changed

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

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,48 @@ private void callHelmInstall() throws Exception {
202202
logger.info("Running " + cmd);
203203
ExecResult result = ExecCommand.exec(cmd.toString());
204204
if (result.exitValue() != 0) {
205-
throw new RuntimeException(
206-
"FAILURE: command "
207-
+ cmd
208-
+ " failed, returned "
209-
+ result.stdout()
210-
+ "\n"
211-
+ result.stderr());
205+
reportHelmInstallFailure(cmd.toString(), result);
212206
}
213207
String outputStr = result.stdout().trim();
214208
logger.info("Command returned " + outputStr);
215209
}
216210

211+
private void reportHelmInstallFailure(String cmd, ExecResult result) throws Exception {
212+
String cause = getExecFailure(cmd, result);
213+
if (result.stderr().contains("Error: Job failed: BackoffLimitExceeded")) {
214+
// The operator helm chart pre-install hook probably failed.
215+
// This is probably because there is a problem with the values passed in,
216+
// for example a listed domain namespace does not exist.
217+
// Fetch the pre-install hook's results and return it too.
218+
String hookResults = getOperatorHelmChartHookResults("pre-install");
219+
cause = cause + "\n pre-install-hook returned\n" + hookResults;
220+
}
221+
throw new RuntimeException(cause);
222+
}
223+
224+
private String getOperatorHelmChartHookResults(String hookType) throws Exception {
225+
String cmd =
226+
"kubectl logs job/"
227+
+ operatorMap.get("releaseName")
228+
+ "-weblogic-operator-"
229+
+ hookType
230+
+ "-hook -n kube-system";
231+
ExecResult result = ExecCommand.exec(cmd);
232+
if (result.exitValue() != 0) {
233+
return getExecFailure(cmd, result);
234+
}
235+
return result.stdout();
236+
}
237+
238+
private String getExecFailure(String cmd, ExecResult result) throws Exception {
239+
return "FAILURE: command "
240+
+ cmd
241+
+ " failed, stdout:\n"
242+
+ result.stdout()
243+
+ "stderr:\n"
244+
+ result.stderr();
245+
}
246+
217247
private void generateInputYaml() throws Exception {
218248
Path parentDir =
219249
Files.createDirectories(Paths.get(userProjectsDir + "/weblogic-operators/" + operatorNS));

integration-tests/src/test/resources/operator1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ serviceAccount: weblogic-operator
77
namespace: weblogic-operator1
88
domainNamespaces: [ "default", "test1" ]
99
externalRestEnabled: true
10-
javaLoggingLevel: FINE
10+
javaLoggingLevel: FINE

integration-tests/src/test/resources/operator2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ namespace: weblogic-operator2
88
domainNamespaces: [ "test2" ]
99
externalRestEnabled: true
1010
externalRestHttpsPort: 32001
11-
javaLoggingLevel: FINE
11+
javaLoggingLevel: FINE

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

Lines changed: 100 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -3,98 +3,95 @@
33
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
44

55
function clean_jenkins {
6-
echo "Cleaning."
7-
/usr/local/packages/aime/ias/run_as_root "${PROJECT_ROOT}/src/integration-tests/bash/clean_docker_k8s.sh -y"
6+
echo "Cleaning."
7+
/usr/local/packages/aime/ias/run_as_root "${PROJECT_ROOT}/src/integration-tests/bash/clean_docker_k8s.sh -y"
88
}
99

1010
function setup_jenkins {
11-
echo "Setting up."
12-
/usr/local/packages/aime/ias/run_as_root "sh ${PROJECT_ROOT}/src/integration-tests/bash/install_docker_k8s.sh -y -u wls -v ${K8S_VERSION}"
13-
set +x
14-
. ~/.dockerk8senv
15-
set -x
16-
id
17-
18-
docker login -u [email protected] -p $docker_pass wlsldi-v2.docker.oraclecorp.com
19-
docker images
20-
21-
pull_tag_images
22-
23-
export JAR_VERSION="`grep -m1 "<version>" pom.xml | cut -f2 -d">" | cut -f1 -d "<"`"
24-
# create a docker image for the operator code being tested
25-
docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy=$no_proxy -t "${IMAGE_NAME_OPERATOR}:${IMAGE_TAG_OPERATOR}" --build-arg VERSION=$JAR_VERSION --no-cache=true .
26-
docker tag "${IMAGE_NAME_OPERATOR}:${IMAGE_TAG_OPERATOR}" wlsldi-v2.docker.oraclecorp.com/weblogic-operator:latest
27-
28-
docker images
11+
echo "Setting up."
12+
/usr/local/packages/aime/ias/run_as_root "sh ${PROJECT_ROOT}/src/integration-tests/bash/install_docker_k8s.sh -y -u wls -v ${K8S_VERSION}"
13+
set +x
14+
. ~/.dockerk8senv
15+
set -x
16+
id
17+
18+
docker login -u [email protected] -p $docker_pass wlsldi-v2.docker.oraclecorp.com
19+
docker images
20+
21+
pull_tag_images
22+
23+
export JAR_VERSION="`grep -m1 "<version>" pom.xml | cut -f2 -d">" | cut -f1 -d "<"`"
24+
# create a docker image for the operator code being tested
25+
docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy=$no_proxy -t "${IMAGE_NAME_OPERATOR}:${IMAGE_TAG_OPERATOR}" --build-arg VERSION=$JAR_VERSION --no-cache=true .
26+
docker tag "${IMAGE_NAME_OPERATOR}:${IMAGE_TAG_OPERATOR}" wlsldi-v2.docker.oraclecorp.com/weblogic-operator:latest
27+
28+
docker images
2929

30-
echo "Helm installation starts"
31-
wget -q -O /tmp/helm-v2.8.2-linux-amd64.tar.gz https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-linux-amd64.tar.gz
32-
mkdir /tmp/helm
33-
tar xzf /tmp/helm-v2.8.2-linux-amd64.tar.gz -C /tmp/helm
34-
chmod +x /tmp/helm/linux-amd64/helm
35-
/usr/local/packages/aime/ias/run_as_root "cp /tmp/helm/linux-amd64/helm /usr/bin/"
36-
rm -rf /tmp/helm
37-
helm init
38-
echo "Helm is configured."
30+
echo "Helm installation starts"
31+
wget -q -O /tmp/helm-v2.8.2-linux-amd64.tar.gz https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-linux-amd64.tar.gz
32+
mkdir /tmp/helm
33+
tar xzf /tmp/helm-v2.8.2-linux-amd64.tar.gz -C /tmp/helm
34+
chmod +x /tmp/helm/linux-amd64/helm
35+
/usr/local/packages/aime/ias/run_as_root "cp /tmp/helm/linux-amd64/helm /usr/bin/"
36+
rm -rf /tmp/helm
37+
helm init
38+
echo "Helm is configured."
3939
}
4040

4141
function setup_wercker {
42-
echo "Perform setup for running in wercker"
43-
echo "Install tiller"
44-
kubectl create serviceaccount --namespace kube-system tiller
45-
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
46-
47-
# Note: helm init --wait would wait until tiller is ready, and requires helm 2.8.2 or above
48-
helm init --service-account=tiller --wait
49-
50-
helm version
51-
52-
kubectl get po -n kube-system
53-
54-
echo "Existing helm charts "
55-
helm ls
56-
echo "Deleting installed helm charts"
57-
helm list --short | xargs -L1 helm delete --purge
58-
echo "After helm delete, list of installed helm charts is: "
59-
helm ls
60-
61-
echo "Completed setup_wercker"
42+
echo "Perform setup for running in wercker"
43+
echo "Install tiller"
44+
kubectl create serviceaccount --namespace kube-system tiller
45+
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
46+
47+
# Note: helm init --wait would wait until tiller is ready, and requires helm 2.8.2 or above
48+
helm init --service-account=tiller --wait
49+
50+
helm version
51+
52+
kubectl get po -n kube-system
53+
54+
echo "Existing helm charts "
55+
helm ls
56+
echo "Deleting installed helm charts"
57+
helm list --short | xargs -L1 helm delete --purge
58+
echo "After helm delete, list of installed helm charts is: "
59+
helm ls
60+
61+
echo "Completed setup_wercker"
6262
}
6363

6464
function pull_tag_images {
65+
echo "Pull and tag the images we need"
6566

66-
echo "Pull and tag the images we need"
67-
docker pull wlsldi-v2.docker.oraclecorp.com/store-weblogic-12.2.1.3:latest
68-
docker tag wlsldi-v2.docker.oraclecorp.com/store-weblogic-12.2.1.3:latest store/oracle/weblogic:12.2.1.3
69-
70-
docker pull wlsldi-v2.docker.oraclecorp.com/weblogic:19.1.0.0
71-
docker tag wlsldi-v2.docker.oraclecorp.com/weblogic:19.1.0.0 store/oracle/weblogic:19.1.0.0
67+
docker pull wlsldi-v2.docker.oraclecorp.com/store-weblogic-12.2.1.3:latest
68+
docker tag wlsldi-v2.docker.oraclecorp.com/store-weblogic-12.2.1.3:latest store/oracle/weblogic:12.2.1.3
7269

73-
docker pull wlsldi-v2.docker.oraclecorp.com/store-serverjre-8:latest
74-
docker tag wlsldi-v2.docker.oraclecorp.com/store-serverjre-8:latest store/oracle/serverjre:8
70+
docker pull wlsldi-v2.docker.oraclecorp.com/weblogic:19.1.0.0
71+
docker tag wlsldi-v2.docker.oraclecorp.com/weblogic:19.1.0.0 store/oracle/weblogic:19.1.0.0
7572

76-
docker pull wlsldi-v2.docker.oraclecorp.com/weblogic-webtier-apache-12.2.1.3.0:latest
77-
docker tag wlsldi-v2.docker.oraclecorp.com/weblogic-webtier-apache-12.2.1.3.0:latest store/oracle/apache:12.2.1.3
73+
docker pull wlsldi-v2.docker.oraclecorp.com/store-serverjre-8:latest
74+
docker tag wlsldi-v2.docker.oraclecorp.com/store-serverjre-8:latest store/oracle/serverjre:8
7875

76+
docker pull wlsldi-v2.docker.oraclecorp.com/weblogic-webtier-apache-12.2.1.3.0:latest
77+
docker tag wlsldi-v2.docker.oraclecorp.com/weblogic-webtier-apache-12.2.1.3.0:latest store/oracle/apache:12.2.1.3
7978
}
8079

8180

8281
function create_image_pull_secret_jenkins {
83-
84-
echo "Creating Secret"
85-
kubectl create secret docker-registry wlsldi-secret \
82+
echo "Creating Secret"
83+
kubectl create secret docker-registry wlsldi-secret \
8684
--docker-server=wlsldi-v2.docker.oraclecorp.com \
8785
8886
--docker-password=$docker_pass \
8987
9088

91-
echo "Checking Secret"
92-
local SECRET="`kubectl get secret wlsldi-secret | grep wlsldi | wc | awk ' { print $1; }'`"
93-
if [ "$SECRET" != "1" ]; then
94-
echo 'secret wlsldi-secret was not created successfully'
95-
exit 1
96-
fi
97-
89+
echo "Checking Secret"
90+
local SECRET="`kubectl get secret wlsldi-secret | grep wlsldi | wc | awk ' { print $1; }'`"
91+
if [ "$SECRET" != "1" ]; then
92+
echo 'secret wlsldi-secret was not created successfully'
93+
exit 1
94+
fi
9895
}
9996

10097
export SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
@@ -103,21 +100,23 @@ export RESULT_ROOT=${RESULT_ROOT:-/scratch/$USER/wl_k8s_test_results}
103100
export PV_ROOT=${PV_ROOT:-$RESULT_ROOT}
104101
echo "RESULT_ROOT$RESULT_ROOT PV_ROOT$PV_ROOT"
105102
export BRANCH_NAME="${BRANCH_NAME:-$WERCKER_GIT_BRANCH}"
103+
export IMAGE_NAME_WEBLOGIC="${IMAGE_NAME_WEBLOGIC:-store/oracle/weblogic}"
104+
export IMAGE_TAG_WEBLOGIC="${IMAGE_TAG_WEBLOGIC:-19.1.0.0}"
106105

107106
if [ -z "$BRANCH_NAME" ]; then
108107
export BRANCH_NAME="`git branch | grep \* | cut -d ' ' -f2-`"
109108
if [ ! "$?" = "0" ] ; then
110-
echo "Error: Could not determine branch. Run script from within a git repo".
111-
exit 1
109+
echo "Error: Could not determine branch. Run script from within a git repo".
110+
exit 1
112111
fi
113112
fi
114113
export IMAGE_TAG_OPERATOR=${IMAGE_TAG_OPERATOR:-`echo "test_${BRANCH_NAME}" | sed "s#/#_#g"`}
115114
export IMAGE_NAME_OPERATOR=${IMAGE_NAME_OPERATOR:-wlsldi-v2.docker.oraclecorp.com/weblogic-operator}
116115

117116
cd $PROJECT_ROOT
118117
if [ $? -ne 0 ]; then
119-
echo "Couldn't change to $PROJECT_ROOT dir"
120-
exit 1
118+
echo "Couldn't change to $PROJECT_ROOT dir"
119+
exit 1
121120
fi
122121

123122
export JAR_VERSION="`grep -m1 "<version>" pom.xml | cut -f2 -d">" | cut -f1 -d "<"`"
@@ -126,40 +125,40 @@ echo IMAGE_NAME_OPERATOR $IMAGE_NAME_OPERATOR IMAGE_TAG_OPERATOR $IMAGE_TAG_OPER
126125

127126
if [ "$WERCKER" = "true" ]; then
128127

129-
echo "Test Suite is running locally on Wercker and k8s is running on remote nodes."
128+
echo "Test Suite is running locally on Wercker and k8s is running on remote nodes."
130129

131-
export IMAGE_PULL_SECRET_OPERATOR=$IMAGE_PULL_SECRET_OPERATOR
132-
export IMAGE_PULL_SECRET_WEBLOGIC=$IMAGE_PULL_SECRET_WEBLOGIC
130+
export IMAGE_PULL_SECRET_OPERATOR=$IMAGE_PULL_SECRET_OPERATOR
131+
export IMAGE_PULL_SECRET_WEBLOGIC=$IMAGE_PULL_SECRET_WEBLOGIC
133132

134-
echo "Creating Docker Secret"
135-
kubectl create secret docker-registry $IMAGE_PULL_SECRET_WEBLOGIC \
133+
echo "Creating Docker Secret"
134+
kubectl create secret docker-registry $IMAGE_PULL_SECRET_WEBLOGIC \
136135
--docker-server=index.docker.io/v1/ \
137136
--docker-username=$DOCKER_USERNAME \
138137
--docker-password=$DOCKER_PASSWORD \
139138
--docker-email=$DOCKER_EMAIL
140139

141-
echo "Checking Secret"
142-
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_WEBLOGIC | grep $IMAGE_PULL_SECRET_WEBLOGIC | wc | awk ' { print $1; }'`"
143-
if [ "$SECRET" != "1" ]; then
144-
echo "secret $IMAGE_PULL_SECRET_WEBLOGIC was not created successfully"
145-
exit 1
146-
fi
140+
echo "Checking Secret"
141+
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_WEBLOGIC | grep $IMAGE_PULL_SECRET_WEBLOGIC | wc | awk ' { print $1; }'`"
142+
if [ "$SECRET" != "1" ]; then
143+
echo "secret $IMAGE_PULL_SECRET_WEBLOGIC was not created successfully"
144+
exit 1
145+
fi
147146

148-
echo "Creating Registry Secret"
149-
kubectl create secret docker-registry $IMAGE_PULL_SECRET_OPERATOR \
147+
echo "Creating Registry Secret"
148+
kubectl create secret docker-registry $IMAGE_PULL_SECRET_OPERATOR \
150149
--docker-server=$REPO_REGISTRY \
151150
--docker-username=$REPO_USERNAME \
152151
--docker-password=$REPO_PASSWORD \
153152
--docker-email=$REPO_EMAIL
154153

155-
echo "Checking Secret"
156-
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_OPERATOR | grep $IMAGE_PULL_SECRET_OPERATOR | wc | awk ' { print $1; }'`"
157-
if [ "$SECRET" != "1" ]; then
158-
echo "secret $IMAGE_PULL_SECRET_OPERATOR was not created successfully"
159-
exit 1
160-
fi
161-
162-
setup_wercker
154+
echo "Checking Secret"
155+
SECRET="`kubectl get secret $IMAGE_PULL_SECRET_OPERATOR | grep $IMAGE_PULL_SECRET_OPERATOR | wc | awk ' { print $1; }'`"
156+
if [ "$SECRET" != "1" ]; then
157+
echo "secret $IMAGE_PULL_SECRET_OPERATOR was not created successfully"
158+
exit 1
159+
fi
160+
161+
setup_wercker
163162

164163
elif [ "$JENKINS" = "true" ]; then
165164

@@ -194,18 +193,14 @@ elif [ "$JENKINS" = "true" ]; then
194193
/usr/local/packages/aime/ias/run_as_root "mkdir -p $PV_ROOT/acceptance_test_pv_archive"
195194
/usr/local/packages/aime/ias/run_as_root "chmod 777 $PV_ROOT/acceptance_test_pv_archive"
196195

197-
198-
199196
else
200-
pull_tag_images
201-
202-
#docker rmi -f $(docker images -q -f dangling=true)
203-
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi -f
204-
205-
docker images
197+
pull_tag_images
198+
199+
#docker rmi -f $(docker images -q -f dangling=true)
200+
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi -f
201+
202+
docker images
206203

207204
export JAR_VERSION="`grep -m1 "<version>" pom.xml | cut -f2 -d">" | cut -f1 -d "<"`"
208-
docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy=$no_proxy -t "${IMAGE_NAME_OPERATOR}:${IMAGE_TAG_OPERATOR}" --build-arg VERSION=$JAR_VERSION --no-cache=true .
209-
205+
docker build --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy --build-arg no_proxy=$no_proxy -t "${IMAGE_NAME_OPERATOR}:${IMAGE_TAG_OPERATOR}" --build-arg VERSION=$JAR_VERSION --no-cache=true .
210206
fi
211-

kubernetes/charts/weblogic-operator/templates/_operator-dep.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ spec:
4343
volumeMounts:
4444
- name: "weblogic-operator-cm-volume"
4545
mountPath: "/operator/config"
46+
- name: "weblogic-operator-debug-cm-volume"
47+
mountPath: "/operator/debug-config"
4648
- name: "weblogic-operator-secrets-volume"
4749
mountPath: "/operator/secrets"
4850
readOnly: true
@@ -79,6 +81,10 @@ spec:
7981
- name: "weblogic-operator-cm-volume"
8082
configMap:
8183
name: "weblogic-operator-cm"
84+
- name: "weblogic-operator-debug-cm-volume"
85+
configMap:
86+
name: "weblogic-operator-debug-cm"
87+
optional: true
8288
- name: "weblogic-operator-secrets-volume"
8389
secret:
8490
secretName: "weblogic-operator-secrets"

0 commit comments

Comments
 (0)