conditions

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GatewayClassReasonGatewayClassConflict indicates there are multiple GatewayClass resources
	// that reference this controller, and we ignored the resource in question and picked the
	// GatewayClass that is referenced in the command-line argument.
	// This reason is used with GatewayClassConditionAccepted (false).
	GatewayClassReasonGatewayClassConflict v1.GatewayClassConditionReason = "GatewayClassConflict"

	// GatewayClassMessageGatewayClassConflict is a message that describes GatewayClassReasonGatewayClassConflict.
	GatewayClassMessageGatewayClassConflict = "The resource is ignored due to a conflicting GatewayClass resource"

	// ListenerReasonUnsupportedValue is used with the "Accepted" condition when a value of a field in a Listener
	// is invalid or not supported.
	ListenerReasonUnsupportedValue v1.ListenerConditionReason = "UnsupportedValue"

	// ListenerMessageFailedNginxReload is a message used with ListenerConditionProgrammed (false)
	// when nginx fails to reload.
	ListenerMessageFailedNginxReload = "The Listener is not programmed due to a failure to " +
		"reload nginx with the configuration"

	// ListenerMessageOverlappingHostnames is a message used with the "OverlappingTLSConfig" condition when the
	// condition is true due to overlapping hostnames.
	ListenerMessageOverlappingHostnames = "Listener hostname overlaps with hostname(s) of other Listener(s) " +
		"on the same port"

	// RouteReasonBackendRefUnsupportedValue is used with the "ResolvedRefs" condition when one of the
	// Route rules has a backendRef with an unsupported value.
	RouteReasonBackendRefUnsupportedValue v1.RouteConditionReason = "UnsupportedValue"

	// RouteReasonInvalidGateway is used with the "Accepted" (false) condition when the Gateway the Route
	// references is invalid.
	RouteReasonInvalidGateway v1.RouteConditionReason = "InvalidGateway"

	// RouteReasonInvalidListener is used with the "Accepted" condition when the Route references an invalid listener.
	RouteReasonInvalidListener v1.RouteConditionReason = "InvalidListener"

	// RouteReasonHostnameConflict is used with the "Accepted" condition when a route has the exact same hostname
	// as another route.
	RouteReasonHostnameConflict v1.RouteConditionReason = "HostnameConflict"

	// RouteReasonUnsupportedConfiguration is used when the associated Gateway does not support the Route.
	// Used with Accepted (false).
	RouteReasonUnsupportedConfiguration v1.RouteConditionReason = "UnsupportedConfiguration"

	// RouteReasonInvalidIPFamily is used when the Service associated with the Route is not configured with
	// the same IP family as the NGINX server.
	// Used with ResolvedRefs (false).
	RouteReasonInvalidIPFamily v1.RouteConditionReason = "InvalidServiceIPFamily"

	// RouteReasonInvalidFilter is used when an extension ref filter referenced by a Route cannot be resolved, or is
	// invalid. Used with ResolvedRefs (false).
	RouteReasonInvalidFilter v1.RouteConditionReason = "InvalidFilter"

	// GatewayReasonUnsupportedValue is used with GatewayConditionAccepted (false) when a value of a field in a Gateway
	// is invalid or not supported.
	GatewayReasonUnsupportedValue v1.GatewayConditionReason = "UnsupportedValue"

	// GatewayMessageFailedNginxReload is a message used with GatewayConditionProgrammed (false)
	// when nginx fails to reload.
	GatewayMessageFailedNginxReload = "The Gateway is not programmed due to a failure to " +
		"reload nginx with the configuration"

	// RouteMessageFailedNginxReload is a message used with RouteReasonGatewayNotProgrammed
	// when nginx fails to reload.
	RouteMessageFailedNginxReload = GatewayMessageFailedNginxReload + ". NGINX may still be configured " +
		"for this Route. However, future updates to this resource will not be configured until the Gateway " +
		"is programmed again"

	// GatewayClassResolvedRefs condition indicates whether the controller was able to resolve the
	// parametersRef on the GatewayClass.
	GatewayClassResolvedRefs v1.GatewayClassConditionType = "ResolvedRefs"

	// GatewayClassReasonResolvedRefs is used with the "GatewayClassResolvedRefs" condition when the condition is true.
	GatewayClassReasonResolvedRefs v1.GatewayClassConditionReason = "ResolvedRefs"

	// GatewayClassReasonParamsRefNotFound is used with the "GatewayClassResolvedRefs" condition when the
	// parametersRef resource does not exist.
	GatewayClassReasonParamsRefNotFound v1.GatewayClassConditionReason = "ParametersRefNotFound"

	// GatewayClassReasonParamsRefInvalid is used with the "GatewayClassResolvedRefs" condition when the
	// parametersRef resource is invalid.
	GatewayClassReasonParamsRefInvalid v1.GatewayClassConditionReason = "ParametersRefInvalid"

	// PolicyReasonNginxProxyConfigNotSet is used with the "PolicyAccepted" condition when the
	// NginxProxy resource is missing or invalid.
	PolicyReasonNginxProxyConfigNotSet v1alpha2.PolicyConditionReason = "NginxProxyConfigNotSet"

	// PolicyMessageNginxProxyInvalid is a message used with the PolicyReasonNginxProxyConfigNotSet reason
	// when the NginxProxy resource is either invalid or not attached.
	PolicyMessageNginxProxyInvalid = "The NginxProxy configuration is either invalid or not attached to the GatewayClass"

	// PolicyMessageTelemetryNotEnabled is a message used with the PolicyReasonNginxProxyConfigNotSet reason
	// when telemetry is not enabled in the NginxProxy resource.
	PolicyMessageTelemetryNotEnabled = "Telemetry is not enabled in the NginxProxy resource"

	// PolicyReasonTargetConflict is used with the "PolicyAccepted" condition when a Route that it targets
	// has an overlapping hostname:port/path combination with another Route.
	PolicyReasonTargetConflict v1alpha2.PolicyConditionReason = "TargetConflict"

	// ClientSettingsPolicyAffected is used with the "PolicyAffected" condition when a
	// ClientSettingsPolicy is applied to a Gateway, HTTPRoute, or GRPCRoute.
	ClientSettingsPolicyAffected v1alpha2.PolicyConditionType = "ClientSettingsPolicyAffected"

	// ObservabilityPolicyAffected is used with the "PolicyAffected" condition when an
	// ObservabilityPolicy is applied to a HTTPRoute, or GRPCRoute.
	ObservabilityPolicyAffected v1alpha2.PolicyConditionType = "ObservabilityPolicyAffected"

	// PolicyAffectedReason is used with the "PolicyAffected" condition when a
	// ObservabilityPolicy or ClientSettingsPolicy is applied to Gateways or Routes.
	PolicyAffectedReason v1alpha2.PolicyConditionReason = "PolicyAffected"

	// GatewayResolvedRefs condition indicates whether the controller was able to resolve the
	// parametersRef on the Gateway.
	GatewayResolvedRefs v1.GatewayConditionType = "ResolvedRefs"

	// GatewayReasonResolvedRefs is used with the "GatewayResolvedRefs" condition when the condition is true.
	GatewayReasonResolvedRefs v1.GatewayConditionReason = "ResolvedRefs"

	// GatewayReasonParamsRefNotFound is used with the "GatewayResolvedRefs" condition when the
	// parametersRef resource does not exist.
	GatewayReasonParamsRefNotFound v1.GatewayConditionReason = "ParametersRefNotFound"

	// GatewayReasonParamsRefInvalid is used with the "GatewayResolvedRefs" condition when the
	// parametersRef resource is invalid.
	GatewayReasonParamsRefInvalid v1.GatewayConditionReason = "ParametersRefInvalid"
)

