Skip to content

Commit

Permalink
e2e:client: wiring HyperShift MNG client
Browse files Browse the repository at this point in the history
Using the hypershift package to initialize the HyperShift MNG client
when running on HyperShift platform.

Signed-off-by: Talor Itzhak <[email protected]>
  • Loading branch information
Tal-or committed Nov 19, 2024
1 parent 4ca14f0 commit 352d70c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/utils/clients/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ 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 (
// Client defines the API client to run CRUD operations, that will be used for testing
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
)
Expand Down Expand Up @@ -75,6 +79,13 @@ func init() {
ClientsEnabled = false
return
}
if hypershift.IsHypershiftCluster() {
MNGClient, err = hypershift.BuildControlPlaneClient()
if err != nil {
ClientsEnabled = false
return
}
}
ClientsEnabled = true
}

Expand Down

0 comments on commit 352d70c

Please sign in to comment.