From 97d20a38b45deb73b0737701a58bd70cbe385d6d Mon Sep 17 00:00:00 2001 From: Brandon Palm Date: Thu, 7 Nov 2024 14:51:01 -0600 Subject: [PATCH] Add custom catalogsource (#502) --- Makefile | 1 + scripts/delete-custom-catalogsource.sh | 10 ++++++++++ scripts/deploy-custom-catalogsource.sh | 18 ++++++++++++++++++ scripts/init-env.sh | 3 +++ test-target/custom-catalogsource.yaml | 10 ++++++++++ 5 files changed, 42 insertions(+) create mode 100755 scripts/delete-custom-catalogsource.sh create mode 100755 scripts/deploy-custom-catalogsource.sh create mode 100644 test-target/custom-catalogsource.yaml diff --git a/Makefile b/Makefile index b28d2fe7..f473c6db 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ install: ./scripts/deploy-network-policies.sh ./scripts/delete-standard-storageclass.sh ./scripts/deploy-cr-scale-operator.sh + ./scripts/deploy-custom-catalogsource.sh # Creates an install path specifically for the Kind QE clusters to use install-for-qe: diff --git a/scripts/delete-custom-catalogsource.sh b/scripts/delete-custom-catalogsource.sh new file mode 100755 index 00000000..ec186b42 --- /dev/null +++ b/scripts/delete-custom-catalogsource.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -x + +# Initialization +SCRIPT_DIR=$(dirname "$0") + +# shellcheck disable=SC1091 # Not following. +source "$SCRIPT_DIR"/init-env.sh + +oc delete --filename ./test-target/custom-catalogsource.yaml --namespace "$CUSTOM_CATALOG_NAMESPACE" --ignore-not-found diff --git a/scripts/deploy-custom-catalogsource.sh b/scripts/deploy-custom-catalogsource.sh new file mode 100755 index 00000000..851e80ce --- /dev/null +++ b/scripts/deploy-custom-catalogsource.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -x + +# Initialization +SCRIPT_DIR=$(dirname "$0") + +# shellcheck disable=SC1091 # Not following. +source "$SCRIPT_DIR"/init-env.sh + +oc create ns "$CUSTOM_CATALOG_NAMESPACE" --dry-run=client --output yaml | oc apply --filename - + +# Apply the catalogsource YAML +oc apply --filename ./test-target/custom-catalogsource.yaml --namespace "$CUSTOM_CATALOG_NAMESPACE" + +# Patch the custom-catalog service to be IP Family Dual Stack +# This is needed to pass the dual-stack service test +oc patch service custom-catalog --namespace "$CUSTOM_CATALOG_NAMESPACE" --type='json' -p='[{"op": "add", "path": "/spec/ipFamilyPolicy", "value": "PreferDualStack"}]' +oc patch service custom-catalog --namespace "$CUSTOM_CATALOG_NAMESPACE" --type='json' -p='[{"op": "add", "path": "/spec/ipFamilies", "value": ["IPv4", "IPv6"]}]' diff --git a/scripts/init-env.sh b/scripts/init-env.sh index a335ec96..f152598f 100755 --- a/scripts/init-env.sh +++ b/scripts/init-env.sh @@ -37,6 +37,9 @@ export CERTSUITE_EXAMPLE_NAMESPACE="${CERTSUITE_EXAMPLE_NAMESPACE:-tnf}" # catalog source namespace export CATALOG_NAMESPACE="${CATALOG_NAMESPACE:-$CERTSUITE_EXAMPLE_NAMESPACE}" +# custom catalog source namespace +export CUSTOM_CATALOG_NAMESPACE="${CUSTOM_CATALOG_NAMESPACE:-$CERTSUITE_EXAMPLE_NAMESPACE}" + # Creates namespace if it does not exist. oc create \ namespace "$CERTSUITE_EXAMPLE_NAMESPACE" \ diff --git a/test-target/custom-catalogsource.yaml b/test-target/custom-catalogsource.yaml new file mode 100644 index 00000000..798b8c1c --- /dev/null +++ b/test-target/custom-catalogsource.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: operators.coreos.com/v1alpha1 +kind: CatalogSource +metadata: + name: custom-catalog +spec: + sourceType: grpc + image: quay.io/deliedit/test:catalog-index-test + displayName: Operator Catalog + publisher: Redhat