status

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Copyright 2025 HAProxy Technologies LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterStatusByControllerName

func FilterStatusByControllerName(routeStatus gatewayv1.HTTPRouteStatus, controllerName string) gatewayv1.HTTPRouteStatus

func FilterTCPRouteStatusByControllerName added in v1.1.0

func FilterTCPRouteStatusByControllerName(tcpRouteStatus gatewayv1.TCPRouteStatus, controllerName string) gatewayv1.TCPRouteStatus

func FilterTLSRouteStatusByControllerName added in v0.8.0

func FilterTLSRouteStatusByControllerName(tlsRouteStatus v1alpha2.TLSRouteStatus, controllerName string) v1alpha2.TLSRouteStatus

func ListenerStatusesEqual

func ListenerStatusesEqual(a, b []gatewayv1.ListenerStatus) bool

func RouteStatusesEqual

func RouteStatusesEqual(a, b rc.RouteConditions) bool

func TryPatchStatusFunc

func TryPatchStatusFunc[T client.Object](param StatusUpdateParams[T]) func(ctx context.Context) (bool, error)

func TryUpdateStatusFunc

func TryUpdateStatusFunc[T client.Object](param StatusUpdateParams[T]) func(ctx context.Context) (bool, error)

Types

type IngressStatus added in v1.1.0

type IngressStatus struct {
	Ingress  *networkingv1.Ingress
	Eligible bool
}

IngressStatus pairs an Ingress with whether this controller handles it. Eligibility is computed by the caller (which owns the ControllerStore) so the status package stays free of IngressClass resolution logic.

type PreparedStatusUpdates added in v1.0.1

type PreparedStatusUpdates []func(context.Context)

PreparedStatusUpdates holds status write operations prepared from a tree snapshot. It is produced synchronously by PrepareStatusUpdate and consumed asynchronously by UpdateStatus.

type StatusPatcher

type StatusPatcher interface {
	StatusEqual(client.Object) (bool, error)
	SetStatus(client.Object) error
}

type StatusUpdateParams

type StatusUpdateParams[T client.Object] struct {
	Object        T
	StatusPatcher StatusPatcher
	Getter        client.Client
	StatusUpdater client.SubResourceWriter
	Logger        *slog.Logger

	NsName types.NamespacedName
	// contains filtered or unexported fields
}

type StatusUpdater

type StatusUpdater interface {
	// Start launches the background goroutine that processes status writes.
	// It must be called once before UpdateStatus.
	Start(ctx context.Context)
	// PrepareStatusUpdate must be called synchronously in the batch loop while
	// the tree is still valid. It snapshots all relevant state from the tree
	// nodes into self-contained write operations and returns them.
	PrepareStatusUpdate(ctx context.Context,
		gatewayClasses map[types.NamespacedName]*tree.GatewayClass,
		gateways map[types.NamespacedName]*tree.Gateway,
		httpRoutes map[types.NamespacedName]*tree.HTTPRoute,
		tlsRoutes map[types.NamespacedName]*tree.TLSRoute,
		tcpRoutes map[types.NamespacedName]*tree.TCPRoute,
		listenerSets map[types.NamespacedName]*tree.ListenerSet) PreparedStatusUpdates
	// UpdateStatus dispatches a previously prepared batch of writes to the
	// background goroutine. Any stale pending batch is replaced by the new one.
	UpdateStatus(ctx context.Context, updates PreparedStatusUpdates)
	// PrepareFeedbackStatusUpdate builds status updates for the Programmed conditions of the
	// listeners the apply reported (already updated by UpdateListenerProgrammedConditions):
	// the Gateway's own listeners on the Gateway, the entries on their ListenerSet. Only the
	// resources present in result.ObservedGenerations are updated.
	PrepareFeedbackStatusUpdate(
		ctx context.Context,
		result diffs.HaproxyConfResult,
		gateways map[types.NamespacedName]*tree.Gateway,
		listenerSets map[types.NamespacedName]*tree.ListenerSet,
	) PreparedStatusUpdates
	// PrepareIngressStatusUpdate builds status writes that set each eligible
	// Ingress's status.loadBalancer.ingress to the controller addresses, and
	// clears it for ineligible ones. It is a no-op when Ingress status updates
	// are disabled.
	PrepareIngressStatusUpdate(ctx context.Context, ingresses []IngressStatus) PreparedStatusUpdates
}

