GatewayExcludedFromReadinessChecks is an annotation that can be placed on a Gateway provided via the tests to indicate that it is NOT expected to be Accepted or Provisioned in its default state. This is generally helpful for tests which validate fixing broken Gateways, e.t.c.
const GatewayExcludedFromReadinessChecks = "gateway-api/skip-this-for-readiness"
func ConditionsHaveLatestObservedGeneration(obj metav1.Object, conditions []metav1.Condition) error
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(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(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(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(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, controllerName string, gw GatewayRef, routeNNs ...types.NamespacedName) string
GatewayAndHTTPRoutesMustBeAccepted waits until:
The test will fail if these conditions are not met before the timeouts.
func GatewayAndTLSRoutesMustBeAccepted(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, controllerName string, gw GatewayRef, routeNNs ...types.NamespacedName) (string, []gatewayv1.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(t *testing.T, gwc *gatewayv1.GatewayClass)
GatewayClassMustHaveLatestConditions will fail the test if there are conditions that were not updated
func GatewayListenersMustHaveConditions(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, gwName types.NamespacedName, conditions []metav1.Condition)
GatewayListenersMustHaveConditions checks if every listener of the specified gateway has all the specified conditions.
func GatewayMustHaveCondition( t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, gwNN types.NamespacedName, expectedCondition metav1.Condition, )
GatewayMustHaveCondition checks that the supplied Gateway has the supplied Condition, halting after the specified timeout is exceeded.
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(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(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, gwNN types.NamespacedName, listeners []gatewayv1.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(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(t *testing.T, r *gatewayv1.HTTPRoute)
HTTPRouteMustHaveLatestConditions will fail the test if there are conditions that were not updated
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(t *testing.T, client client.Client, timeoutConfig config.TimeoutConfig, routeName types.NamespacedName, parents []gatewayv1.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(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(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(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(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(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(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(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.
Applier prepares manifests depending on the available options and applies them to the Kubernetes cluster.
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 // UsableNetworkAddresses is a list of addresses that are expected to be // supported AND usable for Gateways in the underlying implementation. UsableNetworkAddresses []v1beta1.GatewayAddress // UnusableNetworkAddresses is a list of addresses that are expected to be // supported, but not usable for Gateways in the underlying implementation. UnusableNetworkAddresses []v1beta1.GatewayAddress }
func (a Applier) MustApplyObjectsWithCleanup(t *testing.T, c client.Client, timeoutConfig config.TimeoutConfig, resources []client.Object, cleanup bool)
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.
GatewayRef is a tiny type for specifying an HTTP Route ParentRef without relying on a specific api version.
type GatewayRef struct { types.NamespacedName // contains filtered or unexported fields }
func NewGatewayRef(nn types.NamespacedName, listenerNames ...string) GatewayRef
NewGatewayRef creates a GatewayRef resource. ListenerNames are optional.