diff --git a/pkg/k8sapi/discovery.go b/pkg/k8sapi/discovery.go index d338b9ecac..2269f62349 100644 --- a/pkg/k8sapi/discovery.go +++ b/pkg/k8sapi/discovery.go @@ -14,12 +14,12 @@ import ( clientset "k8s.io/client-go/kubernetes" - "github.com/operator-framework/operator-sdk/pkg/k8sclient" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" @@ -83,7 +83,12 @@ func NewController(clientset kubernetes.Interface) *Controller { // CreateKubeClient creates a k8s client func CreateKubeClient() (clientset.Interface, error) { - kubeClient := k8sclient.GetKubeClient() + kubeConfig, err := rest.InClusterConfig() + if err != nil { + panic(err) + } + kubeClient := kubernetes.NewForConfigOrDie(kubeConfig) + // Informers don't seem to do a good job logging error messages when it // can't reach the server, making debugging hard. This makes it easier to // figure out if apiserver is configured incorrectly.