Variables

This section is empty.

Functions

func ConvertConditions

func ConvertConditions(
	conds []Condition,
	observedGeneration int64,
	transitionTime metav1.Time,
) []metav1.Condition

ConvertConditions converts conditions to Kubernetes API conditions.

func HasMatchingCondition

func HasMatchingCondition(existingConditions []Condition, cond Condition) bool

HasMatchingCondition checks if the given condition matches any of the existing conditions.

Types

type Condition

type Condition struct {
	Type    string
	Status  metav1.ConditionStatus
	Reason  string
	Message string
}

Condition defines a condition to be reported in the status of resources.

func DeduplicateConditions

func DeduplicateConditions(conds []Condition) []Condition

DeduplicateConditions removes duplicate conditions based on the condition type. The last condition wins. The order of conditions is preserved.

func NewClientSettingsPolicyAffected

func NewClientSettingsPolicyAffected() Condition

NewClientSettingsPolicyAffected returns a Condition that indicates that a ClientSettingsPolicy is applied to the resource.

func NewDefaultGatewayClassConditions

func NewDefaultGatewayClassConditions() []Condition

NewDefaultGatewayClassConditions returns Conditions that indicate that the GatewayClass is accepted and that the Gateway API CRD versions are supported.

func NewDefaultGatewayConditions

