From 4e5ffb81322c44f70b7d58aca3937944125e6571 Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Tue, 27 Jul 2021 09:35:55 +0300 Subject: [PATCH] build: Enable Image Puller for tests (#960) * build: Enable Image Puller for tests Signed-off-by: Anatolii Bazko --- .ci/oci-nightly-update.sh | 4 ++ .github/bin/common.sh | 31 +++++++++++--- .../che-operator.clusterserviceversion.yaml | 6 +-- .../che-operator.clusterserviceversion.yaml | 6 +-- config/manager/manager.yaml | 2 +- olm/olm.sh | 1 + pkg/deploy/kubernetes_image_puller.go | 42 ++++++------------- 7 files changed, 51 insertions(+), 41 deletions(-) diff --git a/.ci/oci-nightly-update.sh b/.ci/oci-nightly-update.sh index d671b03ba..f59ec5c2a 100755 --- a/.ci/oci-nightly-update.sh +++ b/.ci/oci-nightly-update.sh @@ -34,6 +34,10 @@ overrideDefaults() { runTests() { deployEclipseCheStable "operator" "openshift" ${LAST_PACKAGE_VERSION} + + deployCommunityCatalog + enableImagePuller + provisionOAuth createWorkspace diff --git a/.github/bin/common.sh b/.github/bin/common.sh index 546748347..930ada011 100755 --- a/.github/bin/common.sh +++ b/.github/bin/common.sh @@ -39,6 +39,7 @@ initDefaults() { export DEV_WORKSPACE_ENABLE="false" export DEVWORKSPACE_CONTROLLER_TEST_NAMESPACE=devworkspace-controller-test export DEVWORKSPACE_CHE_OPERATOR_TEST_NAMESPACE=devworkspace-cheoperator-test + export IMAGE_PULLER_ENABLE="false" # turn off telemetry mkdir -p ${HOME}/.config/chectl @@ -350,11 +351,6 @@ setServerExposureStrategy() { yq -rSY '.spec.server.serverExposureStrategy = "'${2}'"' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} } -enableDevWorkspace() { - local file="${1}/che-operator/crds/org_v1_che_cr.yaml" - yq -rSY '.spec.devWorkspace.enable = '${2}'' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} -} - setSingleHostExposureType() { local file="${1}/che-operator/crds/org_v1_che_cr.yaml" yq -rSY '.spec.k8s.singleHostExposureType = "'${2}'"' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} @@ -371,6 +367,10 @@ setCustomOperatorImage() { yq -rSY '.spec.template.spec.containers[0].imagePullPolicy = "IfNotPresent"' $file > /tmp/tmp.yaml && mv /tmp/tmp.yaml ${file} } +enableImagePuller() { + kubectl patch checluster/eclipse-che -n ${NAMESPACE} --type=merge -p '{"spec":{"imagePuller":{"enable": true}}}' +} + insecurePrivateDockerRegistry() { IMAGE_REGISTRY_HOST="127.0.0.1:5000" export IMAGE_REGISTRY_HOST @@ -405,6 +405,7 @@ applyOlmCR() { CR=$(yq -r '.metadata.annotations["alm-examples"]' "${OPENSHIFT_NIGHTLY_CSV_FILE}" | yq -r ".[0]") CR=$(echo "$CR" | yq -r ".spec.server.serverExposureStrategy = \"${CHE_EXPOSURE_STRATEGY}\"") CR=$(echo "$CR" | yq -r ".spec.devWorkspace.enable = ${DEV_WORKSPACE_ENABLE:-false}") + CR=$(echo "$CR" | yq -r ".spec.imagePuller.enable = ${IMAGE_PULLER_ENABLE:-false}") echo -e "$CR" echo "$CR" | oc apply -n "${NAMESPACE}" -f - @@ -531,3 +532,23 @@ deployCertManager() { kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=webhook -n cert-manager --timeout=60s kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=cainjector -n cert-manager --timeout=60s } + +deployCommunityCatalog() { + oc create -f - -o jsonpath='{.metadata.name}' <