istio: istio.io/istio/pkg/test/kube Index | Files

package kube

import "istio.io/istio/pkg/test/kube"

Index

Package Files

accessor.go kubectl.go port_forwarder.go

func CheckPodReady Uses

func CheckPodReady(pod *kubeApiCore.Pod) error

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

type Accessor Uses

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 Uses

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

NewAccessor returns a new instance of an accessor.

func (*Accessor) Apply Uses

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

Apply the config in the given filename using kubectl.

func (*Accessor) ApplyContents Uses

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

ApplyContents applies the given config contents using kubectl.

func (*Accessor) CheckPodsAreReady Uses

func (a *Accessor) CheckPodsAreReady(fetchFunc PodFetchFunc) ([]kubeApiCore.Pod, error)

CheckPodsAreReady checks whether the pods that are selected by the given function is in ready state or not.

func (*Accessor) CreateNamespace Uses

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

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

func (*Accessor) CreateNamespaceWithLabels Uses

func (a *Accessor) CreateNamespaceWithLabels(ns string, istioTestingAnnotation string, labels map[string]string) error

CreateNamespaceWithLabels with the specified name, sidecar-injection behavior, and labels

func (*Accessor) CreateSecret Uses

func (a *Accessor) CreateSecret(namespace string, secret *kubeApiCore.Secret) (err error)

CreateSecret takes the representation of a secret and creates it in the given namespace. Returns an error if there is any.

func (*Accessor) Delete Uses

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

Delete the config in the given filename using kubectl.

func (*Accessor) DeleteContents Uses

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

DeleteContents deletes the given config contents using kubectl.

func (*Accessor) DeleteCustomResourceDefinitions Uses

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

DeleteCustomResourceDefinitions deletes the CRD with the given name.

func (*Accessor) DeleteDeployment Uses

func (a *Accessor) DeleteDeployment(ns string, name string) error

DeleteDeployment deletes the given deployment.

func (*Accessor) DeleteNamespace Uses

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

DeleteNamespace with the given name

func (*Accessor) DeletePod Uses

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

DeletePod deletes the given pod.

func (*Accessor) DeleteSecret Uses

func (a *Accessor) DeleteSecret(namespace, name string) (err error)

DeleteSecret deletes secret by name in namespace.

func (*Accessor) DeleteValidatingWebhook Uses

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

DeleteValidatingWebhook deletes the validating webhook with the given name.

func (*Accessor) Exec Uses

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

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

func (*Accessor) FindPodBySelectors Uses

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 Uses

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

GetCustomResourceDefinitions gets the CRDs

func (*Accessor) GetEndpoints Uses

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

GetEndpoints returns the endpoints for the given service.

func (*Accessor) GetEvents Uses

func (a *Accessor) GetEvents(namespace string, involvedObject string) ([]kubeApiCore.Event, error)

GetEvents returns events in the given namespace, based on the involvedObject.

func (*Accessor) GetKubernetesVersion Uses

func (a *Accessor) GetKubernetesVersion() (*version.Info, error)

GetKubernetesVersion returns the Kubernetes server version

func (*Accessor) GetNamespace Uses

func (a *Accessor) GetNamespace(ns string) (*kubeApiCore.Namespace, error)

GetNamespace returns the K8s namespaceresource with the given name.

func (*Accessor) GetPod Uses

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

GetPod returns the pod with the given namespace and name.

func (*Accessor) GetPods Uses

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 Uses

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

GetSecret returns secret resource with the given namespace.

func (*Accessor) GetService Uses

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

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

func (*Accessor) GetServiceAccount Uses

func (a *Accessor) GetServiceAccount(namespace string) kubeClientCore.ServiceAccountInterface

func (*Accessor) GetUnstructured Uses

func (a *Accessor) GetUnstructured(gvr schema.GroupVersionResource, namespace, name string) (*unstructured.Unstructured, error)

GetUnstructured returns an unstructured k8s resource object based on the provided schema, namespace, and name.

func (*Accessor) GetValidatingWebhookConfiguration Uses

func (a *Accessor) GetValidatingWebhookConfiguration(name string) (*kubeApiAdmissions.ValidatingWebhookConfiguration, error)

GetValidatingWebhookConfigurationreturns the specified ValidatingWebhookConfiguration.

func (*Accessor) Logs Uses

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

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

func (*Accessor) NamespaceExists Uses

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

NamespaceExists returns true if the given namespace exists.

func (*Accessor) NewPodFetch Uses

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 Uses

func (a *Accessor) NewPortForwarder(pod kubeApiCore.Pod, localPort, remotePort uint16) (PortForwarder, error)

NewPortForwarder creates a new port forwarder.

func (*Accessor) NewSinglePodFetch Uses

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) ScaleDeployment Uses

func (a *Accessor) ScaleDeployment(namespace, deployment string, replicas int) error

ScaleDeployment scales a deployment to the specified number of replicas.

func (*Accessor) ValidatingWebhookConfigurationExists Uses

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

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

func (*Accessor) WaitForNamespaceDeletion Uses

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

WaitForNamespaceDeletion waits until a namespace is deleted.

func (*Accessor) WaitForValidatingWebhookDeletion Uses

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 Uses

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 Uses

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 Uses

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 Uses

func (a *Accessor) WaitUntilPodsAreReady(fetchFunc PodFetchFunc, opts ...retry.Option) ([]kubeApiCore.Pod, error)

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

func (*Accessor) WaitUntilServiceEndpointsAreReady Uses

func (a *Accessor) WaitUntilServiceEndpointsAreReady(ns string, name string, opts ...retry.Option) (*kubeApiCore.Service, *kubeApiCore.Endpoints, error)

WaitUntilServiceEndpointsAreReady will wait until the service with the given name/namespace is present, and have at least one usable endpoint.

type PodFetchFunc Uses

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

PodFetchFunc fetches pods from the Accessor.

type PortForwarder Uses

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.

Package kube imports 36 packages (graph) and is imported by 18 packages. Updated 2019-10-14. Refresh now. Tools for package owners.