func NewDefaultGatewayConditions() []Condition

NewDefaultGatewayConditions returns the default Conditions that must be present in the status of a Gateway.

func NewDefaultListenerConditions

func NewDefaultListenerConditions(existingConditions []Condition) []Condition

NewDefaultListenerConditions returns the default Conditions that must be present in the status of a Listener. If existingConditions contains conflict-related conditions (like OverlappingTLSConfig or Conflicted), the NoConflicts condition is excluded to avoid conflicting condition states.

func NewDefaultRouteConditions

func NewDefaultRouteConditions() []Condition

NewDefaultRouteConditions returns the default conditions that must be present in the status of a Route.

func NewGatewayAccepted

func NewGatewayAccepted() Condition

NewGatewayAccepted returns a Condition that indicates the Gateway is accepted.

func NewGatewayAcceptedListenersNotValid

func NewGatewayAcceptedListenersNotValid() Condition

NewGatewayAcceptedListenersNotValid returns a Condition that indicates the Gateway is accepted, but has at least one listener that is invalid.

func NewGatewayClassConflict

func NewGatewayClassConflict() Condition

NewGatewayClassConflict returns a Condition that indicates that the GatewayClass is not accepted due to a conflict with another GatewayClass.

func NewGatewayClassInvalidParameters

func NewGatewayClassInvalidParameters(msg string) Condition

NewGatewayClassInvalidParameters returns a Condition that indicates that the GatewayClass has invalid parameters. We are allowing Accepted to still be true to prevent nullifying the entire config tree if a parametersRef is updated to something invalid.

func NewGatewayClassRefInvalid

func NewGatewayClassRefInvalid(msg string) Condition

NewGatewayClassRefInvalid returns a Condition that indicates that the parametersRef on the GatewayClass could not be resolved because the resource it references is invalid.

func NewGatewayClassRefNotFound

func NewGatewayClassRefNotFound() Condition

NewGatewayClassRefNotFound returns a Condition that indicates that the parametersRef on the GatewayClass could not be resolved.

func NewGatewayClassResolvedRefs

func NewGatewayClassResolvedRefs() Condition

NewGatewayClassResolvedRefs returns a Condition that indicates that the parametersRef on the GatewayClass is resolved.

func NewGatewayClassSupportedVersionBestEffort

func NewGatewayClassSupportedVersionBestEffort(recommendedVersion string) []Condition

NewGatewayClassSupportedVersionBestEffort returns a Condition that indicates that the GatewayClass is accepted, but the Gateway API CRD versions are not supported. This means NGF will attempt to generate configuration, but it does not guarantee support.

func NewGatewayClassUnsupportedVersion

func NewGatewayClassUnsupportedVersion(recommendedVersion string) []Condition

