status

package
v1.30.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package status holds pieces for handling status updates propagated from the DAG back to Kubernetes

Index

Constants

View Source
const (
	ConditionValidBackendRefs gatewayapi_v1.RouteConditionType = "ValidBackendRefs"
	ConditionValidMatches     gatewayapi_v1.RouteConditionType = "ValidMatches"
)
View Source
const (
	ReasonDegraded                        gatewayapi_v1.RouteConditionReason = "Degraded"
	ReasonAllBackendRefsHaveZeroWeights   gatewayapi_v1.RouteConditionReason = "AllBackendRefsHaveZeroWeights"
	ReasonInvalidPathMatch                gatewayapi_v1.RouteConditionReason = "InvalidPathMatch"
	ReasonInvalidMethodMatch              gatewayapi_v1.RouteConditionReason = "InvalidMethodMatch"
	ReasonInvalidGateway                  gatewayapi_v1.RouteConditionReason = "InvalidGateway"
	ReasonRouteRuleMatchConflict          gatewayapi_v1.RouteConditionReason = "RuleMatchConflict"
	ReasonRouteRuleMatchPartiallyConflict gatewayapi_v1.RouteConditionReason = "RuleMatchPartiallyConflict"

	MessageRouteRuleMatchConflict          string = "%s's Match has conflict with other %s's Match"
	MessageRouteRuleMatchPartiallyConflict string = "Dropped Rule: some of %s's rule(s) has(ve) been dropped because of conflict against other %s's rule(s)"
)
View Source
const MessageValidGateway = "Valid Gateway"
View Source
const ReasonOlderGatewayClassExists gatewayapi_v1.GatewayClassConditionReason = "OlderGatewayClassExists"

Variables

This section is empty.

Functions

func SetGatewayClassAccepted added in v1.20.0

func SetGatewayClassAccepted(gc *gatewayapi_v1.GatewayClass, accepted bool) *gatewayapi_v1.GatewayClass

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

Types

type BackendTLSPolicyAncestorStatusUpdate added in v1.28.0

type BackendTLSPolicyAncestorStatusUpdate struct {
	*BackendTLSPolicyStatusUpdate
	// contains filtered or unexported fields
}

BackendTLSPolicyAncestorStatusUpdate helps update a specific ancestor ref's PolicyAncestorStatus.

func (*BackendTLSPolicyAncestorStatusUpdate) AddCondition added in v1.28.0

AddCondition adds a condition with the given properties to the BackendTLSPolicyAncestorStatus.

type BackendTLSPolicyStatusUpdate added in v1.28.0

type BackendTLSPolicyStatusUpdate struct {
	FullName               types.NamespacedName
	PolicyAncestorStatuses []*gatewayapi_v1alpha2.PolicyAncestorStatus
	GatewayRef             types.NamespacedName
	GatewayController      gatewayapi_v1.GatewayController
	Generation             int64
	TransitionTime         meta_v1.Time
}

BackendTLSPolicyStatusUpdate represents an atomic update to a BackendTLSPolicy's status.

func (*BackendTLSPolicyStatusUpdate) ConditionsForAncestorRef added in v1.28.0

func (b *BackendTLSPolicyStatusUpdate) ConditionsForAncestorRef(ancestorRef gatewayapi_v1.ParentReference) []meta_v1.Condition

ConditionsForAncestorRef returns the list of conditions for a given ancestor if it exists.

func (*BackendTLSPolicyStatusUpdate) Mutate added in v1.28.0

func (*BackendTLSPolicyStatusUpdate) StatusUpdateFor added in v1.28.0

StatusUpdateFor returns a BackendTLSPolicyAncestorStatusUpdate for the given ancestor ref.

type Cache

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

Cache holds status updates from the DAG back towards Kubernetes. It holds a per-Kind cache, and is intended to be accessed with a KindAccessor.

func NewCache

func NewCache(gateway types.NamespacedName, gatewayController gatewayapi_v1.GatewayController) Cache

NewCache creates a new Cache for holding status updates.

func (*Cache) BackendTLSPolicyConditionsAccessor added in v1.28.0

func (c *Cache) BackendTLSPolicyConditionsAccessor(nsName types.NamespacedName, generation int64) (*BackendTLSPolicyStatusUpdate, func())

BackendTLSPolicyConditionsAccessor returns a BackendTLSPolicyStatusUpdate that allows a client to build up a list of metav1.Conditions as well as a function to commit the change back to the cache when everything is done. The commit function pattern is used so that the BackendTLSPolicyStatusUpdate does not need to know anything the cache internals.

func (*Cache) GatewayStatusAccessor added in v1.20.0