func NewStatusUpdater

func NewStatusUpdater(cfg StatusUpdaterConf) StatusUpdater

type StatusUpdaterConf

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

func NewStatusUpdaterConf

func NewStatusUpdaterConf(
	k8sClient client.Client,
	extractGVK utilsk8s.ExtractGVK,
	controllerName string,
	hugServiceLabelKey string,
	hugServiceLabelVal string,
	logger *slog.Logger,
	disableIPv4 bool,
	disableIPv6 bool,
	disableIngressStatusUpdate bool,
) StatusUpdaterConf

type StatusUpdaterImpl

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

func (*StatusUpdaterImpl) PrepareFeedbackStatusUpdate added in v1.0.1

func (s *StatusUpdaterImpl) PrepareFeedbackStatusUpdate(
	ctx context.Context,
	result diffs.HaproxyConfResult,
	gateways map[types.NamespacedName]*tree.Gateway,
	listenerSets map[types.NamespacedName]*tree.ListenerSet,
) PreparedStatusUpdates

PrepareFeedbackStatusUpdate builds a PreparedStatusUpdates from the tree's current listener Programmed conditions. Only the resources present in result.ObservedGenerations are included, each published on the object that carries its conditions: the Gateway for its own listeners, the ListenerSet for the entries it contributed -- whose programmation is reported nowhere else, since the periodic pass runs before the apply. The conditions must already have been updated via GateTree.UpdateListenerProgrammedConditions before this is called.

func (*StatusUpdaterImpl) PrepareIngressStatusUpdate added in v1.1.0

func (s *StatusUpdaterImpl) PrepareIngressStatusUpdate(ctx context.Context, ingresses []IngressStatus) PreparedStatusUpdates

PrepareIngressStatusUpdate snapshots status writes that advertise the controller addresses on eligible Ingresses (status.loadBalancer.ingress) and clear that status on ineligible ones (they may have been eligible before). It is a no-op when Ingress status updates are disabled. The controller addresses are the same ones advertised on Gateway status.

func (*StatusUpdaterImpl) PrepareStatusUpdate added in v1.0.1

func (s *StatusUpdaterImpl) PrepareStatusUpdate(ctx context.Context,
	gatewayClasses map[types.NamespacedName]*tree.GatewayClass,
	gateways map[types.NamespacedName]*tree.Gateway,
	httpRoutes map[types.NamespacedName]*tree.HTTPRoute,
	tlsRoutes map[types.NamespacedName]*tree.TLSRoute,
	tcpRoutes map[types.NamespacedName]*tree.TCPRoute,
	listenerSets map[types.NamespacedName]*tree.ListenerSet,
) PreparedStatusUpdates

PrepareStatusUpdate must be called synchronously in the batch loop while the tree is still valid. It snapshots all relevant state from the tree nodes into self-contained write operations and returns them as a PreparedStatusUpdates batch ready to be dispatched via UpdateStatus.

func (*StatusUpdaterImpl) Start added in v1.0.1

func (s *StatusUpdaterImpl) Start(ctx context.Context)

Start launches a background goroutine that drains the updates channel and executes each write using the provided context for its lifetime.

func (*StatusUpdaterImpl) UpdateStatus

func (s *StatusUpdaterImpl) UpdateStatus(ctx context.Context, updates PreparedStatusUpdates)

UpdateStatus dispatches a previously prepared batch of writes to the background goroutine. If the channel buffer is full the batch is discarded and a warning is logged so the reconciler never blocks on status writes.

Jump to

Keyboard shortcuts

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