NewGatewayClassUnsupportedVersion returns Conditions that indicate that the GatewayClass is not accepted because the Gateway API CRD versions are not supported. NGF will not generate configuration in this case.

func NewGatewayInvalid

func NewGatewayInvalid(msg string) []Condition

NewGatewayInvalid returns Conditions that indicate the Gateway is not accepted and programmed because it is semantically or syntactically invalid. The provided message contains the details of why the Gateway is invalid.

func NewGatewayInvalidParameters

func NewGatewayInvalidParameters(msg string) Condition

NewGatewayInvalidParameters returns a Condition that indicates that the Gateway has invalid parameters. We are allowing Accepted to still be true to prevent nullifying the entire Gateway config if a parametersRef is updated to something invalid.

func NewGatewayNotAcceptedListenersNotValid

func NewGatewayNotAcceptedListenersNotValid() []Condition

NewGatewayNotAcceptedListenersNotValid returns Conditions that indicate the Gateway is not accepted, because all listeners are invalid.

func NewGatewayNotProgrammedInvalid

func NewGatewayNotProgrammedInvalid(msg string) Condition

NewGatewayNotProgrammedInvalid returns a Condition that indicates the Gateway is not programmed because it is semantically or syntactically invalid. The provided message contains the details of why the Gateway is invalid.

func NewGatewayProgrammed

func NewGatewayProgrammed() Condition

NewGatewayProgrammed returns a Condition that indicates the Gateway is programmed.

func NewGatewayRefInvalid

func NewGatewayRefInvalid(msg string) Condition

NewGatewayRefInvalid returns a Condition that indicates that the parametersRef on the Gateway could not be resolved because the referenced resource is invalid.

func NewGatewayRefNotFound

func NewGatewayRefNotFound() Condition

NewGatewayRefNotFound returns a Condition that indicates that the parametersRef on the Gateway could not be resolved.

func NewGatewayResolvedRefs

func NewGatewayResolvedRefs() Condition

NewGatewayResolvedRefs returns a Condition that indicates that the parametersRef on the Gateway is resolved.

func NewGatewayUnsupportedValue

func NewGatewayUnsupportedValue(msg string) []Condition

NewGatewayUnsupportedValue returns Conditions that indicate that a field of the Gateway has an unsupported value. Unsupported means that the value is not supported by the implementation or invalid.

func NewListenerAccepted

func NewListenerAccepted() Condition

NewListenerAccepted returns a Condition that indicates that the Listener is accepted.

func NewListenerHostnameConflict

func NewListenerHostnameConflict(msg string) []Condition

NewListenerHostnameConflict returns Conditions that indicate multiple Listeners are specified with the same Listener port, but are HTTPS and TLS and have overlapping hostnames.

func NewListenerInvalidCertificateRef

func NewListenerInvalidCertificateRef(msg string) []Condition

NewListenerInvalidCertificateRef returns Conditions that indicate that a CertificateRef of a Listener is invalid.

func NewListenerInvalidRouteKinds

func NewListenerInvalidRouteKinds(msg string) []Condition

NewListenerInvalidRouteKinds returns Conditions that indicate that an invalid or unsupported Route kind is specified by the Listener.

func NewListenerNoConflicts

func NewListenerNoConflicts() Condition

NewListenerNoConflicts returns a Condition that indicates that there are no conflicts in a Listener.

func NewListenerNotProgrammedInvalid

func NewListenerNotProgrammedInvalid(msg string) Condition

NewListenerNotProgrammedInvalid returns a Condition that indicates the Listener is not programmed because it is semantically or syntactically invalid. The provided message contains the details of why the Listener is invalid.

func NewListenerOverlappingTLSConfig

func NewListenerOverlappingTLSConfig(reason v1.ListenerConditionReason, msg string) Condition

NewListenerOverlappingTLSConfig returns a Condition that indicates overlapping TLS configuration between Listeners on the same port.

