kube

package
v0.0.0-...-519b562 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPodReady

func CheckPodReady(pod *kubeApiCore.Pod) error

CheckPodReady returns nil if the given pod and all of its containers are ready.

Types

type Accessor

type Accessor struct {
	// contains filtered or unexported fields
}

Accessor is a helper for accessing Kubernetes programmatically. It bundles some of the high-level operations that is frequently used by the test framework.

func NewAccessor

func NewAccessor(kubeConfig string, baseWorkDir string) (*Accessor, error)

NewAccessor returns a new instance of an accessor.

func (*Accessor) Apply

func (a *Accessor) Apply(namespace string, filename string) error

Apply the config in the given filename using kubectl.

func (*Accessor) ApplyContents

func (a *Accessor) ApplyContents(namespace string, contents string) ([]string, error)

ApplyContents applies the given config contents using kubectl.

func (*Accessor) CreateNamespace

func (a *Accessor) CreateNamespace(ns string, istioTestingAnnotation string, injectionEnabled bool) error

CreateNamespace with the given name. Also adds an "istio-testing" annotation.

func (*Accessor) Delete

func (a *Accessor) Delete(namespace string, filename string) error

Delete the config in the given filename using kubectl.

func (*Accessor) DeleteContents

func (a *Accessor) DeleteContents(namespace string, contents string) error

DeleteContents deletes the given config contents using kubectl.

func (*Accessor) DeleteCustomResourceDefinitions

func (a *Accessor) DeleteCustomResourceDefinitions(name string) error

DeleteCustomResourceDefinitions deletes the CRD with the given name.

func (*Accessor) DeleteNamespace

func (a *Accessor) DeleteNamespace(ns string) error

DeleteNamespace with the given name

func (*Accessor) DeletePod

func (a *Accessor) DeletePod(namespace, name string) error

DeletePod deletes the given pod.

func (*Accessor) DeleteValidatingWebhook

func (a *Accessor) DeleteValidatingWebhook(name string) error

DeleteValidatingWebhook deletes the validating webhook with the given name.

func (*Accessor) Exec

func (a *Accessor) Exec(namespace, pod, container, command string) (string, error)

Exec executes the provided command on the specified pod/container.

func (*Accessor) FindPodBySelectors

func (a *Accessor) FindPodBySelectors(namespace string, selectors ...string) (kubeApiCore.Pod, error)

FindPodBySelectors returns the first matching pod, given a namespace and a set of selectors.

func (*Accessor) GetCustomResourceDefinitions

func (a *Accessor) GetCustomResourceDefinitions() ([]kubeApiExt.CustomResourceDefinition, error)

GetCustomResourceDefinitions gets the CRDs

func (*Accessor) GetEndpoints

func (a *Accessor) GetEndpoints(ns, service string, options kubeApiMeta.GetOptions) (*kubeApiCore.Endpoints, error)

GetEndpoints returns the endpoints for the given service.

func (*Accessor) GetPod

func (a *Accessor) GetPod(namespace, name string) (*kubeApiCore.Pod, error)

GetPod returns the pod with the given namespace and name.

func (*Accessor) GetPods

func (a *Accessor) GetPods(namespace string, selectors ...string) ([]kubeApiCore.Pod, error)

GetPods returns pods in the given namespace, based on the selectors. If no selectors are given, then all pods are returned.

func (*Accessor) GetSecret

func (a *Accessor) GetSecret(ns string) kubeClientCore.SecretInterface

GetSecret returns secret resource with the given namespace.

func (*Accessor) GetService

func (a *Accessor) GetService(ns string, name string) (*kubeApiCore.Service, error)

GetService returns the service entry with the given name/namespace.

func (*Accessor) Logs

func (a *Accessor) Logs(namespace string, pod string, container string) (string, error)

Logs calls the logs command for the specified pod, with -c, if container is specified.

func (*Accessor) NamespaceExists

func (a *Accessor) NamespaceExists(ns string) bool

NamespaceExists returns true if the given namespace exists.

func (*Accessor) NewPodFetch

func (a *Accessor) NewPodFetch(namespace string, selectors ...string) PodFetchFunc

NewPodFetch creates a new PodFetchFunction that fetches all pods matching the namespace and label selectors.

func (*Accessor) NewPortForwarder

func (a *Accessor) NewPortForwarder(options *PodSelectOptions, localPort, remotePort uint16) (PortForwarder, error)

NewPortForwarder creates a new port forwarder.

func (*Accessor) NewSinglePodFetch

func (a *Accessor) NewSinglePodFetch(namespace string, selectors ...string) PodFetchFunc

NewSinglePodFetch creates a new PodFetchFunction that fetches a single pod matching the given label selectors.

func (*Accessor) ValidatingWebhookConfigurationExists

func (a *Accessor) ValidatingWebhookConfigurationExists(name string) bool

ValidatingWebhookConfigurationExists indicates whether a mutating validating with the given name exists.

func (*Accessor) WaitForNamespaceDeletion

func (a *Accessor) WaitForNamespaceDeletion(ns string, opts ...retry.Option) error

WaitForNamespaceDeletion waits until a namespace is deleted.

func (*Accessor) WaitForValidatingWebhookDeletion

func (a *Accessor) WaitForValidatingWebhookDeletion(name string, opts ...retry.Option) error

WaitForValidatingWebhookDeletion waits for the validating webhook with the given name to be garbage collected by kubernetes.

func (*Accessor) WaitUntilDaemonSetIsReady

func (a *Accessor) WaitUntilDaemonSetIsReady(ns string, name string, opts ...retry.Option) error

WaitUntilDaemonSetIsReady waits until the deployment with the name/namespace is in ready state.

func (*Accessor) WaitUntilDeploymentIsReady

func (a *Accessor) WaitUntilDeploymentIsReady(ns string, name string, opts ...retry.Option) error

WaitUntilDeploymentIsReady waits until the deployment with the name/namespace is in ready state.

func (*Accessor) WaitUntilPodsAreDeleted

func (a *Accessor) WaitUntilPodsAreDeleted(fetchFunc PodFetchFunc, opts ...retry.Option) error

WaitUntilPodsAreDeleted waits until the pod with the name/namespace no longer exist.

func (*Accessor) WaitUntilPodsAreReady

func (a *Accessor) WaitUntilPodsAreReady(fetchFunc PodFetchFunc, opts ...retry.Option) error

WaitUntilPodsAreReady waits until the pod with the name/namespace is in ready state.

type PodFetchFunc

type PodFetchFunc func() ([]kubeApiCore.Pod, error)

PodFetchFunc fetches pods from the Accessor.

type PodSelectOptions

type PodSelectOptions struct {
	PodNamespace  string
	PodName       string
	LabelSelector string
}

PodSelectOptions contains options for pod selection. Must specify PodNamespace and one of PodName/LabelSelector.

type PortForwarder

type PortForwarder interface {
	io.Closer
	// Start the forwarder.
	Start() error
	// Address returns the local forwarded address. Only valid while the forwarder is running.
	Address() string
}

PortForwarder manages the forwarding of a single port.

Jump to

Keyboard shortcuts

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