Skip to content

Commit

Permalink
Add apiextensionsclientset to Framework struct
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
  • Loading branch information
ArangoGutierrez committed Aug 6, 2024
1 parent 7508633 commit 9274eea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/onsi/ginkgo/v2 v2.19.1
github.com/onsi/gomega v1.34.0
k8s.io/api v0.30.3
k8s.io/apiextensions-apiserver v0.30.0
k8s.io/apimachinery v0.30.3
k8s.io/client-go v0.30.3
k8s.io/klog/v2 v2.130.1
Expand Down Expand Up @@ -139,7 +140,6 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
helm.sh/helm/v3 v3.15.2 // indirect
k8s.io/apiextensions-apiserver v0.30.0 // indirect
k8s.io/apiserver v0.30.0 // indirect
k8s.io/cli-runtime v0.30.0 // indirect
k8s.io/component-base v0.30.0 // indirect
Expand Down
6 changes: 6 additions & 0 deletions pkg/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
apiextensionsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -73,6 +74,7 @@ type Framework struct {

clientConfig *rest.Config
ClientSet clientset.Interface
ApiExtClient *apiextensionsclientset.Clientset

// Helm
HelmClient helm.Client
Expand Down Expand Up @@ -134,6 +136,10 @@ func (f *Framework) BeforeEach(ctx context.Context) {
f.ClientSet, err = clientset.NewForConfig(config)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

// Create an API extensions client
f.ApiExtClient, err = apiextensionsclientset.NewForConfig(config)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

if !f.SkipNamespaceCreation {
ginkgo.By(fmt.Sprintf("Building a namespace with basename %s", f.BaseName))
namespace, err := f.CreateNamespace(ctx, f.BaseName, map[string]string{
Expand Down

0 comments on commit 9274eea

Please sign in to comment.