From 8b19f8df0ed0df593a4efceddbd3fa85122b6238 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Mon, 16 May 2022 15:47:19 -0400 Subject: [PATCH] Adding details on the Factory interface This covers both the property and the minimal copy of the Factory interface. It also notes that this interface is not covered by the Helm backwards compatibility and why. Signed-off-by: Matt Farina Signed-off-by: Joe Julian --- pkg/kube/client.go | 8 ++++++++ pkg/kube/factory.go | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 7b3c803f9..4f324d22c 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -69,6 +69,14 @@ var ManagedFieldsManager string // Client represents a client capable of communicating with the Kubernetes API. type Client struct { + // Factory provides a minimal version of the kubectl Factory interface. If + // you need the full Factory you can type switch to the full interface. + // Since Kubernetes Go API does not provide backwards compatibility across + // minor versions, this API does not follow Helm backwards compatibility. + // Helm is exposing Kubernetes in this property and cannot guarantee this + // will not change. The minimal interface only has the functions that Helm + // needs. The smaller surface area of the interface means there is a lower + // chance of it changing. Factory Factory Log func(string, ...interface{}) // Namespace allows to bypass the kubeconfig file for the choice of the namespace diff --git a/pkg/kube/factory.go b/pkg/kube/factory.go index 6c1b0f4e3..f19d62dc3 100644 --- a/pkg/kube/factory.go +++ b/pkg/kube/factory.go @@ -26,6 +26,12 @@ import ( // Factory provides abstractions that allow the Kubectl command to be extended across multiple types // of resources and different API sets. +// This interface is a minimal copy of the kubectl Factory interface containing only the functions +// needed by Helm. Since Kubernetes Go APIs, including interfaces, can change in any minor release +// this interface is not covered by the Helm backwards compatibility guarantee. The reasons for the +// minimal copy is that it does not include the full interface. Changes or additions to functions +// Helm does not need are not impacted or exposed. This minimizes the impact of Kubernetes changes +// being exposed. type Factory interface { // ToRawKubeConfigLoader return kubeconfig loader as-is ToRawKubeConfigLoader() clientcmd.ClientConfig