Documentation ¶
Index ¶
- func GetConfigFromHostWithCertData(kubeconfigPath string, allowedContexts []string) (clientcmd.ClientConfig, error)
- func GetContextsFromBytes(bytes []byte, allowedContexts []string) ([]models.Context, error)
- func GetRestrictedClientConfigFromBytes(bytes []byte, contextName string, allowedContexts []string) (clientcmd.ClientConfig, error)
- type Agent
- type OutOfClusterConfig
- func (conf *OutOfClusterConfig) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
- func (conf *OutOfClusterConfig) ToRESTConfig() (*rest.Config, error)
- func (conf *OutOfClusterConfig) ToRESTMapper() (meta.RESTMapper, error)
- func (conf *OutOfClusterConfig) ToRawKubeConfigLoader() clientcmd.ClientConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigFromHostWithCertData ¶
func GetConfigFromHostWithCertData(kubeconfigPath string, allowedContexts []string) (clientcmd.ClientConfig, error)
GetConfigFromHostWithCertData gets the kubeconfig using default options set on the host: the kubeconfig can either be retrieved from a specified path or an environment variable. This function only outputs a clientcmd that uses the allowedContexts.
This function also populates all of the certificate data that's specified as a filepath.
func GetContextsFromBytes ¶
GetContextsFromBytes converts a raw string to a set of Contexts by unmarshaling and calling toContexts
func GetRestrictedClientConfigFromBytes ¶
func GetRestrictedClientConfigFromBytes( bytes []byte, contextName string, allowedContexts []string, ) (clientcmd.ClientConfig, error)
GetRestrictedClientConfigFromBytes returns a clientcmd.ClientConfig from a raw kubeconfig, a context name, and the set of allowed contexts.
Types ¶
type Agent ¶
type Agent struct { RESTClientGetter genericclioptions.RESTClientGetter Clientset kubernetes.Interface }
Agent is a Kubernetes agent for performing operations that interact with the api server
func GetAgentInClusterConfig ¶
GetAgentInClusterConfig uses the service account that kubernetes gives to pods to connect
func GetAgentOutOfClusterConfig ¶
func GetAgentOutOfClusterConfig(conf *OutOfClusterConfig) (*Agent, error)
GetAgentOutOfClusterConfig creates a new Agent using the OutOfClusterConfig
func GetAgentTesting ¶
GetAgentTesting creates a new Agent using an optional existing storage class
func (*Agent) ListNamespaces ¶
func (a *Agent) ListNamespaces() (*v1.NamespaceList, error)
ListNamespaces simply lists namespaces
type OutOfClusterConfig ¶
type OutOfClusterConfig struct { KubeConfig []byte AllowedContexts []string Context string `json:"context" form:"required"` }
OutOfClusterConfig is the set of parameters required for an out-of-cluster connection. This implements RESTClientGetter
func (*OutOfClusterConfig) ToDiscoveryClient ¶
func (conf *OutOfClusterConfig) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
ToDiscoveryClient returns a CachedDiscoveryInterface using a computed RESTConfig It's required to implement the interface genericclioptions.RESTClientGetter
func (*OutOfClusterConfig) ToRESTConfig ¶
func (conf *OutOfClusterConfig) ToRESTConfig() (*rest.Config, error)
ToRESTConfig creates a kubernetes REST client factory -- it simply calls ClientConfig on the result of ToRawKubeConfigLoader
func (*OutOfClusterConfig) ToRESTMapper ¶
func (conf *OutOfClusterConfig) ToRESTMapper() (meta.RESTMapper, error)
ToRESTMapper returns a mapper
func (*OutOfClusterConfig) ToRawKubeConfigLoader ¶
func (conf *OutOfClusterConfig) ToRawKubeConfigLoader() clientcmd.ClientConfig
ToRawKubeConfigLoader creates a clientcmd.ClientConfig from the raw kubeconfig found in the OutOfClusterConfig. It does not implement loading rules or overrides.