From 6800d3a3f48c3e1d91987c10c1fecc1950757257 Mon Sep 17 00:00:00 2001 From: Banashri Mandal Date: Thu, 28 Nov 2024 14:33:38 +0100 Subject: [PATCH] Add nginx-ingress-operator for testing (#515) --- scripts/delete-operator.sh | 14 +++++++ scripts/deploy-operator.sh | 3 ++ test-target/operator-single-install-mode.yaml | 37 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 test-target/operator-single-install-mode.yaml diff --git a/scripts/delete-operator.sh b/scripts/delete-operator.sh index 333a7f13..1a053ee5 100755 --- a/scripts/delete-operator.sh +++ b/scripts/delete-operator.sh @@ -11,3 +11,17 @@ operator-sdk cleanup nginx-operator -n "$CERTSUITE_EXAMPLE_NAMESPACE" #Wait until pod is deleted until [[ -z "$(oc get pod "$OPERATOR_REGISTRY_POD_NAME" -n "$CERTSUITE_EXAMPLE_NAMESPACE" 2>/dev/null)" ]]; do sleep 5; done + +# Delete nginx-operator in ninginx-ops namespace +echo "Deleting nginx-ingress-operator .." + +NGINX_OPERATOR_NS="nginx-ops" +NGINX_APPS_NS="nginx-apps" + +CSV=$(oc get subscription nginx-ingress-operator -n "$NGINX_OPERATOR_NS" -o json | jq -r '.status.installedCSV') +oc delete subscription nginx-ingress-operator -n "$NGINX_OPERATOR_NS" +oc delete csv "$CSV" -n "$NGINX_OPERATOR_NS" +oc delete csv "$CSV" -n "$NGINX_APPS_NS" + +oc delete namespace "$NGINX_OPERATOR_NS" +oc delete namespace "$NGINX_APPS_NS" diff --git a/scripts/deploy-operator.sh b/scripts/deploy-operator.sh index 93014eee..9bc925da 100755 --- a/scripts/deploy-operator.sh +++ b/scripts/deploy-operator.sh @@ -41,3 +41,6 @@ else echo "ERROR: CSV not deployed. Operator deployment failed -- interrupting tests" exit 1 fi + +# deploy single namespace operator nginx in namespace nginx-ops +oc apply --filename ./test-target/operator-single-install-mode.yaml diff --git a/test-target/operator-single-install-mode.yaml b/test-target/operator-single-install-mode.yaml new file mode 100644 index 00000000..18a75254 --- /dev/null +++ b/test-target/operator-single-install-mode.yaml @@ -0,0 +1,37 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: nginx-ops + +--- +apiVersion: v1 +kind: Namespace +metadata: + name: nginx-apps + +--- +apiVersion: operators.coreos.com/v1 +kind: OperatorGroup +metadata: + name: nginx-og + namespace: nginx-ops +spec: + targetNamespaces: + - nginx-apps + +--- +apiVersion: operators.coreos.com/v1alpha1 +kind: Subscription +metadata: + name: nginx-ingress-operator + namespace: nginx-ops + labels: + nginx-ingress-operator.v2.4.2 +spec: + channel: alpha + installPlanApproval: Automatic + name: nginx-ingress-operator + source: certified-operators + sourceNamespace: openshift-marketplace +