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.
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
- 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.
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.