@@ -31,7 +31,7 @@ export LOG_LEVEL=${TEST_LOG_LEVEL:-2}
31
31
export CLEANUP_CLUSTER=${CLEANUP_CLUSTER:- " true" }
32
32
export CLUSTER_CONTEXT=" --name test"
33
33
# Using older image due to older version of kubernetes cluster"
34
- export IMAGE_ECHOSERVER=" kicbase /echo-server:1.0"
34
+ export IMAGE_ECHOSERVER=" quay.io/project-codeflare /echo-server:1.0"
35
35
export IMAGE_UBUNTU_LATEST=" ubuntu:latest"
36
36
export IMAGE_UBI_LATEST=" registry.access.redhat.com/ubi8/ubi:latest"
37
37
export IMAGE_BUSY_BOX_LATEST=" k8s.gcr.io/busybox:latest"
@@ -49,7 +49,7 @@ export KUTTL_TEST_SUITES=("${ROOT_DIR}/test/kuttl-test.yaml" "${ROOT_DIR}/test/k
49
49
DUMP_LOGS=" true"
50
50
51
51
function update_test_host {
52
-
52
+
53
53
local arch=" $( go env GOARCH) "
54
54
if [ -z $arch ]
55
55
then
@@ -67,43 +67,43 @@ function update_test_host {
67
67
68
68
which kubectl > /dev/null 2>&1
69
69
if [ $? -ne 0 ]
70
- then
70
+ then
71
71
sudo apt-get install -y --allow-unauthenticated kubectl
72
- [ $? -ne 0 ] && echo " Failed to install kubectl" && exit 1
73
- echo " kubectl was sucessfully installed."
74
- fi
75
-
72
+ [ $? -ne 0 ] && echo " Failed to install kubectl" && exit 1
73
+ echo " kubectl was sucessfully installed."
74
+ fi
75
+
76
76
which kind > /dev/null 2>&1
77
- if [ $? -ne 0 ]
77
+ if [ $? -ne 0 ]
78
78
then
79
79
# Download kind binary (0.20.0)
80
80
echo " Downloading and installing kind...."
81
81
sudo curl -o /usr/local/bin/kind -L https://github.com/kubernetes-sigs/kind/releases/download/v0.20.0/kind-linux-${arch} && \
82
- sudo chmod +x /usr/local/bin/kind
83
- [ $? -ne 0 ] && echo " Failed to download kind" && exit 1
84
- echo " Kind was sucessfully installed."
82
+ sudo chmod +x /usr/local/bin/kind
83
+ [ $? -ne 0 ] && echo " Failed to download kind" && exit 1
84
+ echo " Kind was sucessfully installed."
85
85
fi
86
86
87
87
which helm > /dev/null 2>&1
88
88
if [ $? -ne 0 ]
89
- then
89
+ then
90
90
# Installing helm3
91
91
echo " Downloading and installing helm..."
92
- curl -fsSL -o ${ROOT_DIR} /get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 &&
92
+ curl -fsSL -o ${ROOT_DIR} /get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 &&
93
93
chmod 700 ${ROOT_DIR} /get_helm.sh && ${ROOT_DIR} /get_helm.sh
94
94
[ $? -ne 0 ] && echo " Failed to download and install helm" && exit 1
95
95
echo " Helm was sucessfully installed."
96
96
rm -rf ${ROOT_DIR} /get_helm.sh
97
97
fi
98
-
98
+
99
99
kubectl kuttl version > /dev/null 2>&1
100
100
if [ $? -ne 0 ]
101
101
then
102
102
if [[ " $arch " == " amd64" ]]
103
- then
103
+ then
104
104
local kuttl_arch=" x86_64"
105
105
else
106
- local kuttl_arch=$arch
106
+ local kuttl_arch=$arch
107
107
fi
108
108
# Download kuttl plugin
109
109
echo " Downloading and installing kuttl...."
@@ -119,7 +119,7 @@ function update_test_host {
119
119
function check-prerequisites {
120
120
echo " checking prerequisites"
121
121
which kind > /dev/null 2>&1
122
- if [ $? -ne 0 ]
122
+ if [ $? -ne 0 ]
123
123
then
124
124
echo " kind not installed, exiting."
125
125
exit 1
@@ -133,7 +133,7 @@ function check-prerequisites {
133
133
echo " kubectl not installed, exiting."
134
134
exit 1
135
135
else
136
- echo -n " found kubectl, " && kubectl version
136
+ echo -n " found kubectl, " && kubectl version
137
137
fi
138
138
kubectl kuttl version > /dev/null 2>&1
139
139
if [ $? -ne 0 ]
@@ -143,7 +143,7 @@ function check-prerequisites {
143
143
else
144
144
echo -n " found kuttl plugin for kubectl, " && kubectl kuttl version
145
145
fi
146
-
146
+
147
147
if [[ $IMAGE_REPOSITORY_MCAD == " " ]]
148
148
then
149
149
echo " No MCAD image was provided."
@@ -155,25 +155,25 @@ function check-prerequisites {
155
155
else
156
156
echo " end to end test with ${IMAGE_MCAD} ."
157
157
fi
158
-
158
+
159
159
which helm > /dev/null 2>&1
160
160
if [ $? -ne 0 ]
161
161
then
162
162
echo " helm not installed, exiting."
163
163
exit 1
164
164
else
165
165
echo -n " found helm, " && helm version --short
166
- fi
166
+ fi
167
+
167
168
168
-
169
169
which helm > /dev/null 2>&1
170
170
if [ $? -ne 0 ]
171
171
then
172
172
echo " helm not installed, exiting."
173
173
exit 1
174
174
else
175
175
echo -n " found helm, " && helm version --short
176
- fi
176
+ fi
177
177
178
178
}
179
179
@@ -193,7 +193,7 @@ function kind-up-cluster {
193
193
fi
194
194
CLUSTER_STARTED=" true"
195
195
196
- docker pull ${IMAGE_ECHOSERVER}
196
+ docker pull ${IMAGE_ECHOSERVER}
197
197
if [ $? -ne 0 ]
198
198
then
199
199
echo " Failed to pull ${IMAGE_ECHOSERVER} "
@@ -213,14 +213,14 @@ function kind-up-cluster {
213
213
echo " Failed to pull ${IMAGE_UBI_LATEST} "
214
214
exit 1
215
215
fi
216
-
216
+
217
217
docker pull ${IMAGE_BUSY_BOX_LATEST}
218
218
if [ $? -ne 0 ]
219
219
then
220
220
echo " Failed to pull ${IMAGE_BUSY_BOX_LATEST} "
221
221
exit 1
222
222
fi
223
-
223
+
224
224
if [[ " $MCAD_IMAGE_PULL_POLICY " = " Always" ]]
225
225
then
226
226
docker pull ${IMAGE_MCAD}
@@ -245,7 +245,7 @@ function kind-up-cluster {
245
245
echo " Failed to load image ${image} in cluster"
246
246
exit 1
247
247
fi
248
- done
248
+ done
249
249
}
250
250
251
251
# clean up
@@ -256,7 +256,7 @@ function cleanup {
256
256
then
257
257
echo " Cluster was not started, nothing more to do."
258
258
return
259
- fi
259
+ fi
260
260
261
261
if [[ ${DUMP_LOGS} == " true" ]]
262
262
then
@@ -303,15 +303,15 @@ function cleanup {
303
303
kubectl logs ${mcad_pod} -n kube-system
304
304
fi
305
305
fi
306
-
306
+
307
307
rm -f kubeconfig
308
-
308
+
309
309
if [[ $CLEANUP_CLUSTER == " true" ]]
310
310
then
311
- kind delete cluster ${CLUSTER_CONTEXT}
312
- else
313
- echo " Cluster requested to stay up, not deleting cluster"
314
- fi
311
+ kind delete cluster ${CLUSTER_CONTEXT}
312
+ else
313
+ echo " Cluster requested to stay up, not deleting cluster"
314
+ fi
315
315
}
316
316
317
317
function undeploy_mcad_helm {
@@ -348,10 +348,10 @@ function mcad-up {
348
348
function setup-mcad-env {
349
349
echo " Installing Podgroup CRD"
350
350
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/scheduler-plugins/277b6bdec18f8a9e9ccd1bfeaf4b66495bfc6f92/config/crd/bases/scheduling.sigs.k8s.io_podgroups.yaml
351
-
351
+
352
352
# Turn off master taints
353
353
kubectl taint nodes --all node-role.kubernetes.io/control-plane:NoSchedule-
354
-
354
+
355
355
# This is meant to orchestrate initial cluster configuration such that accounting tests can be consistent
356
356
echo " Orchestrate cluster..."
357
357
echo " kubectl cordon test-worker"
@@ -369,7 +369,7 @@ function setup-mcad-env {
369
369
echo " Waiting for pod in the kube-system namespace to be ready to become ready"
370
370
while [[ $( kubectl get pods -n kube-system -o ' jsonpath={..status.conditions[?(@.type=="Ready")].status}' | tr ' ' ' \n' | sort -u) != " True" ]]
371
371
do
372
- echo -n " ." && sleep 1;
372
+ echo -n " ." && sleep 1;
373
373
done
374
374
}
375
375
@@ -451,15 +451,15 @@ function kuttl-tests {
451
451
then
452
452
echo " Failed to delete quotasubtrees for test: '${kuttl_test} '"
453
453
exit 1
454
- fi
454
+ fi
455
455
undeploy_mcad_helm
456
456
done
457
457
rm -f kubeconfig
458
458
}
459
459
460
460
trap cleanup EXIT
461
461
update_test_host
462
- check-prerequisites
462
+ check-prerequisites
463
463
kind-up-cluster
464
464
extend-resources
465
465
setup-mcad-env
0 commit comments