func (c *Cache) GatewayStatusAccessor(nsName types.NamespacedName, generation int64, gs *gatewayapi_v1.GatewayStatus) (*GatewayStatusUpdate, func())

GatewayStatusAccessor returns a GatewayStatusUpdate that allows a client to build up a list of status changes as well as a function to commit the change back to the cache when everything is done. The commit function pattern is used so that the GatewayStatusUpdate does not need to know anything the cache internals.

func (*Cache) Get

func (c *Cache) Get(obj meta_v1.Object) CacheEntry

Get returns a pointer to a the cache entry if it exists, nil otherwise. The return value is shared between all callers, who should take care to cooperate.

func (*Cache) GetBackendTLSPolicyUpdates added in v1.28.0

func (c *Cache) GetBackendTLSPolicyUpdates() []*BackendTLSPolicyStatusUpdate

GetBackendTLSPolicyUpdates gets the underlying BackendTLSPolicyConditionsUpdate objects from the cache.

func (*Cache) GetGatewayUpdates added in v1.17.0

func (c *Cache) GetGatewayUpdates() []*GatewayStatusUpdate

GetGatewayUpdates gets the underlying GatewayStatusUpdate objects from the cache.

func (*Cache) GetProxyUpdates

func (c *Cache) GetProxyUpdates() []*ProxyUpdate

GetProxyUpdates gets the underlying ProxyUpdate objects from the cache, used by various things (`internal/contour/metrics.go` and `internal/dag/status_test.go`) to retrieve info they need. TODO(youngnick)#2969: This could conceivably be replaced with a Walk pattern.

func (*Cache) GetRouteUpdates added in v1.16.0

func (c *Cache) GetRouteUpdates() []*RouteStatusUpdate

GetRouteUpdates gets the underlying RouteConditionsUpdate objects from the cache.

func (*Cache) GetStatusUpdates

func (c *Cache) GetStatusUpdates() []k8s.StatusUpdate

GetStatusUpdates returns a slice of StatusUpdates, ready to be sent off to the StatusUpdater by the event handler. As more kinds are handled by Cache, we'll update this method.

func (*Cache) ProxyAccessor

func (c *Cache) ProxyAccessor(proxy *contour_v1.HTTPProxy) (*ProxyUpdate, func())

ProxyAccessor returns a ProxyUpdate that allows a client to build up a list of errors and warnings to go onto the proxy as conditions, and a function to commit the change back to the cache when everything is done. The commit function pattern is used so that the ProxyUpdate does not need to know anything the cache internals.

func (*Cache) Put

func (c *Cache) Put(obj meta_v1.Object, e CacheEntry)

Put returns an entry to the cache.

func (*Cache) RouteConditionsAccessor added in v1.17.0

func (c *Cache) RouteConditionsAccessor(nsName types.NamespacedName, generation int64, resource client.Object) (*RouteStatusUpdate, func())

RouteConditionsAccessor returns a RouteStatusUpdate that allows a client to build up a list of meta_v1.Conditions as well as a function to commit the change back to the cache when everything is done. The commit function pattern is used so that the RouteStatusUpdate does not need to know anything the cache internals.

type CacheEntry

type CacheEntry interface {
	AsStatusUpdate() k8s.StatusUpdate
	ConditionFor(ConditionType) *contour_v1.DetailedCondition
}

type ConditionCache

type ConditionCache struct {
	Conditions map[ConditionType]*contour_v1.DetailedCondition
}

