kubernetes

package
v0.1.0-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

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

func GetContextsFromBytes(bytes []byte, allowedContexts []string) ([]models.Context, error)

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

func GetAgentInClusterConfig() (*Agent, error)

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

func GetAgentTesting(objects ...runtime.Object) *Agent

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL