From 510e41d93afc4afaec90b8bf726c956bfe99a337 Mon Sep 17 00:00:00 2001 From: Pablo Chacin Date: Tue, 12 Sep 2023 22:08:53 +0200 Subject: [PATCH] Export NewFromConfig function Signed-off-by: Pablo Chacin --- pkg/kubernetes/integration_test.go | 4 ++-- pkg/kubernetes/kubernetes.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/kubernetes/integration_test.go b/pkg/kubernetes/integration_test.go index 9fdfaa16..ad0f9973 100644 --- a/pkg/kubernetes/integration_test.go +++ b/pkg/kubernetes/integration_test.go @@ -73,7 +73,7 @@ func Test_Kubernetes(t *testing.T) { t.Fatalf("failed to create rest client for kubernetes : %s", err) } - k8s, err := newFromConfig(restcfg) + k8s, err := NewFromConfig(restcfg) if err != nil { t.Fatalf("error creating kubernetes client: %v", err) } @@ -299,7 +299,7 @@ func Test_UnsupportedKubernetesVersion(t *testing.T) { t.Fatalf("failed to create rest client for kubernetes : %s", err) } - _, err = newFromConfig(restcfg) + _, err = NewFromConfig(restcfg) if err == nil { t.Errorf("should had failed creating kubernetes client") return diff --git a/pkg/kubernetes/kubernetes.go b/pkg/kubernetes/kubernetes.go index ed620cae..cb97fdd1 100644 --- a/pkg/kubernetes/kubernetes.go +++ b/pkg/kubernetes/kubernetes.go @@ -31,8 +31,8 @@ type k8s struct { kubernetes.Interface } -// newFromConfig returns a Kubernetes instance configured with the provided kubeconfig. -func newFromConfig(config *rest.Config) (Kubernetes, error) { +// NewFromConfig returns a Kubernetes instance configured with the provided kubeconfig. +func NewFromConfig(config *rest.Config) (Kubernetes, error) { // As per the discussion in [1] client side rate limiting is no longer required. // Setting a large limit // [1] https://github.com/kubernetes/kubernetes/issues/111880 @@ -62,7 +62,7 @@ func NewFromKubeconfig(kubeconfig string) (Kubernetes, error) { return nil, err } - return newFromConfig(config) + return NewFromConfig(config) } // New returns a Kubernetes instance or an error when no config is eligible to be used. @@ -73,7 +73,7 @@ func NewFromKubeconfig(kubeconfig string) (Kubernetes, error) { func New() (Kubernetes, error) { k8sConfig, err := rest.InClusterConfig() if err == nil { - return newFromConfig(k8sConfig) + return NewFromConfig(k8sConfig) } if !errors.Is(err, rest.ErrNotInCluster) {