func NewListenerProgrammed

func NewListenerProgrammed() Condition

NewListenerProgrammed returns a Condition that indicates the Listener is programmed.

func NewListenerProtocolConflict

func NewListenerProtocolConflict(msg string) []Condition

NewListenerProtocolConflict returns Conditions that indicate multiple Listeners are specified with the same Listener port number, but have conflicting protocol specifications.

func NewListenerRefNotPermitted

func NewListenerRefNotPermitted(msg string) []Condition

NewListenerRefNotPermitted returns Conditions that indicates that the Listener references a TLS secret that is not permitted by a ReferenceGrant.

func NewListenerResolvedRefs

func NewListenerResolvedRefs() Condition

NewListenerResolvedRefs returns a Condition that indicates that all references in a Listener are resolved.

func NewListenerUnsupportedProtocol

func NewListenerUnsupportedProtocol(msg string) []Condition

NewListenerUnsupportedProtocol returns Conditions that indicate that the protocol of a Listener is unsupported.

func NewListenerUnsupportedValue

func NewListenerUnsupportedValue(msg string) []Condition

NewListenerUnsupportedValue returns Conditions that indicate that a field of a Listener has an unsupported value. Unsupported means that the value is not supported by the implementation or invalid.

func NewNginxGatewayInvalid

func NewNginxGatewayInvalid(msg string) Condition

NewNginxGatewayInvalid returns a Condition that indicates that the NginxGateway config is invalid.

func NewNginxGatewayValid

func NewNginxGatewayValid() Condition

NewNginxGatewayValid returns a Condition that indicates that the NginxGateway config is valid.

func NewObservabilityPolicyAffected

func NewObservabilityPolicyAffected() Condition

NewObservabilityPolicyAffected returns a Condition that indicates that an ObservabilityPolicy is applied to the resource.

func NewPolicyAccepted

func NewPolicyAccepted() Condition

NewPolicyAccepted returns a Condition that indicates that the Policy is accepted.

func NewPolicyConflicted

func NewPolicyConflicted(msg string) Condition

NewPolicyConflicted returns a Condition that indicates that the Policy is not accepted because it conflicts with another Policy and a merge is not possible.

func NewPolicyInvalid

func NewPolicyInvalid(msg string) Condition

NewPolicyInvalid returns a Condition that indicates that the Policy is not accepted because it is semantically or syntactically invalid.

func NewPolicyNotAcceptedNginxProxyNotSet

func NewPolicyNotAcceptedNginxProxyNotSet(msg string) Condition

NewPolicyNotAcceptedNginxProxyNotSet returns a Condition that indicates that the Policy is not accepted because it relies on the NginxProxy configuration which is missing or invalid.

func NewPolicyNotAcceptedTargetConflict

func NewPolicyNotAcceptedTargetConflict(msg string) Condition

NewPolicyNotAcceptedTargetConflict returns a Condition that indicates that the Policy is not accepted because the target resource has a conflict with another resource when attempting to apply this policy.

func NewPolicyTargetNotFound

func NewPolicyTargetNotFound(msg string) Condition

NewPolicyTargetNotFound returns a Condition that indicates that the Policy is not accepted because the target resource does not exist or can not be attached to.

func NewRouteAccepted

func NewRouteAccepted() Condition

NewRouteAccepted returns a Condition that indicates that the Route is accepted.

func NewRouteBackendRefInvalidKind

func NewRouteBackendRefInvalidKind(msg string) Condition

NewRouteBackendRefInvalidKind returns a Condition that indicates that the Route has a backendRef with an invalid kind.

func NewRouteBackendRefRefBackendNotFound

func NewRouteBackendRefRefBackendNotFound(msg string) Condition

NewRouteBackendRefRefBackendNotFound returns a Condition that indicates that the Route has a backendRef that points to non-existing backend.

func NewRouteBackendRefRefNotPermitted

func NewRouteBackendRefRefNotPermitted(msg string) Condition

