istio

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package istio provides Terratest-style helpers for testing Istio resources in Kubernetes clusters. It offers utility functions to create Istio clients, check resource readiness conditions, and interact with Istio custom resources like ServiceEntries and other networking components.

Index

Constants

This section is empty.

Variables

View Source
var NewClient = newClient

NewClient creates and returns a new Istio Client for use in tests. It initializes the Kubernetes REST configuration and the Istio clientset, failing the test if any errors occur during setup.

Parameters:

  • t: The testing context used for logging and error handling.

Returns:

  • *Client: A pointer to the initialized Istio client.

Functions

func ListAuthorizationPolicies

func ListAuthorizationPolicies(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istiosecurityv1.AuthorizationPolicy

ListAuthorizationPolicies retrieves all Istio AuthorizationPolicy resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list AuthorizationPolicies from.

Returns:

  • A slice of pointers to AuthorizationPolicy objects found in the namespace.

func ListDestinationRules

func ListDestinationRules(t *testing.T, options *k8s.KubectlOptions, namespace string) []*isitonetworkingv1alpha3.DestinationRule

ListDestinationRules retrieves all Istio DestinationRule resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list DestinationRules from.

Returns:

  • A slice of pointers to DestinationRule objects found in the namespace.

func ListEnvoyFilters

func ListEnvoyFilters(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istionetworkingv1alpha3.EnvoyFilter

ListEnvoyFilters retrieves all Istio EnvoyFilter resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list EnvoyFilters from.

Returns:

  • A slice of pointers to EnvoyFilter objects found in the namespace.

func ListGateways

func ListGateways(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istionetworkingv1alpha3.Gateway

ListGateways retrieves all Istio Gateway resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list Gateways from.

Returns:

  • A slice of pointers to Gateway objects found in the namespace.

func ListPeerAuthentications

func ListPeerAuthentications(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istiosecurityv1.PeerAuthentication

ListPeerAuthentications retrieves all Istio PeerAuthentication resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list PeerAuthentications from.

Returns:

  • A slice of pointers to PeerAuthentication objects found in the namespace.

func ListRequestAuthentications

func ListRequestAuthentications(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istiosecurityv1.RequestAuthentication

ListRequestAuthentications retrieves all Istio RequestAuthentication resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list RequestAuthentications from.

Returns:

  • A slice of pointers to RequestAuthentication objects found in the namespace.

func ListServiceEntries

func ListServiceEntries(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istionetworkingv1alpha3.ServiceEntry

ListServiceEntries retrieves all Istio ServiceEntry resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list ServiceEntries from.

Returns:

  • A slice of pointers to ServiceEntry objects found in the namespace.

func ListSidecars

func ListSidecars(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istionetworkingv1alpha3.Sidecar

ListSidecars retrieves all Istio Sidecar resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list Sidecars from.

Returns:

  • A slice of pointers to Sidecar objects found in the namespace.

func ListVirtualServices

func ListVirtualServices(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istionetworkingv1alpha3.VirtualService

ListVirtualServices retrieves all Istio VirtualService resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list VirtualServices from.

Returns:

  • A slice of pointers to VirtualService objects found in the namespace.

func ListWorkloadEntries

func ListWorkloadEntries(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istionetworkingv1alpha3.WorkloadEntry

ListWorkloadEntries retrieves all Istio WorkloadEntry resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list WorkloadEntries from.

Returns:

  • A slice of pointers to WorkloadEntry objects found in the namespace.

func ListWorkloadGroups

func ListWorkloadGroups(t *testing.T, options *k8s.KubectlOptions, namespace string) []*istionetworkingv1alpha3.WorkloadGroup

ListWorkloadGroups retrieves all Istio WorkloadGroup resources in the specified namespace using the provided KubectlOptions. It fails the test if an error occurs.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • namespace: The namespace to list WorkloadGroups from.

Returns:

  • A slice of pointers to WorkloadGroup objects found in the namespace.

func WaitForAuthorizationPolicyReady

func WaitForAuthorizationPolicyReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForAuthorizationPolicyReady waits until the specified AuthorizationPolicy in the given namespace is Ready or the timeout is reached. It polls the AuthorizationPolicy status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the AuthorizationPolicy to check.
  • namespace: The namespace of the AuthorizationPolicy.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForDestinationRuleReady

func WaitForDestinationRuleReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForDestinationRuleReady waits until the specified DestinationRule in the given namespace is Ready or the timeout is reached. It polls the DestinationRule status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the DestinationRule to check.
  • namespace: The namespace of the DestinationRule.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForEnvoyFilterReady

func WaitForEnvoyFilterReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForEnvoyFilterReady waits until the specified EnvoyFilter in the given namespace is Ready or the timeout is reached. It polls the EnvoyFilter status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the EnvoyFilter to check.
  • namespace: The namespace of the EnvoyFilter.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForGatewayReady

func WaitForGatewayReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForGatewayReady waits until the specified Gateway in the given namespace is Ready or the timeout is reached. It polls the Gateway status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the Gateway to check.
  • namespace: The namespace of the Gateway.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForPeerAuthenticationReady

func WaitForPeerAuthenticationReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForPeerAuthenticationReady waits until the specified PeerAuthentication in the given namespace is Ready or the timeout is reached. It polls the PeerAuthentication status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the PeerAuthentication to check.
  • namespace: The namespace of the PeerAuthentication.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForRequestAuthenticationReady

func WaitForRequestAuthenticationReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForRequestAuthenticationReady waits until the specified RequestAuthentication in the given namespace is Ready or the timeout is reached. It polls the RequestAuthentication status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the RequestAuthentication to check.
  • namespace: The namespace of the RequestAuthentication.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForServiceEntryReady

func WaitForServiceEntryReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForServiceEntryReady waits until the specified ServiceEntry in the given namespace is Ready or the timeout is reached. It polls the ServiceEntry status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the ServiceEntry to check.
  • namespace: The namespace of the ServiceEntry.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForSidecarReady

func WaitForSidecarReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForSidecarReady waits until the specified Sidecar in the given namespace is Ready or the timeout is reached. It polls the Sidecar status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the Sidecar to check.
  • namespace: The namespace of the Sidecar.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForVirtualServiceReady

func WaitForVirtualServiceReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForVirtualServiceReady waits until the specified VirtualService in the given namespace is Ready or the timeout is reached. It polls the VirtualService status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the VirtualService to check.
  • namespace: The namespace of the VirtualService.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForWorkloadEntryReady

func WaitForWorkloadEntryReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForWorkloadEntryReady waits until the specified WorkloadEntry in the given namespace is Ready or the timeout is reached. It polls the WorkloadEntry status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the WorkloadEntry to check.
  • namespace: The namespace of the WorkloadEntry.
  • timeout: The maximum duration to wait for the resource to become Ready.

func WaitForWorkloadGroupReady

func WaitForWorkloadGroupReady(t *testing.T, options *k8s.KubectlOptions, name, namespace string, timeout time.Duration)

WaitForWorkloadGroupReady waits until the specified WorkloadGroup in the given namespace is Ready or the timeout is reached. It polls the WorkloadGroup status every 2 seconds and checks for the Ready condition.

Parameters:

  • t: The testing context.
  • options: The kubectl options specifying the context and namespace.
  • name: The name of the WorkloadGroup to check.
  • namespace: The namespace of the WorkloadGroup.
  • timeout: The maximum duration to wait for the resource to become Ready.

Types

This section is empty.

Jump to

Keyboard shortcuts

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