1 /* 2 Copyright The Helm Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package kube // import "helm.sh/helm/v3/pkg/kube" 18 19 import ( 20 "k8s.io/cli-runtime/pkg/resource" 21 "k8s.io/client-go/dynamic" 22 "k8s.io/client-go/kubernetes" 23 "k8s.io/client-go/tools/clientcmd" 24 "k8s.io/kubectl/pkg/validation" 25 ) 26 27 // Factory provides abstractions that allow the Kubectl command to be extended across multiple types 28 // of resources and different API sets. 29 // This interface is a minimal copy of the kubectl Factory interface containing only the functions 30 // needed by Helm. Since Kubernetes Go APIs, including interfaces, can change in any minor release 31 // this interface is not covered by the Helm backwards compatibility guarantee. The reasons for the 32 // minimal copy is that it does not include the full interface. Changes or additions to functions 33 // Helm does not need are not impacted or exposed. This minimizes the impact of Kubernetes changes 34 // being exposed. 35 type Factory interface { 36 // ToRawKubeConfigLoader return kubeconfig loader as-is 37 ToRawKubeConfigLoader() clientcmd.ClientConfig 38 39 // DynamicClient returns a dynamic client ready for use 40 DynamicClient() (dynamic.Interface, error) 41 42 // KubernetesClientSet gives you back an external clientset 43 KubernetesClientSet() (*kubernetes.Clientset, error) 44 45 // NewBuilder returns an object that assists in loading objects from both disk and the server 46 // and which implements the common patterns for CLI interactions with generic resources. 47 NewBuilder() *resource.Builder 48 49 // Returns a schema that can validate objects stored on disk. 50 Validator(validationDirective string) (validation.Schema, error) 51 } 52