auxiliaryfiles

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

README

pkg/dataplane/auxiliaryfiles

Value types for files rendered alongside haproxy.cfg. This package performs no network or filesystem operations. The renderer produces the files, the render plan describes them, and the HAPTIC agent writes them.

File types

Type Content Identifier
GeneralFile Error pages, policy files, or other auxiliary data Filename
MapFile HAProxy map entries Path
SSLCertificate PEM certificate and private key Path
CRTListFile Certificate references, options, and SNI filters Path
SSLCaFile PEM trust bundle Path

All types implement FileItem: GetIdentifier() and GetContent(). Content is excluded from JSON serialization to keep key material out of debug responses.

GeneralFile.IsCaFile marks a trust bundle for runtime CA-store updates. ReloadsOnPush() reads ReloadOnPush, treating nil as true. Set it false only for files whose consumer can accept updates without an HAProxy reload.

  • renderplan — immutable description of the desired configuration
  • deployplan — per-pod change decisions
  • agent/files — file writes, journaling, and recovery

License

Apache-2.0 — see root LICENSE.

Documentation

Overview

Package auxiliaryfiles holds the file types a render produces next to haproxy.cfg: general files (error pages, ACL files), SSL certificates, map files, crt-lists and CA files. The renderer builds them, the plan describes them and the agent writes them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRTListFile

type CRTListFile struct {
	// Path is the absolute file path to the crt-list file.
	// Example: "/etc/haproxy/crt-lists/crt-list.txt"
	Path string

	// Content is the crt-list file contents (one certificate entry per line).
	// Format: <cert-path> [ssl-options] [sni-filter]
	// Example: "/etc/haproxy/ssl/cert.pem [ocsp-update on] example.com"
	Content string `json:"-"`
}

CRTListFile represents a HAProxy crt-list file for SSL certificate lists with per-certificate options. CRT-list files allow specifying multiple certificates with individual SSL options and SNI filters.

func (CRTListFile) GetContent

func (c CRTListFile) GetContent() string

GetContent implements the FileItem interface.

func (CRTListFile) GetIdentifier

func (c CRTListFile) GetIdentifier() string

GetIdentifier implements the FileItem interface.

type FileItem

type FileItem interface {
	// GetIdentifier returns the path or filename the file is stored under.
	GetIdentifier() string

	// GetContent returns the file content.
	GetContent() string
}

FileItem is one auxiliary file, whatever its kind.

type GeneralFile

type GeneralFile struct {
	// Filename is the base file name (used as API 'id').
	// Example: "400.http"
	Filename string

	// Path is the absolute file path where the file is stored.
	// This is computed from the configured GeneralStorageDir + Filename.
	// Example: "/etc/haproxy/general/400.http"
	Path string

	// Content is the file contents as a string. This maps to the 'file' field in
	// multipart parts of an apply.
	// json:"-" on every aux Content keeps key material out of /debug/vars; the
	// tls-ticket-keys STEK file is a general file, so this is not SSL-only.
	Content string `json:"-"`

	// IsCaFile marks this general file as an SSL CA / trust bundle referenced by
	// the config as `ca-file <path>` (frontend client-cert verify or backend mTLS
	// server verify). When set, a CONTENT-only update can be applied to the live
	// worker via the runtime API (`add ssl ca-file` + commit, which replaces the
	// file with the payload) without a reload — it is what makes the plan file
	// kind `ca` rather than `general`. Metadata only: GetContent (used for
	// diffing) ignores it, so it never causes a spurious diff against the
	// content-keyed current state.
	IsCaFile bool

	// ReloadOnPush carries the CRD's files[].reloadOnPush (or the 4th argument
	// to fileRegistry.Register). Nil — the zero value — means true, so a file
	// built without thinking about this flag keeps reloading. Read it through
	// ReloadsOnPush. Metadata only: GetContent ignores it, so it never causes a
	// spurious diff against the content-keyed current state.
	ReloadOnPush *bool
}

GeneralFile represents a general-purpose file (error files, custom response files, etc.). The agent writes these files onto the pod and the configuration references them in the HAProxy configuration (e.g., in http-errors sections).

func (GeneralFile) GetContent

func (g GeneralFile) GetContent() string

GetContent implements the FileItem interface.

func (GeneralFile) GetIdentifier

func (g GeneralFile) GetIdentifier() string

GetIdentifier implements the FileItem interface.

func (GeneralFile) ReloadsOnPush

func (g GeneralFile) ReloadsOnPush() bool

ReloadsOnPush reports whether pushing this file's content must reload HAProxy. False only for a sidecar-owned file the config never references.

type MapFile

type MapFile struct {
	// Path is the absolute file path to the map file.
	// Example: "/etc/haproxy/maps/domains.map"
	Path string

	// Content is the map file contents (one key-value pair per line).
	Content string `json:"-"`
}

MapFile represents a HAProxy map file for dynamic key-value lookups. Map files enable runtime configuration changes without reloading HAProxy.

func (MapFile) GetContent

func (m MapFile) GetContent() string

GetContent implements the FileItem interface.

func (MapFile) GetIdentifier

func (m MapFile) GetIdentifier() string

GetIdentifier implements the FileItem interface.

type SSLCaFile

type SSLCaFile struct {
	// Path is the file path or name of the CA file.
	// Example: "ca-bundle.pem" or "/etc/haproxy/ssl/ca/trusted-cas.pem"
	Path string

	// Content is the PEM-encoded CA certificate data.
	// Can contain multiple CA certificates concatenated together.
	Content string `json:"-"`
}

SSLCaFile represents an SSL CA certificate file containing trusted CA certificates. These files are used for client certificate verification and SSL chain validation. A content-only update reaches the running worker over the runtime API.

func (SSLCaFile) GetContent

func (s SSLCaFile) GetContent() string

GetContent implements the FileItem interface.

func (SSLCaFile) GetIdentifier

func (s SSLCaFile) GetIdentifier() string

GetIdentifier implements the FileItem interface.

type SSLCertificate

type SSLCertificate struct {
	// Path is the absolute file path to the certificate.
	// Example: "/etc/haproxy/certs/example.com.pem"
	Path string

	// Content is the PEM-encoded certificate and key data.
	Content string `json:"-"`
}

SSLCertificate represents an SSL/TLS certificate file containing certificates and keys. These files are used for HTTPS termination and client certificate authentication.

func (SSLCertificate) GetContent

func (s SSLCertificate) GetContent() string

GetContent implements the FileItem interface.

func (SSLCertificate) GetIdentifier

func (s SSLCertificate) GetIdentifier() string

GetIdentifier implements the FileItem interface.

Jump to

Keyboard shortcuts

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