deployer

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

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

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

func WaitForCleanup(ctx context.Context, restCfg *rest.Config, deployerNs, gatewayNS string) error

WaitForCleanup blocks until all deployer-managed Deployments and Services in deployerNs for Gateways from gatewayNS have been deleted, or ctx expires.

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

type GatewayReconciler struct {
	client.Client
	Scheme *runtime.Scheme
	Config Config
}

GatewayReconciler watches Gateway objects and reconciles a HUG controller Deployment and Service in Config.OperatorNS for each one.

func (*GatewayReconciler) Reconcile

func (r *GatewayReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

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.

Jump to

Keyboard shortcuts

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