NewRouteBackendRefRefNotPermitted returns a Condition that indicates that the Route has a backendRef that is not permitted.

func NewRouteBackendRefUnsupportedProtocol

func NewRouteBackendRefUnsupportedProtocol(msg string) Condition

NewRouteBackendRefUnsupportedProtocol returns a Condition that indicates that the Route has a backendRef with an unsupported protocol.

func NewRouteBackendRefUnsupportedValue

func NewRouteBackendRefUnsupportedValue(msg string) Condition

NewRouteBackendRefUnsupportedValue returns a Condition that indicates that the Route has a backendRef with an unsupported value.

func NewRouteHostnameConflict

func NewRouteHostnameConflict() Condition

NewRouteHostnameConflict returns a Condition that indicates that the Route is not accepted because of a conflicting hostname on the same port.

func NewRouteInvalidGateway

func NewRouteInvalidGateway() Condition

NewRouteInvalidGateway returns a Condition that indicates that the Route is not Accepted because the Gateway it references is invalid.

func NewRouteInvalidIPFamily

func NewRouteInvalidIPFamily(msg string) Condition

NewRouteInvalidIPFamily returns a Condition that indicates that the Service associated with the Route is not configured with the same IP family as the NGINX server.

func NewRouteInvalidListener

func NewRouteInvalidListener() Condition

NewRouteInvalidListener returns a Condition that indicates that the Route is not accepted because of an invalid listener.

func NewRouteNoMatchingListenerHostname

func NewRouteNoMatchingListenerHostname() Condition

NewRouteNoMatchingListenerHostname returns a Condition that indicates that the hostname of the listener does not match the hostnames of the Route.

func NewRouteNoMatchingParent

func NewRouteNoMatchingParent() Condition

NewRouteNoMatchingParent returns a Condition that indicates that the Route is not Accepted because it specifies a Port and/or SectionName that does not match any Listeners in the Gateway.

func NewRouteNotAllowedByListeners

func NewRouteNotAllowedByListeners() Condition

NewRouteNotAllowedByListeners returns a Condition that indicates that the Route is not allowed by any listener.

func NewRoutePartiallyInvalid

func NewRoutePartiallyInvalid(msg string) Condition

NewRoutePartiallyInvalid returns a Condition that indicates that the Route contains a combination of both valid and invalid rules.

// nolint:lll The message must start with "Dropped Rules(s)" according to the Gateway API spec See https://github.com/kubernetes-sigs/gateway-api/blob/37d81593e5a965ed76582dbc1a2f56bbd57c0622/apis/v1/shared_types.go#L408-L413

func NewRouteResolvedRefs

func NewRouteResolvedRefs() Condition

NewRouteResolvedRefs returns a Condition that indicates that all the references on the Route are resolved.

func NewRouteResolvedRefsInvalidFilter

func NewRouteResolvedRefsInvalidFilter(msg string) Condition

NewRouteResolvedRefsInvalidFilter returns a Condition that indicates that the Route has a filter that cannot be resolved or is invalid.

func NewRouteUnsupportedConfiguration

func NewRouteUnsupportedConfiguration(msg string) Condition

NewRouteUnsupportedConfiguration returns a Condition that indicates that the Route is not Accepted because it is incompatible with the Gateway's configuration.

func NewRouteUnsupportedValue

func NewRouteUnsupportedValue(msg string) Condition

NewRouteUnsupportedValue returns a Condition that indicates that the Route includes an unsupported value.

func NewSnippetsFilterAccepted

func NewSnippetsFilterAccepted() Condition

NewSnippetsFilterAccepted returns a Condition that indicates that the SnippetsFilter is accepted because it is valid.

func NewSnippetsFilterInvalid

func NewSnippetsFilterInvalid(msg string) Condition

NewSnippetsFilterInvalid returns a Condition that indicates that the SnippetsFilter is not accepted because it is syntactically or semantically invalid.

Jump to

Keyboard shortcuts

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