status

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Route configuration related reasons
	RouteReasonUnsupportedSetting  gwapiv1.RouteConditionReason = "UnsupportedValue"
	RouteReasonUnsupportedRefValue gwapiv1.RouteConditionReason = "UnsupportedRefValue"

	// Backend reference related reasons
	RouteReasonInvalidBackendRef     gwapiv1.RouteConditionReason = "InvalidBackendRef"
	RouteReasonInvalidBackendTLS     gwapiv1.RouteConditionReason = "InvalidBackendTLS"
	RouteReasonInvalidBackendFilters gwapiv1.RouteConditionReason = "InvalidBackendFilters"

	// Network configuration related reasons
	RouteReasonPortNotFound           gwapiv1.RouteConditionReason = "PortNotFound"
	RouteReasonPortNotSpecified       gwapiv1.RouteConditionReason = "PortNotSpecified"
	RouteReasonUnsupportedAddressType gwapiv1.RouteConditionReason = "UnsupportedAddressType"
	RouteReasonInvalidAddress         gwapiv1.RouteConditionReason = "InvalidAddress"
	RouteReasonEndpointsNotFound      gwapiv1.RouteConditionReason = "EndpointsNotFound"

	// Network configuration related condition types
	RouteConditionBackendsAvailable gwapiv1.RouteConditionType = "BackendsAvailable"
)

Route condition reasons for various error scenarios

View Source
const (
	ReasonOlderGatewayClassExists gwapiv1.GatewayClassConditionReason = "OlderGatewayClassExists"

	MsgOlderGatewayClassExists   = "Invalid GatewayClass: another older GatewayClass with the same Spec.Controller exists"
	MsgValidGatewayClass         = "Valid GatewayClass"
	MsgGatewayClassInvalidParams = "Invalid parametersRef"
)

Variables

This section is empty.

Functions

func ConvertToAcceptedReason added in v1.4.0

func ConvertToAcceptedReason(reason gwapiv1.RouteConditionReason) gwapiv1.RouteConditionReason

ConvertToAcceptedReason converts ResolvedRefs reasons to Accepted condition reasons This is used to make the reasons compatible with the Gateway API spec. For example, the BackendRefs validation may return a InvalidBackendRef reason for a Mirror filter validation, but this error should be reflected in the Accepted condition as UnsupportedValue.

func Error2ConditionMsg

func Error2ConditionMsg(err error) string

Error2ConditionMsg format the error string to a Status condition message. * Convert the first letter to capital * Append "." to the string if it doesn't exist

func GatewayAccepted added in v1.3.0

func GatewayAccepted(gw *gwapiv1.Gateway) bool

func GatewayNotAccepted added in v1.3.0

func GatewayNotAccepted(gw *gwapiv1.Gateway) bool

func GetGatewayListenerStatusConditions added in v1.4.0

func GetGatewayListenerStatusConditions(gateway *gwapiv1.Gateway, listenerStatusIdx int) []metav1.Condition

GetGatewayListenerStatusConditions returns the status conditions for a specific listener in the gateway status.

func MergeConditions

func MergeConditions(conditions []metav1.Condition, updates ...metav1.Condition) []metav1.Condition

MergeConditions adds or updates matching conditions, and updates the transition time if details of a condition have changed. Returns the updated condition array.

func SetAcceptedForPolicyAncestor added in v1.5.2

func SetAcceptedForPolicyAncestor(policyStatus *gwapiv1.PolicyStatus, ancestorRef *gwapiv1.ParentReference, controllerName string, generation int64)

func SetAcceptedForPolicyAncestors

func SetAcceptedForPolicyAncestors(policyStatus *gwapiv1.PolicyStatus, ancestorRefs []*gwapiv1.ParentReference, controllerName string, generation int64)

SetAcceptedForPolicyAncestors sets accepted conditions for each ancestor reference if it is unset.

func SetConditionForPolicyAncestor

func SetConditionForPolicyAncestor(policyStatus *gwapiv1.PolicyStatus, ancestorRef *gwapiv1.ParentReference, controllerName string,
	conditionType gwapiv1.PolicyConditionType, status metav1.ConditionStatus, reason gwapiv1.PolicyConditionReason, message string, generation int64,
)

