Documentation
¶
Overview ¶
Package deployer implements a lightweight Kubernetes deployer for conformance testing: it watches Gateway objects and provisions a dedicated HUG controller Deployment and Service for each one.
Copyright 2026 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.
Index ¶
- func ScaleDefaultControllerToZero(ctx context.Context, apiReader client.Reader, c client.Client) (func(context.Context, client.Client), error)
- func Start(ctx context.Context, restCfg *rest.Config, cfg Config) (scaledDown <-chan error, restoreDone <-chan struct{}, err error)
- func WaitForCleanup(ctx context.Context, restCfg *rest.Config, deployerNs, gatewayNS string) error
- func WaitForGatewayAddresses(ctx context.Context, reader client.Reader, cfg Config, gatewayNamespace string) error
- type Config
- type GatewayReconciler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScaleDefaultControllerToZero ¶
func ScaleDefaultControllerToZero(ctx context.Context, apiReader client.Reader, c client.Client) (func(context.Context, client.Client), error)
ScaleDefaultControllerToZero scales the standard HUG controller deployment (label run=haproxy-unified-gateway in namespace haproxy-unified-gateway) to zero replicas. It returns a function that restores the deployment to one replica using the provided client, so callers can supply a fresh client independent of the manager lifecycle. apiReader bypasses the manager cache so the unwatch namespace can be accessed.
func Start ¶
func Start(ctx context.Context, restCfg *rest.Config, cfg Config) (scaledDown <-chan error, restoreDone <-chan struct{}, err error)
Start creates a controller-runtime manager, registers the GatewayReconciler, and runs until ctx is cancelled. It returns:
- scaledDown: receives exactly one value when ScaleDefaultControllerToZero completes.
- restoreDone: closed when the default controller has been scaled back to one replica.
Callers must wait on scaledDown before relying on the standard controller being inactive, and must wait on restoreDone after cancelling ctx to ensure the restore completes.
func WaitForCleanup ¶
WaitForCleanup blocks until all deployer-managed Deployments and Services in deployerNs for Gateways from gatewayNS have been deleted, or ctx expires.
func WaitForGatewayAddresses ¶ added in v1.1.0
func WaitForGatewayAddresses(ctx context.Context, reader client.Reader, cfg Config, gatewayNamespace string) error
WaitForGatewayAddresses checks the base Gateways before any traffic scenario runs. The caller supplies one deadline for the whole set, not one per Gateway. It only reads resources; the suite still owns creation and cleanup.
Types ¶
type Config ¶
type Config struct {
// DeployerNs is the namespace where controller Deployments and Services are created.
DeployerNs string
// ControllerImage is the HUG container image to deploy (e.g. "haproxytech/haproxy-unified-gateway:latest").
ControllerImage string
// HugConfCRD is the namespace/name of the HugConf custom resource (e.g. "haproxy-unified-gateway/hugconf").
HugConfCRD string
// GatewayClassName, when non-empty, restricts the deployer to Gateways of this class.
GatewayClassName string
// ServiceType is the Kubernetes ServiceType for the provisioned Services.
// Defaults to LoadBalancer; use ClusterIP in environments without a load-balancer (e.g. CI).
ServiceType corev1.ServiceType
// WatchNamespaces, when non-empty, restricts the deployer to Gateways in these namespaces only.
WatchNamespaces []string
}
Config holds the parameters for the Gateway deployer.
type GatewayReconciler ¶
GatewayReconciler watches Gateway objects and reconciles a HUG controller Deployment and Service in Config.OperatorNS for each one.
func (*GatewayReconciler) Reconcile ¶
Reconcile is called for every Gateway create/update/delete event.
func (*GatewayReconciler) SetupWithManager ¶
func (r *GatewayReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers the reconciler with the manager.