github.com/stefanmcshane/helm@v0.0.0-20221213002717-88a4a2c6e77d/pkg/kube/factory.go (about)

     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 "github.com/stefanmcshane/helm/pkg/kube"
    18  
    19  import (
    20  	"k8s.io/cli-runtime/pkg/resource"
    21  	"k8s.io/client-go/discovery"
    22  	"k8s.io/client-go/dynamic"
    23  	"k8s.io/client-go/kubernetes"
    24  	"k8s.io/client-go/tools/clientcmd"
    25  	"k8s.io/kubectl/pkg/validation"
    26  )
    27  
    28  // Factory provides abstractions that allow the Kubectl command to be extended across multiple types
    29  // of resources and different API sets.
    30  type Factory interface {
    31  	// ToRawKubeConfigLoader return kubeconfig loader as-is
    32  	ToRawKubeConfigLoader() clientcmd.ClientConfig
    33  
    34  	// DynamicClient returns a dynamic client ready for use
    35  	DynamicClient() (dynamic.Interface, error)
    36  
    37  	// KubernetesClientSet gives you back an external clientset
    38  	KubernetesClientSet() (*kubernetes.Clientset, error)
    39  
    40  	// NewBuilder returns an object that assists in loading objects from both disk and the server
    41  	// and which implements the common patterns for CLI interactions with generic resources.
    42  	NewBuilder() *resource.Builder
    43  
    44  	// Returns a schema that can validate objects stored on disk.
    45  	Validator(validationDirective string, verifier *resource.QueryParamVerifier) (validation.Schema, error)
    46  	// OpenAPIGetter returns a getter for the openapi schema document
    47  	OpenAPIGetter() discovery.OpenAPISchemaInterface
    48  }