kubernetes

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 34 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConditionsHaveLatestObservedGeneration added in v0.6.0

func ConditionsHaveLatestObservedGeneration(obj metav1.Object, conditions []metav1.Condition) error

func DumpEchoLogs added in v0.7.1

func DumpEchoLogs(ns, name string, c client.Client, cs clientset.Interface) ([][]byte, error)

DumpEchoLogs returns logs of the echoserver pod in in the given namespace and with the given name.

func FilterStaleConditions added in v0.6.0

func FilterStaleConditions(obj metav1.Object, conditions []metav1.Condition) []metav1.Condition

FilterStaleConditions returns the list of status condition whose observedGeneration does not match the object's metadata.Generation

func GWCMustHaveAcceptedConditionAny added in v0.6.1

func GWCMustHaveAcceptedConditionAny(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, gwcName string) string

GWCMustBeAcceptedConditionAny waits until the specified GatewayClass has an Accepted condition set with a status set to any value.

func GWCMustHaveAcceptedConditionTrue added in v0.6.1

func GWCMustHaveAcceptedConditionTrue(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, gwcName string) string

GWCMustBeAcceptedConditionTrue waits until the specified GatewayClass has an Accepted condition set with a status value equal to True.

func GatewayAndHTTPRoutesMustBeAccepted added in v0.6.0

func GatewayAndHTTPRoutesMustBeAccepted(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, controllerName string, gw GatewayRef, routeNNs ...types.NamespacedName) string

GatewayAndHTTPRoutesMustBeAccepted waits until the specified Gateway has an IP address assigned to it and the Route has a ParentRef referring to the Gateway. The test will fail if these conditions are not met before the timeouts.

func GatewayAndTLSRoutesMustBeAccepted added in v0.6.1

func GatewayAndTLSRoutesMustBeAccepted(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, controllerName string, gw GatewayRef, routeNNs ...types.NamespacedName) (string, []v1beta1.Hostname)

GatewayAndTLSRoutesMustBeAccepted waits until the specified Gateway has an IP address assigned to it and the TLSRoute has a ParentRef referring to the Gateway. The test will fail if these conditions are not met before the timeouts.

func GatewayClassMustHaveLatestConditions added in v0.6.0

func GatewayClassMustHaveLatestConditions(t *testing.T, gwc *v1beta1.GatewayClass)

GatewayClassMustHaveLatestConditions will fail the test if there are conditions that were not updated

func GatewayMustHaveLatestConditions added in v0.6.0

func GatewayMustHaveLatestConditions(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, gwNN types.NamespacedName)

GatewayMustHaveLatestConditions waits until the specified Gateway has all conditions updated with the latest observed generation.

func GatewayMustHaveZeroRoutes added in v0.6.0

func GatewayMustHaveZeroRoutes(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, gwName types.NamespacedName)

GatewayMustHaveZeroRoutes validates that the gateway has zero routes attached. The status may indicate a single listener with zero attached routes or no listeners.

func GatewayStatusMustHaveListeners

func GatewayStatusMustHaveListeners(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, gwNN types.NamespacedName, listeners []v1beta1.ListenerStatus)

GatewayStatusMustHaveListeners waits for the specified Gateway to have listeners in status that match the expected listeners. This will cause the test to halt if the specified timeout is exceeded.

func HTTPRouteMustHaveCondition

func HTTPRouteMustHaveCondition(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, routeNN types.NamespacedName, gwNN types.NamespacedName, condition metav1.Condition)

HTTPRouteMustHaveCondition checks that the supplied HTTPRoute has the supplied Condition, halting after the specified timeout is exceeded.

func HTTPRouteMustHaveLatestConditions added in v0.6.0

func HTTPRouteMustHaveLatestConditions(t *testing.T, r *v1beta1.HTTPRoute)

HTTPRouteMustHaveLatestConditions will fail the test if there are conditions that were not updated

func HTTPRouteMustHaveNoAcceptedParents

func HTTPRouteMustHaveNoAcceptedParents(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, routeName types.NamespacedName)

