Skip to content

Commit

Permalink
chore: Remove unused dynamicClient
Browse files Browse the repository at this point in the history
  • Loading branch information
mrueg committed Aug 5, 2024
1 parent 45b5a26 commit ebe5683
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions pkg/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/discovery"
"k8s.io/client-go/dynamic"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
Expand All @@ -40,7 +39,6 @@ import (
var config *rest.Config
var currentKubeClient clientset.Interface
var currentDiscoveryClient *discovery.DiscoveryClient
var currentDynamicClient *dynamic.DynamicClient

// CreateKubeClient creates a Kubernetes clientset and a custom resource clientset.
func CreateKubeClient(apiserver string, kubeconfig string) (clientset.Interface, error) {
Expand Down Expand Up @@ -120,22 +118,6 @@ func CreateDiscoveryClient(apiserver string, kubeconfig string) (*discovery.Disc
return currentDiscoveryClient, err
}

// CreateDynamicClient creates a Kubernetes dynamic client.
func CreateDynamicClient(apiserver string, kubeconfig string) (*dynamic.DynamicClient, error) {
if currentDynamicClient != nil {
return currentDynamicClient, nil
}
var err error
if config == nil {
config, err = clientcmd.BuildConfigFromFlags(apiserver, kubeconfig)
if err != nil {
return nil, err
}
}
currentDynamicClient, err = dynamic.NewForConfig(config)
return currentDynamicClient, err
}

// GVRFromType returns the GroupVersionResource for a given type.
func GVRFromType(resourceName string, expectedType interface{}) *schema.GroupVersionResource {
if _, ok := expectedType.(*testUnstructuredMock.Foo); ok {
Expand Down

0 comments on commit ebe5683

Please sign in to comment.