Documentation ¶
Overview ¶
Package status holds pieces for handling status updates propagated from the DAG back to Kubernetes
Index ¶
- Constants
- func SyncGatewayClass(ctx context.Context, cli client.Client, gc *gateway_v1alpha1.GatewayClass, ...) error
- type Cache
- func (c *Cache) GatewayConditionsAccessor(nsName types.NamespacedName, generation int64, resource string, ...) (*GatewayConditionsUpdate, func())
- func (c *Cache) Get(obj metav1.Object) CacheEntry
- func (c *Cache) GetGatewayUpdates() []*GatewayConditionsUpdate
- func (c *Cache) GetProxyUpdates() []*ProxyUpdate
- func (c *Cache) GetRouteUpdates() []*RouteConditionsUpdate
- func (c *Cache) GetStatusUpdates() []k8s.StatusUpdate
- func (c *Cache) ProxyAccessor(proxy *contour_api_v1.HTTPProxy) (*ProxyUpdate, func())
- func (c *Cache) Put(obj metav1.Object, e CacheEntry)
- func (c *Cache) RouteConditionsAccessor(nsName types.NamespacedName, generation int64, resource string, ...) (*RouteConditionsUpdate, func())
- type CacheEntry
- type ConditionCache
- type ConditionType
- type ExtensionCacheEntry
- type GatewayClassReasonType
- type GatewayConditionsUpdate
- type GatewayReasonType
- type ProxyStatus
- type ProxyUpdate
- type RouteConditionsUpdate
- type RouteReasonType
Constants ¶
const ConditionNotImplemented gatewayapi_v1alpha1.RouteConditionType = "NotImplemented"
const ConditionResolvedRefs gatewayapi_v1alpha1.RouteConditionType = "ResolvedRefs"
const ReasonInvalidGateway = "Invalid"
const ReasonValidGateway = "Valid"
const ResourceGateway = "gateways"
const ResourceHTTPRoute = "httproutes"
const ResourceTLSRoute = "tlsroutes"
Variables ¶
This section is empty.
Functions ¶
func SyncGatewayClass ¶ added in v1.16.0
func SyncGatewayClass(ctx context.Context, cli client.Client, gc *gateway_v1alpha1.GatewayClass, errs field.ErrorList) error
SyncGatewayClass computes the current status of GatewayClass and updates status upon any changes since last sync.
Types ¶
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) Cache
NewCache creates a new Cache for holding status updates.
func (*Cache) GatewayConditionsAccessor ¶ added in v1.17.0
func (c *Cache) GatewayConditionsAccessor(nsName types.NamespacedName, generation int64, resource string, gs *gatewayapi_v1alpha1.GatewayStatus) (*GatewayConditionsUpdate, func())
GatewayConditionsAccessor returns a GatewayConditionsUpdate 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 GatewayConditionsUpdate does not need to know anything the cache internals.
func (*Cache) Get ¶
func (c *Cache) Get(obj metav1.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) GetGatewayUpdates ¶ added in v1.17.0
func (c *Cache) GetGatewayUpdates() []*GatewayConditionsUpdate
GetGatewayUpdates gets the underlying GatewayConditionsUpdate 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() []*RouteConditionsUpdate
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_api_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 metav1.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 string, gateways []gatewayapi_v1alpha1.RouteGatewayStatus) (*RouteConditionsUpdate, func())
RouteConditionsAccessor returns a RouteConditionsUpdate 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 RouteConditionsUpdate does not need to know anything the cache internals.
type CacheEntry ¶
type CacheEntry interface { AsStatusUpdate() k8s.StatusUpdate ConditionFor(ConditionType) *contour_api_v1.DetailedCondition }
type ConditionCache ¶
type ConditionCache struct {
Conditions map[ConditionType]*contour_api_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_api_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 v1.Time }
ExtensionCacheEntry holds status updates for a particular ExtensionService
func ExtensionAccessor ¶
func ExtensionAccessor(c *Cache, ext *contour_api_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 GatewayClassReasonType ¶ added in v1.16.0
type GatewayClassReasonType string
type GatewayConditionsUpdate ¶ added in v1.17.0
type GatewayConditionsUpdate struct { FullName types.NamespacedName Conditions map[gatewayapi_v1alpha1.GatewayConditionType]metav1.Condition ExistingConditions map[gatewayapi_v1alpha1.GatewayConditionType]metav1.Condition GatewayRef types.NamespacedName Resource string Generation int64 TransitionTime metav1.Time }
func (*GatewayConditionsUpdate) AddCondition ¶ added in v1.17.0
func (gatewayUpdate *GatewayConditionsUpdate) AddCondition(cond gatewayapi_v1alpha1.GatewayConditionType, status metav1.ConditionStatus, reason GatewayReasonType, message string) metav1.Condition
AddCondition returns a metav1.Condition for a given GatewayConditionType.
func (*GatewayConditionsUpdate) Mutate ¶ added in v1.17.0
func (gatewayUpdate *GatewayConditionsUpdate) Mutate(obj interface{}) interface{}
type GatewayReasonType ¶ added in v1.17.0
type GatewayReasonType string
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 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]*projectcontour.DetailedCondition }
ProxyUpdate holds status updates for a particular HTTPProxy object
func (*ProxyUpdate) ConditionFor ¶
func (pu *ProxyUpdate) ConditionFor(cond ConditionType) *projectcontour.DetailedCondition
ConditionFor returns a DetailedCondition for a given ConditionType. Currently only "Valid" is used.
func (*ProxyUpdate) Mutate ¶
func (pu *ProxyUpdate) Mutate(obj interface{}) interface{}
type RouteConditionsUpdate ¶ added in v1.17.0
type RouteConditionsUpdate struct { FullName types.NamespacedName Conditions map[gatewayapi_v1alpha1.RouteConditionType]metav1.Condition ExistingConditions map[gatewayapi_v1alpha1.RouteConditionType]metav1.Condition GatewayRef types.NamespacedName Resource string Generation int64 TransitionTime metav1.Time }
func (*RouteConditionsUpdate) AddCondition ¶ added in v1.17.0
func (routeUpdate *RouteConditionsUpdate) AddCondition(cond gatewayapi_v1alpha1.RouteConditionType, status metav1.ConditionStatus, reason RouteReasonType, message string) metav1.Condition
AddCondition returns a metav1.Condition for a given ConditionType.
func (*RouteConditionsUpdate) Mutate ¶ added in v1.17.0
func (routeUpdate *RouteConditionsUpdate) Mutate(obj interface{}) interface{}
type RouteReasonType ¶ added in v1.14.0
type RouteReasonType string
const ReasonDegraded RouteReasonType = "Degraded"
const ReasonErrorsExist RouteReasonType = "ErrorsExist"
const ReasonGatewayAllowMismatch RouteReasonType = "GatewayAllowMismatch"
const ReasonHTTPRouteFilterType RouteReasonType = "HTTPRouteFilterType"
const ReasonHeaderMatchType RouteReasonType = "HeaderMatchType"
const ReasonNotImplemented RouteReasonType = "NotImplemented"
const ReasonPathMatchType RouteReasonType = "PathMatchType"
const ReasonValid RouteReasonType = "Valid"