func SetConditionForPolicyAncestors

func SetConditionForPolicyAncestors(policyStatus *gwapiv1.PolicyStatus, ancestorRefs []*gwapiv1.ParentReference, controllerName string,
	conditionType gwapiv1.PolicyConditionType, status metav1.ConditionStatus, reason gwapiv1.PolicyConditionReason, message string, generation int64,
)

func SetGatewayClassAccepted

func SetGatewayClassAccepted(gc *gwapiv1.GatewayClass, accepted bool, reason, msg string)

SetGatewayClassAccepted inserts or updates the Accepted condition for the provided GatewayClass.

func SetGatewayListenerStatusCondition

func SetGatewayListenerStatusCondition(gateway *gwapiv1.Gateway, listenerStatusIdx int,
	conditionType gwapiv1.ListenerConditionType, status metav1.ConditionStatus, reason gwapiv1.ListenerConditionReason, message string,
)

func SetProgrammedForEnvoyPatchPolicy

func SetProgrammedForEnvoyPatchPolicy(s *gwapiv1.PolicyStatus)

SetProgrammedForEnvoyPatchPolicy sets programmed conditions for each ancestor reference in policy status if it is unset.

func SetResolveErrorForPolicyAncestor added in v1.5.2

func SetResolveErrorForPolicyAncestor(policyStatus *gwapiv1.PolicyStatus, ancestorRef *gwapiv1.ParentReference, controllerName string, generation int64, resolveErr *PolicyResolveError)

func SetResolveErrorForPolicyAncestors

func SetResolveErrorForPolicyAncestors(policyStatus *gwapiv1.PolicyStatus, ancestorRefs []*gwapiv1.ParentReference, controllerName string, generation int64, resolveErr *PolicyResolveError)

func SetResourceNotFoundErrorForEnvoyPatchPolicy

func SetResourceNotFoundErrorForEnvoyPatchPolicy(s *gwapiv1.PolicyStatus, notFoundResources []string)

func SetRouteStatusCondition

func SetRouteStatusCondition(route *gwapiv1.RouteStatus, routeParentStatusIdx int, routeGeneration int64,
	conditionType gwapiv1.RouteConditionType, status metav1.ConditionStatus, reason gwapiv1.RouteConditionReason, message string,
)

func SetTranslationErrorForEnvoyPatchPolicy

func SetTranslationErrorForEnvoyPatchPolicy(s *gwapiv1.PolicyStatus, errMsg string)

func SetTranslationErrorForPolicyAncestor added in v1.5.2

func SetTranslationErrorForPolicyAncestor(policyStatus *gwapiv1.PolicyStatus, ancestorRef *gwapiv1.ParentReference, controllerName string, generation int64, errMsg string)

func SetTranslationErrorForPolicyAncestors

func SetTranslationErrorForPolicyAncestors(policyStatus *gwapiv1.PolicyStatus, ancestorRefs []*gwapiv1.ParentReference, controllerName string, generation int64, errMsg string)

func TruncatePolicyAncestors added in v1.5.0

func TruncatePolicyAncestors(policyStatus *gwapiv1.PolicyStatus, controllerName string, generation int64)

TruncatePolicyAncestors trims PolicyStatus.Ancestors down to at most 16 entries. The first 15 ancestors are shown as is. The last 16th ancestor is shown as is and add Aggregated condition.

func UpdateBackendStatusAcceptedCondition

func UpdateBackendStatusAcceptedCondition(be *egv1a1.Backend, accepted bool, msg string) *egv1a1.Backend

UpdateBackendStatusAcceptedCondition updates the status condition for the provided Backend based on the accepted state.

func UpdateGatewayStatusAccepted added in v1.3.0

func UpdateGatewayStatusAccepted(gw *gwapiv1.Gateway) *gwapiv1.Gateway

func UpdateGatewayStatusNotAccepted added in v1.3.0

func UpdateGatewayStatusNotAccepted(gw *gwapiv1.Gateway, reason gwapiv1.GatewayConditionReason, msg string) *gwapiv1.Gateway

