@@ -11,27 +11,26 @@ following bundle formats:
11
11
This script will ensure that all images built are loaded onto
12
12
a KinD cluster with the name specified in the arguments.
13
13
The following environment variables are required for configuring this script:
14
- - \$ CATALOG_IMG - the tag for the catalog image that contains the registry+v1 bundle.
14
+ - \$ E2E_TEST_CATALOG_V1 - the tag for the catalog image that contains the registry+v1 bundle.
15
15
- \$ REG_PKG_NAME - the name of the package for the extension that uses the registry+v1 bundle format.
16
- - \$ LOCAL_REGISTRY_HOST - hostname:port of the local docker-registry
17
16
setup.sh also takes 5 arguments.
18
17
19
18
Usage:
20
- setup.sh [OPERATOR_SDK] [CONTAINER_RUNTIME] [KUSTOMIZE] [KIND ] [KIND_CLUSTER_NAME] [NAMESPACE ]
19
+ setup.sh [OPERATOR_SDK] [CONTAINER_RUNTIME] [KUSTOMIZE] [LOCAL_REGISTRY_HOST ] [CLUSTER_REGISTRY_HOST ]
21
20
"
22
21
23
22
# #######################################
24
23
# Input validation
25
24
# #######################################
26
25
27
- if [[ " $# " -ne 6 ]]; then
26
+ if [[ " $# " -ne 5 ]]; then
28
27
echo " Illegal number of arguments passed"
29
28
echo " ${help} "
30
29
exit 1
31
30
fi
32
31
33
- if [[ -z " ${CATALOG_IMG } " ]]; then
34
- echo " \$ CATALOG_IMG is required to be set"
32
+ if [[ -z " ${E2E_TEST_CATALOG_V1 } " ]]; then
33
+ echo " \$ E2E_TEST_CATALOG_V1 is required to be set"
35
34
echo " ${help} "
36
35
exit 1
37
36
fi
@@ -42,12 +41,6 @@ if [[ -z "${REG_PKG_NAME}" ]]; then
42
41
exit 1
43
42
fi
44
43
45
- if [[ -z " ${LOCAL_REGISTRY_HOST} " ]]; then
46
- echo " \$ LOCAL_REGISTRY_HOST is required to be set"
47
- echo " ${help} "
48
- exit 1
49
- fi
50
-
51
44
# #######################################
52
45
# Setup temp dir and local variables
53
46
# #######################################
@@ -64,15 +57,25 @@ mkdir -p "${REG_DIR}"
64
57
operator_sdk=$1
65
58
container_tool=$2
66
59
kustomize=$3
67
- kind=$4
68
- kcluster_name=$5
69
- namespace=$6
60
+ # The path we use to push the image from _outside_ the cluster
61
+ local_registry_host=$4
62
+ # The path we use _inside_ the cluster
63
+ cluster_registry_host=$5
64
+
65
+ tls_flag=" "
66
+ if [[ " $container_tool " == " podman" ]]; then
67
+ echo " Using podman container runtime; adding tls disable flag"
68
+ tls_flag=" --tls-verify=false"
69
+ fi
70
+
71
+ catalog_push_tag=" ${local_registry_host} /${E2E_TEST_CATALOG_V1} "
72
+ reg_pkg_name=" ${REG_PKG_NAME} "
70
73
71
74
reg_img=" ${DOMAIN} /registry:v0.0.1"
72
- reg_bundle_img= " ${LOCAL_REGISTRY_HOST} / bundles/registry-v1/registry-bundle:v0.0.1"
75
+ reg_bundle_path= " bundles/registry-v1/registry-bundle:v0.0.1"
73
76
74
- catalog_img =" ${CATALOG_IMG } "
75
- reg_pkg_name =" ${REG_PKG_NAME } "
77
+ reg_bundle_img =" ${cluster_registry_host} / ${reg_bundle_path }"
78
+ reg_bundle_push_tag =" ${local_registry_host} / ${reg_bundle_path }"
76
79
77
80
# #######################################
78
81
# Create the registry+v1 based extension
@@ -84,7 +87,7 @@ reg_pkg_name="${REG_PKG_NAME}"
84
87
# NOTE: This is a rough edge that users will experience
85
88
86
89
# The Makefile in the project scaffolded by operator-sdk uses an SDK binary
87
- # in the path path if it is present. Override via `export` to ensure we use
90
+ # in the path if it is present. Override via `export` to ensure we use
88
91
# the same version that we scaffolded with.
89
92
# NOTE: this is a rough edge that users will experience
90
93
@@ -102,7 +105,8 @@ reg_pkg_name="${REG_PKG_NAME}"
102
105
make docker-build IMG=" ${reg_img} " && \
103
106
sed -i -e ' s/$(OPERATOR_SDK) generate kustomize manifests -q/$(OPERATOR_SDK) generate kustomize manifests -q --interactive=false/g' Makefile && \
104
107
make bundle IMG=" ${reg_img} " VERSION=0.0.1 && \
105
- make bundle-build BUNDLE_IMG=" ${reg_bundle_img} "
108
+ make bundle-build BUNDLE_IMG=" ${reg_bundle_push_tag} "
109
+ ${container_tool} push ${reg_bundle_push_tag} ${tls_flag}
106
110
)
107
111
108
112
# ##############################
@@ -149,107 +153,5 @@ cat <<EOF > "${TMP_ROOT}"/catalog/index.yaml
149
153
}
150
154
EOF
151
155
152
- # Add a .indexignore to make catalogd ignore
153
- # reading the symlinked ..* files that are created when
154
- # mounting a ConfigMap
155
- cat << EOF > "${TMP_ROOT} "/catalog/.indexignore
156
- ..*
157
- EOF
158
-
159
- kubectl create configmap -n " ${namespace} " --from-file=" ${TMP_ROOT} " /catalog.Dockerfile extension-dev-e2e.dockerfile
160
- kubectl create configmap -n " ${namespace} " --from-file=" ${TMP_ROOT} " /catalog extension-dev-e2e.build-contents
161
-
162
- kubectl apply -f - << EOF
163
- apiVersion: batch/v1
164
- kind: Job
165
- metadata:
166
- name: kaniko
167
- namespace: "${namespace} "
168
- spec:
169
- template:
170
- spec:
171
- containers:
172
- - name: kaniko
173
- image: gcr.io/kaniko-project/executor:latest
174
- args: ["--dockerfile=/workspace/catalog.Dockerfile",
175
- "--context=/workspace/",
176
- "--destination=${catalog_img} ",
177
- "--skip-tls-verify"]
178
- volumeMounts:
179
- - name: dockerfile
180
- mountPath: /workspace/
181
- - name: build-contents
182
- mountPath: /workspace/catalog/
183
- restartPolicy: Never
184
- volumes:
185
- - name: dockerfile
186
- configMap:
187
- name: extension-dev-e2e.dockerfile
188
- items:
189
- - key: catalog.Dockerfile
190
- path: catalog.Dockerfile
191
- - name: build-contents
192
- configMap:
193
- name: extension-dev-e2e.build-contents
194
- EOF
195
-
196
- kubectl wait --for=condition=Complete -n " ${namespace} " jobs/kaniko --timeout=60s
197
-
198
- # Make sure all files are removable. This is necessary because
199
- # the Makefiles generated by the Operator-SDK have targets
200
- # that install binaries under the bin/ directory. Those binaries
201
- # don't have write permissions so they can't be removed unless
202
- # we ensure they have the write permissions
203
- chmod -R +w " ${REG_DIR} /bin"
204
-
205
- # Load the bundle image into the docker-registry
206
-
207
- kubectl create configmap -n " ${namespace} " --from-file=" ${REG_DIR} /bundle.Dockerfile" operator-controller-e2e-${reg_pkg_name} .root
208
-
209
- tgz=" ${REG_DIR} /manifests.tgz"
210
- tar czf " ${tgz} " -C " ${REG_DIR} " bundle
211
- kubectl create configmap -n " ${namespace} " --from-file=" ${tgz} " operator-controller-${reg_pkg_name} .manifests
212
-
213
- kubectl apply -f - << EOF
214
- apiVersion: batch/v1
215
- kind: Job
216
- metadata:
217
- name: "kaniko-${reg_pkg_name} "
218
- namespace: "${namespace} "
219
- spec:
220
- template:
221
- spec:
222
- initContainers:
223
- - name: copy-manifests
224
- image: busybox
225
- command: ['sh', '-c', 'cp /manifests-data/* /manifests']
226
- volumeMounts:
227
- - name: manifests
228
- mountPath: /manifests
229
- - name: manifests-data
230
- mountPath: /manifests-data
231
- containers:
232
- - name: kaniko
233
- image: gcr.io/kaniko-project/executor:latest
234
- args: ["--dockerfile=/workspace/bundle.Dockerfile",
235
- "--context=tar:///workspace/manifests/manifests.tgz",
236
- "--destination=${reg_bundle_img} ",
237
- "--skip-tls-verify"]
238
- volumeMounts:
239
- - name: dockerfile
240
- mountPath: /workspace/
241
- - name: manifests
242
- mountPath: /workspace/manifests/
243
- restartPolicy: Never
244
- volumes:
245
- - name: dockerfile
246
- configMap:
247
- name: operator-controller-e2e-${reg_pkg_name} .root
248
- - name: manifests
249
- emptyDir: {}
250
- - name: manifests-data
251
- configMap:
252
- name: operator-controller-${reg_pkg_name} .manifests
253
- EOF
254
-
255
- kubectl wait --for=condition=Complete -n " ${namespace} " jobs/kaniko-${reg_pkg_name} --timeout=60s
156
+ ${container_tool} build -f " ${TMP_ROOT} /catalog.Dockerfile" -t " ${catalog_push_tag} " " ${TMP_ROOT} /"
157
+ ${container_tool} push ${catalog_push_tag} ${tls_flag}
0 commit comments