kube

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRESTConfig

func BuildRESTConfig(context, kubeconfig string) (*rest.Config, error)

BuildRESTConfig builds a kubernetes REST client config using the following rules from ToRawKubeConfigLoader()

Types

type Client

type Client struct {
	Config *Config
	// contains filtered or unexported fields
}

Client is a kubernetes client, like `kubectl`

func NewClient

func NewClient(context, kubeconfig string, ui *ui.UI) *Client

NewClient creates a kubernetes client

func NewClientE

func NewClientE(context, kubeconfig string, ui *ui.UI) (*Client, error)

NewClientE creates a kubernetes client, returns an error if fail

func (*Client) Apply

func (c *Client) Apply(name string, content []byte) error

Apply creates a resource with the given content

func (*Client) ApplyFile

func (c *Client) ApplyFile(filename string) error

ApplyFile creates a resource in the given local filename or HTTP URL

func (*Client) ApplyNamespace

func (c *Client) ApplyNamespace(namespace string) error

ApplyNamespace creates the given namespace if does not exists

func (*Client) ApplyResource

func (c *Client) ApplyResource(r *resource.Result) error

ApplyResource creates a resource with the resource.Result

func (*Client) Builder

func (c *Client) Builder() *resource.Builder

Builder creates a builder for the given namespace

func (*Client) ClientSet

func (c *Client) ClientSet() error

ClientSet sets the client set in the config if its not already set

func (*Client) Create

func (c *Client) Create(name string, content []byte) error

Create creates a resource with the given content

func (*Client) CreateFile

func (c *Client) CreateFile(filename string) error

CreateFile creates a resource in the given local filename or HTTP URL

func (*Client) CreateNamespace

func (c *Client) CreateNamespace(namespace string) error

CreateNamespace creates a namespace with the given name

func (*Client) ExistsResource

func (c *Client) ExistsResource(r *resource.Result) (bool, error)

ExistsResource returns true if the resources are found, otherwise returns false and no error. If failed to get the resources, it returns false and the error.

func (*Client) ListConfigMaps

func (c *Client) ListConfigMaps(namespace string) (*corev1.ConfigMapList, error)

ListConfigMaps returns a list of configmaps for a namespace, set to empty string to get from all

func (*Client) ListDaemonSets

func (c *Client) ListDaemonSets(namespace string) (*appsv1.DaemonSetList, error)

ListDaemonSets returns a list of daemonsets for a namespace, set to empty string to get from all

func (*Client) ListDeployments

func (c *Client) ListDeployments(namespace string) (*appsv1.DeploymentList, error)

ListDeployments returns a list of deployments for a namespace, set to empty string to get from all

func (*Client) ListEndpoints

func (c *Client) ListEndpoints(namespace string) (*corev1.EndpointsList, error)

ListEndpoints returns a list of endpoints for a namespace, set to empty string to get from all

func (*Client) ListJobs

func (c *Client) ListJobs(namespace string) (*batchv1.JobList, error)

ListJobs returns a list of jobs for a namespace, set to empty string to get from all

func (*Client) ListNamespaces

func (c *Client) ListNamespaces() (*corev1.NamespaceList, error)

ListNamespaces returns a list of namespaces

func (*Client) ListNodes

func (c *Client) ListNodes() (*corev1.NodeList, error)

ListNodes returns the list of nodes

func (*Client) ListPersistentVolumeClaims

func (c *Client) ListPersistentVolumeClaims(namespace string) (*corev1.PersistentVolumeClaimList, error)

ListPersistentVolumeClaims returns a list of persistent volume claims for a namespace, set to empty string to get from all

func (*Client) ListPersistentVolumes

func (c *Client) ListPersistentVolumes() (*corev1.PersistentVolumeList, error)

ListPersistentVolumes returns a list of persistent volumes

func (*Client) ListPods

func (c *Client) ListPods(namespace string) (*corev1.PodList, error)

ListPods returns a list of pods for a namespace, set to empty string to get from all

func (*Client) ListReplicaSets

func (c *Client) ListReplicaSets(namespace string) (*appsv1.ReplicaSetList, error)

ListReplicaSets returns a list of deployments for a namespace, set to empty string to get from all

func (*Client) ListReplicationControllers

func (c *Client) ListReplicationControllers(namespace string) (*corev1.ReplicationControllerList, error)

