github.com/zsuzhengdu/helm@v3.0.0-beta.3+incompatible/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 "helm.sh/helm/pkg/kube"
    18  
    19  import (
    20  	"k8s.io/cli-runtime/pkg/resource"
    21  	"k8s.io/client-go/kubernetes"
    22  	"k8s.io/client-go/tools/clientcmd"
    23  	"k8s.io/kubernetes/pkg/kubectl/validation"
    24  )
    25  
    26  // Factory provides abstractions that allow the Kubectl command to be extended across multiple types
    27  // of resources and different API sets.
    28  type Factory interface {
    29  	// ToRawKubeConfigLoader return kubeconfig loader as-is
    30  	ToRawKubeConfigLoader() clientcmd.ClientConfig
    31  	// KubernetesClientSet gives you back an external clientset
    32  	KubernetesClientSet() (*kubernetes.Clientset, error)
    33  	// NewBuilder returns an object that assists in loading objects from both disk and the server
    34  	// and which implements the common patterns for CLI interactions with generic resources.
    35  	NewBuilder() *resource.Builder
    36  	// Returns a schema that can validate objects stored on disk.
    37  	Validator(validate bool) (validation.Schema, error)
    38  }