HTTPRouteMustHaveNoAcceptedParents waits for the specified HTTPRoute to have either no parents or a single parent that is not accepted. This is used to validate HTTPRoute errors.

func HTTPRouteMustHaveParents

func HTTPRouteMustHaveParents(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, routeName types.NamespacedName, parents []v1beta1.RouteParentStatus, namespaceRequired bool)

HTTPRouteMustHaveParents waits for the specified HTTPRoute to have parents in status that match the expected parents. This will cause the test to halt if the specified timeout is exceeded.

func HTTPRouteMustHaveResolvedRefsConditionsTrue added in v0.6.2

func HTTPRouteMustHaveResolvedRefsConditionsTrue(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, routeNN types.NamespacedName, gwNN types.NamespacedName)

HTTPRouteMustHaveResolvedRefsConditionsTrue checks that the supplied HTTPRoute has the resolvedRefsCondition set to true.

func MeshNamespacesMustBeReady added in v0.8.0

func MeshNamespacesMustBeReady(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, namespaces []string)

MeshNamespacesMustBeReady waits until all Pods are marked Ready. This is intended to be used for mesh tests and does not require any Gateways to exist. This will cause the test to halt if the specified timeout is exceeded.

func MustCreateSelfSignedCertSecret

func MustCreateSelfSignedCertSecret(t *testing.T, namespace, secretName string, hosts []string) *corev1.Secret

MustCreateSelfSignedCertSecret creates a self-signed SSL certificate and stores it in a secret

func NamespacesMustBeReady

func NamespacesMustBeReady(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, namespaces []string)

NamespacesMustBeReady waits until all Pods are marked Ready and all Gateways are marked Accepted and Programmed in the specified namespace(s). This will cause the test to halt if the specified timeout is exceeded.

func TLSRouteMustHaveCondition added in v0.8.0

func TLSRouteMustHaveCondition(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, routeNN types.NamespacedName, gwNN types.NamespacedName, condition metav1.Condition)

TLSRouteMustHaveCondition checks that the supplied TLSRoute has the supplied Condition, halting after the specified timeout is exceeded.

func TLSRouteMustHaveParents added in v0.6.1

func TLSRouteMustHaveParents(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, routeName types.NamespacedName, parents []v1alpha2.RouteParentStatus, namespaceRequired bool) v1alpha2.TLSRoute

TLSRouteMustHaveParents waits for the specified TLSRoute to have parents in status that match the expected parents, and also returns the TLSRoute. This will cause the test to halt if the specified timeout is exceeded.

func WaitForGatewayAddress

func WaitForGatewayAddress(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, gwName types.NamespacedName) (string, error)

WaitForGatewayAddress waits until at least one IP Address has been set in the status of the specified Gateway.

Types

type Applier

type Applier struct {
	NamespaceLabels      map[string]string
	NamespaceAnnotations map[string]string

	// GatewayClass will be used as the spec.gatewayClassName when applying Gateway resources
	GatewayClass string

	// ControllerName will be used as the spec.controllerName when applying GatewayClass resources
	ControllerName string

	// FS is the filesystem to use when reading manifests.
	FS embed.FS
}

Applier prepares manifests depending on the available options and applies them to the Kubernetes cluster.

func (Applier) MustApplyObjectsWithCleanup

func (a Applier) MustApplyObjectsWithCleanup(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, resources []client.Object, cleanup bool)

func (Applier) MustApplyWithCleanup

func (a Applier) MustApplyWithCleanup(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, location string, cleanup bool)

MustApplyWithCleanup creates or updates Kubernetes resources defined with the provided YAML file and registers a cleanup function for resources it created. Note that this does not remove resources that already existed in the cluster.

type GatewayRef

type GatewayRef struct {
	types.NamespacedName
	// contains filtered or unexported fields
}

GatewayRef is a tiny type for specifying an HTTP Route ParentRef without relying on a specific api version.

func NewGatewayRef

func NewGatewayRef(nn types.NamespacedName, listenerNames ...string) GatewayRef

NewGatewayRef creates a GatewayRef resource. ListenerNames are optional.

Jump to

Keyboard shortcuts

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