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

package kube

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

Index

Package Files

dump.go mock_client.go util.go

func CheckPodsAreReady Uses

func 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 DeleteOptionsForeground Uses

func DeleteOptionsForeground() kubeApiMeta.DeleteOptions

DeleteOptionsForeground creates new delete options that will block until the operation completes.

func DumpNdsz Uses

func DumpNdsz(_ resource.Context, c resource.Cluster, workDir string, _ string, pods ...corev1.Pod)

func DumpPodEvents Uses

func DumpPodEvents(_ resource.Context, c resource.Cluster, workDir, namespace string, pods ...corev1.Pod)

DumpPodEvents dumps the pod events for either the provided pods or all pods in the namespace if none are provided.

func DumpPodLogs Uses

func DumpPodLogs(_ resource.Context, c resource.Cluster, workDir, namespace string, pods ...corev1.Pod)

DumpPodLogs will dump logs from each container in each of the provided pods or all pods in the namespace if none are provided.

func DumpPodProxies Uses

func DumpPodProxies(_ resource.Context, c resource.Cluster, workDir, namespace string, pods ...corev1.Pod)

DumpPodProxies will dump Envoy proxy config and clusters in each of the provided pods or all pods in the namespace if none are provided.

func DumpPodState Uses

func DumpPodState(_ resource.Context, c resource.Cluster, workDir string, namespace string, pods ...corev1.Pod)

DumpPodState dumps the pod state for either the provided pods or all pods in the namespace if none are provided.

func DumpPods Uses

func DumpPods(ctx resource.Context, workDir, namespace string, dumpers ...PodDumper)

DumpPods runs each dumper with all the pods in the given namespace. If no dumpers are provided, their resource state, events, container logs and Envoy information will be dumped.

func NamespaceExists Uses

func NamespaceExists(a kubernetes.Interface, ns string) bool

NamespaceExists returns true if the given namespace exists.

func WaitForNamespaceDeletion Uses

func WaitForNamespaceDeletion(a kubernetes.Interface, ns string, opts ...retry.Option) error

WaitForNamespaceDeletion waits until a namespace is deleted.

func WaitForSecretToExist Uses

func WaitForSecretToExist(a kubernetes.Interface, namespace, name string, waitTime time.Duration) (*kubeApiCore.Secret, error)

WaitForSecretToExist waits for the given secret up to the given waitTime.

func WaitForSecretToExistOrFail Uses

func WaitForSecretToExistOrFail(t test.Failer, a kubernetes.Interface, namespace, name string,
    waitTime time.Duration) *kubeApiCore.Secret

WaitForSecretToExistOrFail calls WaitForSecretToExist and fails the given test.Failer if an error occurs.

func WaitUntilPodsAreReady Uses

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

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

func WaitUntilServiceEndpointsAreReady Uses

