@@ -11,27 +11,26 @@ following bundle formats:
1111This script will ensure that all images built are loaded onto
1212a KinD cluster with the name specified in the arguments.
1313The 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 - the tag for the catalog image that contains the registry+v1 bundle.
1515- \$ 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
1716setup.sh also takes 5 arguments.
1817
1918Usage:
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 ]
2120"
2221
2322# #######################################
2423# Input validation
2524# #######################################
2625
27- if [[ " $# " -ne 6 ]]; then
26+ if [[ " $# " -ne 5 ]]; then
2827 echo " Illegal number of arguments passed"
2928 echo " ${help} "
3029 exit 1
3130fi
3231
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"
3534 echo " ${help} "
3635 exit 1
3736fi
@@ -42,12 +41,6 @@ if [[ -z "${REG_PKG_NAME}" ]]; then
4241 exit 1
4342fi
4443
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-
5144# #######################################
5245# Setup temp dir and local variables
5346# #######################################
@@ -64,15 +57,24 @@ mkdir -p "${REG_DIR}"
6457operator_sdk=$1
6558container_tool=$2
6659kustomize=$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+ tls_flag=" --tls-verify=false"
68+ fi
69+
70+ catalog_push_tag=" ${local_registry_host} /${E2E_TEST_CATALOG_V1} "
71+ reg_pkg_name=" ${REG_PKG_NAME} "
7072
7173reg_img=" ${DOMAIN} /registry:v0.0.1"
72- reg_bundle_img= " ${LOCAL_REGISTRY_HOST} / bundles/registry-v1/registry-bundle:v0.0.1"
74+ reg_bundle_path= " bundles/registry-v1/registry-bundle:v0.0.1"
7375
74- catalog_img =" ${CATALOG_IMG } "
75- reg_pkg_name =" ${REG_PKG_NAME } "
76+ reg_bundle_img =" ${cluster_registry_host} / ${reg_bundle_path }"
77+ reg_bundle_push_tag =" ${local_registry_host} / ${reg_bundle_path }"
7678
7779# #######################################
7880# Create the registry+v1 based extension
@@ -84,7 +86,7 @@ reg_pkg_name="${REG_PKG_NAME}"
8486# NOTE: This is a rough edge that users will experience
8587
8688# 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
89+ # in the path if it is present. Override via `export` to ensure we use
8890# the same version that we scaffolded with.
8991# NOTE: this is a rough edge that users will experience
9092
@@ -102,7 +104,8 @@ reg_pkg_name="${REG_PKG_NAME}"
102104 make docker-build IMG=" ${reg_img} " && \
103105 sed -i -e ' s/$(OPERATOR_SDK) generate kustomize manifests -q/$(OPERATOR_SDK) generate kustomize manifests -q --interactive=false/g' Makefile && \
104106 make bundle IMG=" ${reg_img} " VERSION=0.0.1 && \
105- make bundle-build BUNDLE_IMG=" ${reg_bundle_img} "
107+ make bundle-build BUNDLE_IMG=" ${reg_bundle_push_tag} "
108+ ${container_tool} push ${reg_bundle_push_tag} ${tls_flag}
106109)
107110
108111# ##############################
@@ -149,107 +152,5 @@ cat <<EOF > "${TMP_ROOT}"/catalog/index.yaml
149152}
150153EOF
151154
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
155+ ${container_tool} build -f ${TMP_ROOT} /catalog.Dockerfile -t ${catalog_push_tag}
156+ ${container_tool} push ${catalog_push_tag} ${tls_flag}
0 commit comments