func UpdateGatewayStatusProgrammedCondition

func UpdateGatewayStatusProgrammedCondition(gw *gwapiv1.Gateway, svc *corev1.Service, envoyObj client.Object, nodeAddresses NodeAddresses)

UpdateGatewayStatusProgrammedCondition updates the status addresses for the provided gateway based on the status IP/Hostname of svc and updates the Programmed condition based on the service and deployment or daemonset state.

Types

type Error added in v1.4.0

type Error interface {
	error
	Reason() gwapiv1.RouteConditionReason
	Type() gwapiv1.RouteConditionType
}

Error is an error interface that represents errors that need to be reflected in the status of a Kubernetes resource. It extends the standard error interface with a Reason method that returns the specific condition reason.

type MultiStatusError added in v1.4.0

type MultiStatusError struct {
	// contains filtered or unexported fields
}

MultiStatusError represents a collection of status errors that occurred during processing. It implements the StatusError interface and provides methods to manage multiple errors.

func (*MultiStatusError) Add added in v1.4.0

func (m *MultiStatusError) Add(err Error)

Add appends a new status error to the collection. If the error is nil, it is ignored.

func (*MultiStatusError) Empty added in v1.4.0

func (m *MultiStatusError) Empty() bool

Empty returns true if there are no errors in the collection.

func (*MultiStatusError) Error added in v1.4.0

func (m *MultiStatusError) Error() string

Error returns a string representation of all the wrapped errors. If there are no errors, it returns an empty string.

func (*MultiStatusError) Reason added in v1.4.0

Reason returns a string representation of all unique reasons from the wrapped errors. If there are no errors or no reasons, it returns an empty string.

func (*MultiStatusError) Type added in v1.4.0

type NodeAddresses added in v1.5.0

type NodeAddresses struct {
	IPv4 []string
	IPv6 []string
}

type PolicyResolveError

type PolicyResolveError struct {
	Reason  gwapiv1.PolicyConditionReason
	Message string
	// contains filtered or unexported fields
}

type RouteStatusError added in v1.4.0

type RouteStatusError struct {
	Wrapped              error
	RouteConditionReason gwapiv1.RouteConditionReason
	RouteConditionType   gwapiv1.RouteConditionType
}

RouteStatusError represents an error that needs to be reflected in the status of an xRoute. It wraps an underlying error and provides a specific route condition reason.

func NewRouteStatusError added in v1.4.0

func NewRouteStatusError(wrapped error, reason gwapiv1.RouteConditionReason) *RouteStatusError

NewRouteStatusError creates a new RouteStatusError with the given wrapped error and route condition reason.

func (*RouteStatusError) Error added in v1.4.0

func (s *RouteStatusError) Error() string

Error returns the string representation of the error. If Wrapped is nil, it returns the string representation of the RouteConditionReason.

func (*RouteStatusError) Reason added in v1.4.0

Reason returns the route condition reason associated with this error.

func (*RouteStatusError) Type added in v1.4.0

Type returns the route condition type associated with this error.

func (*RouteStatusError) WithType added in v1.4.0

type TypedErrorCollector added in v1.6.0

type TypedErrorCollector struct {
	// contains filtered or unexported fields
}

TypedErrorCollector collects and organizes status errors by their condition type. It automatically groups errors of the same type together, making it easy to process and report errors for each distinct condition type separately.

This is particularly useful when processing routes that may have multiple validation errors across different types. (e.g., ResolvedRefs, Accepted, BackendsAvailable).

func (*TypedErrorCollector) Add added in v1.6.0

func (c *TypedErrorCollector) Add(err Error)

Add appends a new error to the collector, automatically grouping it with other errors of the same condition type.

func (*TypedErrorCollector) Empty added in v1.6.0

func (c *TypedErrorCollector) Empty() bool

func (*TypedErrorCollector) GetError added in v1.6.0

GetError returns all errors of the specified condition type as a single RouteStatusError. Multiple errors of the same type are consolidated into one error with combined messages and reasons.

func (*TypedErrorCollector) Types added in v1.6.0

Types returns all unique condition types for which errors have been collected.

Jump to

Keyboard shortcuts

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