kubeapi

package
v4.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigMap

type ConfigMap struct {
	Name, Filename, Data []byte
}

type KubeAPI

type KubeAPI struct {
	Client    *kubernetes.Clientset
	Config    *rest.Config
	Timeout   time.Duration
	InCluster bool
}

KubeAPI is the main data structure containing the various settings required to use the package. All methods use this structure as the receiver.

func New

func New(t time.Duration, inCluster bool) (*KubeAPI, error)

New returns a new instance of KubeAPI.

func (*KubeAPI) CheckPods

func (k *KubeAPI) CheckPods(namespace string, pods []string) error

CheckPods method is a wrapper that checks if a pod is running and ready.

func (*KubeAPI) CreateJob

func (k *KubeAPI) CreateJob(namespace string, job *v1batch.Job) (*v1batch.Job, error)

func (*KubeAPI) CreateNamespace

func (k *KubeAPI) CreateNamespace(name string) (*corev1.Namespace, error)

CreateNamespace method creates a new namespace in Kubernetes.

func (*KubeAPI) DeleteDeployment

func (k *KubeAPI) DeleteDeployment(namespace, deployment string) error

DeleteDeployment method deletes a given deployment in a given namespace.

func (*KubeAPI) DeleteJob

func (k *KubeAPI) DeleteJob(namespace string, job *v1batch.Job) error

func (*KubeAPI) DeleteNamespace

func (k *KubeAPI) DeleteNamespace(name string) error

CreateNamespace method deletes a namespace in Kubernetes.

func (*KubeAPI) DeletePod

func (k *KubeAPI) DeletePod(namespace, pod string) error

DeletePod method deletes a given pod in a given namespace.

func (*KubeAPI) DeleteService

func (k *KubeAPI) DeleteService(namespace, service string) error

GetService method deletes a given service in a given namespace.

func (*KubeAPI) DeleteStatefulSet

func (k *KubeAPI) DeleteStatefulSet(namespace, statefulset string) error

DeleteStatefulSet method deletes a given statefulset in a given namespace.

func (*KubeAPI) Exec

func (k *KubeAPI) Exec(namespace, pod, container string, command []string) (string, string, error)

Exec method runs a command against a container.

func (*KubeAPI) GetConfigMap

func (k *KubeAPI) GetConfigMap(namespace, name string, opts metav1.GetOptions) (*v1.ConfigMap, error)

func (*KubeAPI) GetConfigMaps

func (k *KubeAPI) GetConfigMaps(namespace string, label, field string) ([]ConfigMap, error)

func (*KubeAPI) GetDeployment

func (k *KubeAPI) GetDeployment(namespace, deployment string) (*apps.Deployment, error)

GetDeployment method returns a deployment data structure for a given deployment in a given namespace.

func (*KubeAPI) GetDeploymentPods

func (k *KubeAPI) GetDeploymentPods(namespace, deployment string) ([]string, error)

GetDeploymentPods method returns the pods associated with a given deployment in a given namespace.

func (*KubeAPI) GetJob

func (k *KubeAPI) GetJob(namespace, job string) (*v1batch.Job, error)

GetJob method returns a job data structure for a given job in a given namespace.

func (*KubeAPI) GetPod

func (k *KubeAPI) GetPod(namespace, pod string) (*v1.Pod, error)

GetPod method returns a pod data structure for a given pod in a given namespace.

func (*KubeAPI) GetSecret

func (k *KubeAPI) GetSecret(namespace, name string) (*v1.Secret, error)

func (*KubeAPI) GetService

func (k *KubeAPI) GetService(namespace, service string) (*v1.Service, error)

GetService method returns a given service in a given namespace.

func (*KubeAPI) GetStatefulSet

func (k *KubeAPI) GetStatefulSet(namespace, statefulset string) (*apps.StatefulSet, error)

GetStatefulSet method returns a given statefulset in a given namespace.

func (*KubeAPI) GetStatefulSetPods

func (k *KubeAPI) GetStatefulSetPods(namespace, statefulset string) ([]string, error)

GetStatefulSetPods method returns all the pods associated with a given StatefulSet.

func (*KubeAPI) IsDeploymentReady

func (k *KubeAPI) IsDeploymentReady(namespace, deployment string) (bool, error)

IsDeploymentReady method tests if a deployment is ready to be used.

func (*KubeAPI) IsJobComplete

func (k *KubeAPI) IsJobComplete(namespace string, job *v1batch.Job) error

IsJobComplete method tests if a job has completed successfully.

func (*KubeAPI) IsJobDeleted

func (k *KubeAPI) IsJobDeleted(namespace string, job *v1batch.Job) error

IsJobDeleted method tests if a job has deleted successfully.

func (*KubeAPI) IsPodDeleted

func (k *KubeAPI) IsPodDeleted(namespace, pod string) bool

IsPodDeleted method tests if a pod has been terminated.

func (*KubeAPI) IsPodReady

func (k *KubeAPI) IsPodReady(namespace string, pod string) (bool, error)

IsPodReady method tests if a pod is ready.

func (*KubeAPI) IsPodRunning

func (k *KubeAPI) IsPodRunning(namespace, pod string) (bool, error)

IsPodRunning method tests if a pod is running.

func (*KubeAPI) IsStatefulSetReady

func (k *KubeAPI) IsStatefulSetReady(namespace, statefulset string) (bool, error)

IsStatefulSetReady method tests if a statefulset is ready to use.

func (*KubeAPI) ListConfigMaps

func (k *KubeAPI) ListConfigMaps(namespace string, opts metav1.ListOptions) (*v1.ConfigMapList, error)

func (*KubeAPI) ListDeployments

func (k *KubeAPI) ListDeployments(namespace, label string) (*apps.DeploymentList, error)

func (*KubeAPI) ListPods

func (k *KubeAPI) ListPods(namespace string) (*v1.PodList, error)

ListPods method returns all pods in a given namespace.

func (*KubeAPI) Logs

func (k *KubeAPI) Logs(l *LogOpts, out io.Writer) error

Logs method returns the logs for a container within a pod.

func (*KubeAPI) NewProxy

func (k *KubeAPI) NewProxy(local, remote int, pod, namespace string) (*Proxy, error)

NewProxy method creates a new port forwarding proxy.

type LogOpts

type LogOpts struct {
	Container  string
	Namespace  string
	Pod        string
	Follow     bool
	Previous   bool
	Timestamps bool
}

LogOpts is a data structure used to configure log captures for a container.

type Proxy

type Proxy struct {
	Hostname  string
	Local     int
	Remote    int
	Namespace string
	PodName   string
	Out       io.Writer
	// contains filtered or unexported fields
}

Proxy is a data structure used when configuring a port forward proxy.

func (*Proxy) Close

func (p *Proxy) Close()

Close method cleans up a port forwarding proxy.

func (*Proxy) ForwardPort

func (p *Proxy) ForwardPort() error

ForwardPort method forwards the configured ports configured in an instance of Proxy.

Jump to

Keyboard shortcuts

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