func WaitUntilServiceEndpointsAreReady(a kubernetes.Interface, 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 MockClient Uses

type MockClient struct {
    kubernetes.Interface
    RestClient *rest.RESTClient
    // Results is a map of podName to the results of the expected test on the pod
    Results          map[string][]byte
    DiscoverablePods map[string]map[string]*v1.PodList
    RevisionValue    string
    ConfigValue      *rest.Config
    IstioVersions    *version.MeshInfo
}

MockClient for tests that rely on kube.Client.

func (MockClient) AllDiscoveryDo Uses

func (c MockClient) AllDiscoveryDo(_ context.Context, _, _ string) (map[string][]byte, error)

func (MockClient) ApplyYAMLFiles Uses

func (c MockClient) ApplyYAMLFiles(string, ...string) error

func (MockClient) ApplyYAMLFilesDryRun Uses

func (c MockClient) ApplyYAMLFilesDryRun(string, ...string) error

func (MockClient) CreatePerRPCCredentials Uses

func (c MockClient) CreatePerRPCCredentials(ctx context.Context, tokenNamespace, tokenServiceAccount string, audiences []string,
    expirationSeconds int64) (credentials.PerRPCCredentials, error)

CreatePerRPCCredentials -- when implemented -- mocks per-RPC credentials (bearer token)

func (MockClient) DeleteYAMLFiles Uses

func (c MockClient) DeleteYAMLFiles(string, ...string) error

func (MockClient) DeleteYAMLFilesDryRun Uses

func (c MockClient) DeleteYAMLFilesDryRun(string, ...string) error

func (MockClient) Dynamic Uses

func (c MockClient) Dynamic() dynamic.Interface

func (MockClient) DynamicClient Uses

func (c MockClient) DynamicClient() dynamic.Interface

func (MockClient) DynamicInformer Uses

func (c MockClient) DynamicInformer() dynamicinformer.DynamicSharedInformerFactory

func (MockClient) EnvoyDo Uses

func (c MockClient) EnvoyDo(_ context.Context, podName, _, _, _ string, _ []byte) ([]byte, error)

func (MockClient) Ext Uses

func (c MockClient) Ext() clientset.Interface

func (MockClient) GetIstioPods Uses

func (c MockClient) GetIstioPods(_ context.Context, _ string, _ map[string]string) ([]v1.Pod, error)

func (MockClient) GetIstioVersions Uses

func (c MockClient) GetIstioVersions(_ context.Context, _ string) (*version.MeshInfo, error)

func (MockClient) GetKubernetesVersion Uses

func (c MockClient) GetKubernetesVersion() (*kubeVersion.Info, error)

func (MockClient) Istio Uses

func (c MockClient) Istio() istioclient.Interface

func (MockClient) IstioInformer Uses

func (c MockClient) IstioInformer() istioinformer.SharedInformerFactory

func (MockClient) Kube Uses

func (c MockClient) Kube() kubernetes.Interface

func (MockClient) KubeInformer Uses

func (c MockClient) KubeInformer() informers.SharedInformerFactory

func (MockClient) Metadata Uses

func (c MockClient) Metadata() metadata.Interface

func (MockClient) MetadataClient Uses

func (c MockClient) MetadataClient() metadata.Interface

func (MockClient) MetadataInformer Uses

func (c MockClient) MetadataInformer() metadatainformer.SharedInformerFactory

func (MockClient) NewPortForwarder Uses

func (c MockClient) NewPortForwarder(_, _, _ string, _, _ int) (kube.PortForwarder, error)

func (MockClient) PodExec Uses

func (c MockClient) PodExec(_, _, _ string, _ string) (string, string, error)

func (MockClient) PodLogs Uses

func (c MockClient) PodLogs(_ context.Context, _ string, _ string, _ string, _ bool) (string, error)

func (MockClient) PodsForSelector Uses

func (c MockClient) PodsForSelector(_ context.Context, namespace string, labelSelectors ...string) (*v1.PodList, error)

func (MockClient) REST Uses

func (c MockClient) REST() rest.Interface

func (MockClient) RESTConfig Uses

func (c MockClient) RESTConfig() *rest.Config

func (MockClient) Revision Uses

func (c MockClient) Revision() string

func (MockClient) RunAndWait Uses

func (c MockClient) RunAndWait(stop <-chan struct{})

func (MockClient) ServiceApis Uses

func (c MockClient) ServiceApis() serviceapisclient.Interface

func (MockClient) ServiceApisInformer Uses

func (c MockClient) ServiceApisInformer() serviceapisinformer.SharedInformerFactory

func (MockClient) UtilFactory Uses

func (c MockClient) UtilFactory() util.Factory

UtilFactory mock's kubectl's utility factory. This code sets up a fake factory, similar to the one in https://github.com/kubernetes/kubectl/blob/master/pkg/cmd/describe/describe_test.go

type MockPortForwarder Uses

type MockPortForwarder struct {
}

func (MockPortForwarder) Address Uses

func (m MockPortForwarder) Address() string

func (MockPortForwarder) Close Uses

func (m MockPortForwarder) Close()

func (MockPortForwarder) Start Uses

func (m MockPortForwarder) Start() error

func (MockPortForwarder) WaitForStop Uses

func (m MockPortForwarder) WaitForStop()

type PodDumper Uses

type PodDumper func(ctx resource.Context, cluster resource.Cluster, workDir string, namespace string, pods ...corev1.Pod)

PodDumper will dump information from all the pods into the given workDir. If no pods are provided, client will be used to fetch all the pods in a namespace.

type PodFetchFunc Uses

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

PodFetchFunc fetches pods from a k8s Client.

func NewPodFetch Uses

func NewPodFetch(a istioKube.ExtendedClient, namespace string, selectors ...string) PodFetchFunc

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

func NewPodMustFetch Uses

func NewPodMustFetch(a istioKube.ExtendedClient, namespace string, selectors ...string) PodFetchFunc

NewPodMustFetch creates a new PodFetchFunction that fetches all pods matching the namespace and label selectors. If no pods are found, an error is returned

func NewSinglePodFetch Uses

func NewSinglePodFetch(a istioKube.ExtendedClient, namespace string, selectors ...string) PodFetchFunc

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

Package kube imports 38 packages (graph) and is imported by 17 packages. Updated 2021-01-22. Refresh now. Tools for package owners.