diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b5b470062..a522d2d200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - All the modules in [`pkg/sdk`](https://github.com/operator-framework/operator-sdk/tree/master/pkg/sdk) have been combined into a single package. `action`, `handler`, `informer` `types` and `query` pkgs have been consolidated into `pkg/sdk`. [#242](https://github.com/operator-framework/operator-sdk/pull/242) - The SDK exposes the Kubernetes clientset via `k8sclient.GetKubeClient()` #295 - The SDK now vendors the k8s code-generators for an operator instead of using the prebuilt image `gcr.io/coreos-k8s-scale-testing/codegen:1.9.3` [#319](https://github.com/operator-framework/operator-sdk/pull/242) +- The SDK exposes the Kubernetes rest config via `k8sclient.GetKubeConfig()` #338 ### Removed diff --git a/pkg/k8sclient/client.go b/pkg/k8sclient/client.go index 84cf285949..fc78f67952 100644 --- a/pkg/k8sclient/client.go +++ b/pkg/k8sclient/client.go @@ -77,6 +77,12 @@ func GetKubeClient() kubernetes.Interface { return singletonFactory.kubeClient } +// GetKubeConfig returns the kubernetes rest configuration +func GetKubeConfig() *rest.Config { + once.Do(newSingletonFactory) + return singletonFactory.kubeConfig +} + // GetResourceClient returns the dynamic client and pluralName for the resource specified by the apiVersion and kind func (c *resourceClientFactory) GetResourceClient(apiVersion, kind, namespace string) (dynamic.ResourceInterface, string, error) { gv, err := schema.ParseGroupVersion(apiVersion)