ConditionCache holds all the DetailedConditions to add to the object keyed by the Type (since that's what the API server will end up doing).

func (*ConditionCache) ConditionFor

func (c *ConditionCache) ConditionFor(condType ConditionType) *contour_v1.DetailedCondition

ConditionFor returns the cached DetailedCondition of the given type. If no such condition exists, a new one is created.

type ConditionType

type ConditionType string

ConditionType is used to ensure we only use a limited set of possible values for DetailedCondition types. It's cast back to a string before sending off to HTTPProxy structs, as those use upstream types which we can't alias easily.

const ValidCondition ConditionType = "Valid"

ValidCondition is the ConditionType for Valid.

type ExtensionCacheEntry

type ExtensionCacheEntry struct {
	ConditionCache

	Name           types.NamespacedName
	Generation     int64
	TransitionTime meta_v1.Time
}

ExtensionCacheEntry holds status updates for a particular ExtensionService

func ExtensionAccessor

func ExtensionAccessor(c *Cache, ext *contour_v1alpha1.ExtensionService) (*ExtensionCacheEntry, func())

ExtensionAccessor returns a pointer to a shared status cache entry for the given ExtensionStatus object. If no such entry exists, a new entry is added. When the caller finishes with the cache entry, it must call the returned function to release the entry back to the cache.

func (*ExtensionCacheEntry) AsStatusUpdate

func (e *ExtensionCacheEntry) AsStatusUpdate() k8s.StatusUpdate

type GatewayStatusUpdate added in v1.20.0

type GatewayStatusUpdate struct {
	FullName           types.NamespacedName
	Conditions         map[gatewayapi_v1.GatewayConditionType]meta_v1.Condition
	ExistingConditions map[gatewayapi_v1.GatewayConditionType]meta_v1.Condition
	ListenerStatus     map[string]*gatewayapi_v1.ListenerStatus
	Generation         int64
	TransitionTime     meta_v1.Time
}

GatewayStatusUpdate represents an atomic update to a Gateway's status.

func (*GatewayStatusUpdate) AddCondition added in v1.20.0

AddCondition returns a meta_v1.Condition for a given GatewayConditionType.

func (*GatewayStatusUpdate) AddListenerCondition added in v1.20.0

func (gatewayUpdate *GatewayStatusUpdate) AddListenerCondition(
	listenerName string,
	cond gatewayapi_v1.ListenerConditionType,
	status meta_v1.ConditionStatus,
	reason gatewayapi_v1.ListenerConditionReason,
	message string,
) meta_v1.Condition

AddListenerCondition adds a Condition for the specified listener.

func (*GatewayStatusUpdate) Mutate added in v1.20.0

func (gatewayUpdate *GatewayStatusUpdate) Mutate(obj client.Object) client.Object

func (*GatewayStatusUpdate) SetListenerAttachedRoutes added in v1.20.0

func (gatewayUpdate *GatewayStatusUpdate) SetListenerAttachedRoutes(listenerName string, numRoutes int)

func (*GatewayStatusUpdate) SetListenerSupportedKinds added in v1.20.0

func (gatewayUpdate *GatewayStatusUpdate) SetListenerSupportedKinds(listenerName string, kinds []gatewayapi_v1.Kind)

type ProxyStatus

type ProxyStatus string
const (
	ProxyStatusValid    ProxyStatus = "valid"
	ProxyStatusInvalid  ProxyStatus = "invalid"
	ProxyStatusOrphaned ProxyStatus = "orphaned"
)

type ProxyUpdate

type ProxyUpdate struct {
	Fullname       types.NamespacedName
	Generation     int64
	TransitionTime meta_v1.Time
	Vhost          string

	// Conditions holds all the DetailedConditions to add to the object
	// keyed by the Type (since that's what the apiserver will end up
	// doing.)
	Conditions map[ConditionType]*contour_v1.DetailedCondition
}

ProxyUpdate holds status updates for a particular HTTPProxy object

func (*ProxyUpdate) ConditionFor

func (pu *ProxyUpdate) ConditionFor(cond ConditionType) *contour_v1.DetailedCondition

ConditionFor returns a DetailedCondition for a given ConditionType. Currently only "Valid" is used.

func (*ProxyUpdate) Mutate

func (pu *ProxyUpdate) Mutate(obj client.Object) client.Object

type RouteParentStatusUpdate added in v1.22.0

type RouteParentStatusUpdate struct {
	*RouteStatusUpdate
	// contains filtered or unexported fields
}

RouteParentStatusUpdate helps update a specific parent ref's RouteParentStatus.

func (*RouteParentStatusUpdate) AddCondition added in v1.22.0

AddCondition adds a condition with the given properties to the RouteParentStatus.

func (*RouteParentStatusUpdate) ConditionExists added in v1.25.0

func (r *RouteParentStatusUpdate) ConditionExists(conditionType gatewayapi_v1.RouteConditionType) bool

ConditionExists returns whether or not a condition with the given type exists.

type RouteStatusUpdate added in v1.22.0

type RouteStatusUpdate struct {
	FullName            types.NamespacedName
	RouteParentStatuses []*gatewayapi_v1.RouteParentStatus
	GatewayRef          types.NamespacedName
	GatewayController   gatewayapi_v1.GatewayController
	Resource            client.Object
	Generation          int64
	TransitionTime      meta_v1.Time
}

RouteStatusUpdate represents an atomic update to a Route's status.

func (*RouteStatusUpdate) ConditionsForParentRef added in v1.22.0

func (r *RouteStatusUpdate) ConditionsForParentRef(parentRef gatewayapi_v1.ParentReference) []meta_v1.Condition

func (*RouteStatusUpdate) Mutate added in v1.22.0

func (r *RouteStatusUpdate) Mutate(obj client.Object) client.Object

func (*RouteStatusUpdate) StatusUpdateFor added in v1.22.0

StatusUpdateFor returns a RouteParentStatusUpdate for the given parent ref.

Jump to

Keyboard shortcuts

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