diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 97a858ea3..2e64f38ae 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -51,6 +51,7 @@ import ( "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/resource" + "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" diff --git a/pkg/kube/client_test.go b/pkg/kube/client_test.go index cd59f950c..82dc4f0a8 100644 --- a/pkg/kube/client_test.go +++ b/pkg/kube/client_test.go @@ -616,12 +616,17 @@ func TestPerform(t *testing.T) { } } +// Likely it is not possible to get this test to work with kstatus given that it seems +// kstatus is not making constant get checks on the resources and is instead waiting for events +// Potentially the test could be reworked to make the pods after five seconds +// would need this -> func TestWait(t *testing.T) { podList := newPodList("starfish", "otter", "squid") var created *time.Time c := newTestClient(t) + c.Factory.(*cmdtesting.TestFactory).ClientConfigVal = cmdtesting.DefaultClientConfig() c.Factory.(*cmdtesting.TestFactory).Client = &fake.RESTClient{ NegotiatedSerializer: unstructuredSerializer, Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { diff --git a/pkg/kube/factory.go b/pkg/kube/factory.go index 1d237c307..e9d03ab91 100644 --- a/pkg/kube/factory.go +++ b/pkg/kube/factory.go @@ -17,6 +17,7 @@ limitations under the License. package kube // import "helm.sh/helm/v4/pkg/kube" import ( + "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" @@ -46,6 +47,9 @@ type Factory interface { // KubernetesClientSet gives you back an external clientset KubernetesClientSet() (*kubernetes.Clientset, error) + // Returns a RESTClient for accessing Kubernetes resources or an error. + RESTClient() (*restclient.RESTClient, error) + // NewBuilder returns an object that assists in loading objects from both disk and the server // and which implements the common patterns for CLI interactions with generic resources. NewBuilder() *resource.Builder