From 19d82404096f8f838897f4ff1654b9c1fd397c05 Mon Sep 17 00:00:00 2001 From: Ankita Thomas Date: Thu, 6 Aug 2026 07:24:49 -0400 Subject: [PATCH] force same arch for opm and catalogsource pod for multiarch tests Signed-off-by: Ankita Thomas --- tests-extension/pkg/bindata/qe/bindata.go | 7 +++++++ tests-extension/test/qe/specs/olmv0_custom_schema.go | 7 ++++++- .../test/qe/testdata/olm/catalogsource-image.yaml | 4 ++++ .../qe/testdata/olm/custom-schema-buildconfig.yaml | 3 +++ .../test/qe/util/olmv0util/catalog_source.go | 8 +++++++- .../test/qe/util/olmv0util/custom_schema_grpc.go | 10 +++++++--- 6 files changed, 34 insertions(+), 5 deletions(-) diff --git a/tests-extension/pkg/bindata/qe/bindata.go b/tests-extension/pkg/bindata/qe/bindata.go index bbc3d2fcd2..c59290290c 100644 --- a/tests-extension/pkg/bindata/qe/bindata.go +++ b/tests-extension/pkg/bindata/qe/bindata.go @@ -510,6 +510,9 @@ objects: name: "${NAME}" namespace: "${NAMESPACE}" spec: + grpcPodConfig: + nodeSelector: + kubernetes.io/arch: "${ARCH}" image: "${ADDRESS}" secrets: - "${SECRET}" @@ -532,6 +535,7 @@ parameters: - name: SECRET - name: INTERVAL value: "10m0s" +- name: ARCH `) func testQeTestdataOlmCatalogsourceImageYamlBytes() ([]byte, error) { @@ -6952,6 +6956,8 @@ objects: name: "${NAME}" namespace: "${NAMESPACE}" spec: + nodeSelector: + kubernetes.io/arch: "${ARCH}" output: to: kind: ImageStreamTag @@ -6968,6 +6974,7 @@ parameters: - name: NAME - name: NAMESPACE - name: BASE_IMAGE +- name: ARCH `) func testQeTestdataOlmCustomSchemaBuildconfigYamlBytes() ([]byte, error) { diff --git a/tests-extension/test/qe/specs/olmv0_custom_schema.go b/tests-extension/test/qe/specs/olmv0_custom_schema.go index 3171a227b9..8779f6ab9a 100644 --- a/tests-extension/test/qe/specs/olmv0_custom_schema.go +++ b/tests-extension/test/qe/specs/olmv0_custom_schema.go @@ -3,6 +3,7 @@ package specs import ( "context" "os" + "runtime" "time" g "github.com/onsi/ginkgo/v2" @@ -53,7 +54,10 @@ var _ = g.Describe("[sig-operator][Jira:OLM][OCPFeatureGate:OLMLifecycleAndCompa fbcContent, err := os.ReadFile(exutil.FixturePath("testdata", "custom-schema", "index.json")) o.Expect(err).NotTo(o.HaveOccurred()) - imageRef := olmv0util.BuildCustomCatalogImage(oc, namespace, catalogName, baseImage, fbcContent) + testArch := runtime.GOARCH + e2e.Logf("test running on architecture: %s", testArch) + + imageRef := olmv0util.BuildCustomCatalogImage(oc, namespace, catalogName, baseImage, testArch, fbcContent) e2e.Logf("built catalog image: %s", imageRef) // Register build resources for cleanup @@ -67,6 +71,7 @@ var _ = g.Describe("[sig-operator][Jira:OLM][OCPFeatureGate:OLMLifecycleAndCompa SourceType: "grpc", Address: imageRef, Template: exutil.FixturePath("testdata", "olm", "catalogsource-image.yaml"), + Arch: testArch, } catsrc.CreateWithCheck(oc, itName, dr) diff --git a/tests-extension/test/qe/testdata/olm/catalogsource-image.yaml b/tests-extension/test/qe/testdata/olm/catalogsource-image.yaml index ebb5d8624f..d5a1484d8a 100644 --- a/tests-extension/test/qe/testdata/olm/catalogsource-image.yaml +++ b/tests-extension/test/qe/testdata/olm/catalogsource-image.yaml @@ -9,6 +9,9 @@ objects: name: "${NAME}" namespace: "${NAMESPACE}" spec: + grpcPodConfig: + nodeSelector: + kubernetes.io/arch: "${ARCH}" image: "${ADDRESS}" secrets: - "${SECRET}" @@ -31,3 +34,4 @@ parameters: - name: SECRET - name: INTERVAL value: "10m0s" +- name: ARCH diff --git a/tests-extension/test/qe/testdata/olm/custom-schema-buildconfig.yaml b/tests-extension/test/qe/testdata/olm/custom-schema-buildconfig.yaml index bed1592c29..1415f72ba7 100644 --- a/tests-extension/test/qe/testdata/olm/custom-schema-buildconfig.yaml +++ b/tests-extension/test/qe/testdata/olm/custom-schema-buildconfig.yaml @@ -9,6 +9,8 @@ objects: name: "${NAME}" namespace: "${NAMESPACE}" spec: + nodeSelector: + kubernetes.io/arch: "${ARCH}" output: to: kind: ImageStreamTag @@ -25,3 +27,4 @@ parameters: - name: NAME - name: NAMESPACE - name: BASE_IMAGE +- name: ARCH diff --git a/tests-extension/test/qe/util/olmv0util/catalog_source.go b/tests-extension/test/qe/util/olmv0util/catalog_source.go index 4db214c31e..4b70258720 100644 --- a/tests-extension/test/qe/util/olmv0util/catalog_source.go +++ b/tests-extension/test/qe/util/olmv0util/catalog_source.go @@ -6,6 +6,7 @@ package olmv0util import ( "context" "fmt" + "runtime" "strings" "time" @@ -33,6 +34,7 @@ type CatalogSourceDescription struct { Interval string // Update interval for the catalog source ImageTemplate string // Image template for catalog updates ClusterType string // Target cluster type (e.g., "microshift") + Arch string // Architecture for node selector } // Create creates a CatalogSource resource using the provided template and parameters @@ -49,6 +51,10 @@ func (catsrc *CatalogSourceDescription) Create(oc *exutil.CLI, itName string, dr catsrc.Interval = "10m0s" e2e.Logf("set interval to be 10m0s") } + if catsrc.Arch == "" { + catsrc.Arch = runtime.GOARCH + e2e.Logf("set catalogsource node selector arch to %s", catsrc.Arch) + } // Choose appropriate template application function based on cluster type applyFn := ApplyResourceFromTemplate if strings.Compare(catsrc.ClusterType, "microshift") == 0 { @@ -63,7 +69,7 @@ func (catsrc *CatalogSourceDescription) Create(oc *exutil.CLI, itName string, dr err := applyFn(oc, "--ignore-unknown-parameters=true", "-f", catsrc.Template, "-p", "NAME="+catsrc.Name, "NAMESPACE="+catsrc.Namespace, "ADDRESS="+catsrc.Address, "SECRET="+catsrc.Secret, "DISPLAYNAME="+"\""+catsrc.DisplayName+"\"", "PUBLISHER="+"\""+catsrc.Publisher+"\"", "SOURCETYPE="+catsrc.SourceType, - "INTERVAL="+catsrc.Interval, "IMAGETEMPLATE="+imageTemplate) + "INTERVAL="+catsrc.Interval, "IMAGETEMPLATE="+imageTemplate, "ARCH="+catsrc.Arch) o.Expect(err).NotTo(o.HaveOccurred()) // Configure security context constraints for non-microshift clusters if strings.Compare(catsrc.ClusterType, "microshift") != 0 { diff --git a/tests-extension/test/qe/util/olmv0util/custom_schema_grpc.go b/tests-extension/test/qe/util/olmv0util/custom_schema_grpc.go index 6138cb8c1b..149275ca24 100644 --- a/tests-extension/test/qe/util/olmv0util/custom_schema_grpc.go +++ b/tests-extension/test/qe/util/olmv0util/custom_schema_grpc.go @@ -10,6 +10,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strings" "time" @@ -123,7 +124,7 @@ func GetOPMBaseImage(oc *exutil.CLI) string { // BuildConfig. It creates an ImageStream and BuildConfig, starts a binary build // from the provided FBC content, and waits for completion. // Returns the internal registry image reference. -func BuildCustomCatalogImage(oc *exutil.CLI, namespace, name, baseImage string, fbcContent []byte) string { +func BuildCustomCatalogImage(oc *exutil.CLI, namespace, name, baseImage, arch string, fbcContent []byte) string { // Create ImageStream isTemplate := exutil.FixturePath("testdata", "olm", "custom-schema-imagestream.yaml") err := ApplyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", isTemplate, @@ -132,11 +133,14 @@ func BuildCustomCatalogImage(oc *exutil.CLI, namespace, name, baseImage string, e2e.Logf("created ImageStream %s/%s", namespace, name) // Create BuildConfig + if arch == "" { + arch = runtime.GOARCH + } bcTemplate := exutil.FixturePath("testdata", "olm", "custom-schema-buildconfig.yaml") err = ApplyResourceFromTemplate(oc, "--ignore-unknown-parameters=true", "-f", bcTemplate, - "-p", "NAME="+name, "NAMESPACE="+namespace, "BASE_IMAGE="+baseImage) + "-p", "NAME="+name, "NAMESPACE="+namespace, "BASE_IMAGE="+baseImage, "ARCH="+arch) o.Expect(err).NotTo(o.HaveOccurred()) - e2e.Logf("created BuildConfig %s/%s with base image %s", namespace, name, baseImage) + e2e.Logf("created BuildConfig %s/%s with base image %s for arch %s", namespace, name, baseImage, arch) // Prepare build directory buildDir, err := os.MkdirTemp("", "custom-schema-build-")