Skip to content

Commit

Permalink
fix k8s client init
Browse files Browse the repository at this point in the history
  • Loading branch information
vramk23 committed Jun 12, 2023
1 parent 9cfff53 commit 5aaf06c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions internal/client/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ package client

import (
"context"
"path/filepath"
"strings"

"github.com/intelops/go-common/logging"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/util/homedir"
"k8s.io/client-go/rest"
)

type K8SClient struct {
Expand All @@ -20,11 +18,7 @@ type K8SClient struct {
}

func NewK8SClient(log logging.Logger) (*K8SClient, error) {
var kubeconfig string
if home := homedir.HomeDir(); home != "" {
kubeconfig = filepath.Join(home, ".kube", "config")
}
config, err := clientcmd.BuildConfigFromFlags("", kubeconfig)
config, err := rest.InClusterConfig()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 5aaf06c

Please sign in to comment.