From 352d70c80a9f7691132da07c6c73b497c91e1fc1 Mon Sep 17 00:00:00 2001 From: Talor Itzhak Date: Mon, 18 Nov 2024 15:43:48 +0200 Subject: [PATCH] e2e:client: wiring HyperShift MNG client Using the hypershift package to initialize the HyperShift MNG client when running on HyperShift platform. Signed-off-by: Talor Itzhak --- test/utils/clients/clients.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/utils/clients/clients.go b/test/utils/clients/clients.go index f735e0b50..cea16ca4c 100644 --- a/test/utils/clients/clients.go +++ b/test/utils/clients/clients.go @@ -30,6 +30,7 @@ import ( apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" nropv1 "github.com/openshift-kni/numaresources-operator/api/numaresourcesoperator/v1" + "github.com/openshift-kni/numaresources-operator/test/utils/hypershift" ) var ( @@ -37,6 +38,9 @@ var ( Client client.Client // K8sClient defines k8s client to run subresource operations, for example you should use it to get pod logs K8sClient *kubernetes.Clientset + // MNGClient defines the API client to run CRUD operations on HyperShift management cluster, + // that will be used for testing + MNGClient client.Client // ClientsEnabled tells if the client from the package can be used ClientsEnabled bool ) @@ -75,6 +79,13 @@ func init() { ClientsEnabled = false return } + if hypershift.IsHypershiftCluster() { + MNGClient, err = hypershift.BuildControlPlaneClient() + if err != nil { + ClientsEnabled = false + return + } + } ClientsEnabled = true }