ListReplicationControllers returns a list of replication controllers for a namespace, set to empty string to get from all

func (*Client) ListSecrets

func (c *Client) ListSecrets(namespace string) (*corev1.SecretList, error)

ListSecrets returns a list of secrets for a namespace, set to empty string to get from all

func (*Client) ListServiceAccounts

func (c *Client) ListServiceAccounts(namespace string) (*corev1.ServiceAccountList, error)

ListServiceAccounts returns a list of service accounts for a namespace, set to empty string to get from all

func (*Client) ListServices

func (c *Client) ListServices(namespace string) (*corev1.ServiceList, error)

ListServices returns a list of services for a namespace, set to empty string to get from all

func (*Client) ListStatefulSets

func (c *Client) ListStatefulSets(namespace string) (*appsv1.StatefulSetList, error)

ListStatefulSets returns a list of statefulsets for a namespace, set to empty string to get from all

func (*Client) Namespace

func (c *Client) Namespace(namespace string) (*v1.Namespace, error)

Namespace returns the namespace with the given name. If not found returns a IsNotFound error

func (*Client) NodesReady

func (c *Client) NodesReady() (int, int, error)

NodesReady returns the number of nodes ready

func (*Client) ResultForContent

func (c *Client) ResultForContent(name string, content []byte, unstructured bool) *resource.Result

ResultForContent returns the builder results for the given content

func (*Client) ResultForFilenameParam

func (c *Client) ResultForFilenameParam(filenames []string, unstructured bool) *resource.Result

ResultForFilenameParam returns the builder results for the given list of files or URLs

func (*Client) ResultForReader

func (c *Client) ResultForReader(name string, r io.Reader, unstructured bool) *resource.Result

ResultForReader returns the builder results for the given reader

func (*Client) UnstructuredBuilder

func (c *Client) UnstructuredBuilder() *resource.Builder

UnstructuredBuilder creates an unstructure builder for the given namespace

func (*Client) Update

func (c *Client) Update(name string, content []byte) error

Update creates a resource with the given content

func (*Client) UpdateFile

func (c *Client) UpdateFile(filename string) error

UpdateFile creates a resource in the given local filename or HTTP URL

type Config

type Config struct {
	KubeConfig string
	Context    string
	// contains filtered or unexported fields
}

Config is the client configuration. It implements RESTClientGetter

func NewConfig

func NewConfig(context, kubeconfig string) *Config

NewConfig creates a new client configuration

func (*Config) ClientForMapping

func (c *Config) ClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error)

ClientForMapping creates a resource REST client from the given mappings

func (*Config) DynamicClient

func (c *Config) DynamicClient() (dynamic.Interface, error)

DynamicClient creates a dynamic client from the configuration

func (*Config) KubernetesClientSet

func (c *Config) KubernetesClientSet() (*kubernetes.Clientset, error)

KubernetesClientSet creates a kubernetes clientset from the configuration

func (*Config) NewBuilder

func (c *Config) NewBuilder() *resource.Builder

NewBuilder returns a new resource builder for structured api objects.

func (*Config) RESTClient

func (c *Config) RESTClient() (*rest.RESTClient, error)

RESTClient creates a REST client from the configuration

func (*Config) ToDiscoveryClient

func (c *Config) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

ToDiscoveryClient returns a CachedDiscoveryInterface using a computed RESTConfig

func (*Config) ToRESTConfig

func (c *Config) ToRESTConfig() (*rest.Config, error)

ToRESTConfig creates a kubernetes REST client config

func (*Config) ToRESTMapper

func (c *Config) ToRESTMapper() (meta.RESTMapper, error)

ToRESTMapper returns a mapper

func (*Config) ToRawKubeConfigLoader

func (c *Config) ToRawKubeConfigLoader() clientcmd.ClientConfig

ToRawKubeConfigLoader creates a client config using the following rules: 1. builds from the given kubeconfig path, if not empty 2. use the in cluster config if running in-cluster 3. gets the config from KUBECONFIG env var 4. Uses $HOME/.kube/config

func (*Config) UnstructuredClientForMapping

func (c *Config) UnstructuredClientForMapping(mapping *meta.RESTMapping) (resource.RESTClient, error)

UnstructuredClientForMapping creates a unstructured resource REST client from the given mappings

Jump to

Keyboard shortcuts

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