Documentation
¶
Overview ¶
Package config parses and validates command-line flags for k8s-httpcache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultDebounceLatencyBuckets = []float64{0.01, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10}
DefaultDebounceLatencyBuckets are the default histogram bucket boundaries (in seconds) for the debounce_latency_seconds metric. Treat as immutable: it is package-level shared state, so callers must not sort, append to, or otherwise modify the slice.
var ErrHelp = errors.New("help requested")
ErrHelp is returned by Parse when --help is shown. The caller should treat this as a successful exit (exit code 0).
Functions ¶
This section is empty.
Types ¶
type BackendSelectorSpec ¶
type BackendSelectorSpec struct {
Selector string // Kubernetes label selector (e.g. "app=myapp,tier=backend")
Port string // optional port override for all discovered services
Namespace string // resolved namespace (empty = all namespaces when AllNamespaces is true)
AllNamespaces bool // true = watch all namespaces
}
BackendSelectorSpec describes a label selector for automatic backend service discovery.
type BackendSpec ¶
type BackendSpec struct {
Name string // template key (e.g. "api")
ServiceName string // Kubernetes Service name
Port string // numeric port, named port, or "" = first EndpointSlice port
Namespace string // Kubernetes namespace (resolved from [namespace/]service or --namespace)
}
BackendSpec describes one upstream backend service to watch.
type Config ¶
type Config struct {
ServiceName string
ServiceNamespace string // resolved namespace for the frontend service
Namespace string
VCLTemplate string
ListenAddrs []ListenAddrSpec
VarnishdPath string
VarnishadmPath string
BroadcastAddr string
BroadcastTargetListenAddr string
BroadcastTargetPort int32 // resolved from BroadcastTargetListenAddr
BroadcastDrainTimeout time.Duration
BroadcastShutdownTimeout time.Duration
BroadcastServerIdleTimeout time.Duration
BroadcastReadHeaderTimeout time.Duration
BroadcastReadTimeout time.Duration
BroadcastWriteTimeout time.Duration
BroadcastClientIdleTimeout time.Duration
BroadcastClientTimeout time.Duration
Debounce time.Duration
DebounceMax time.Duration
FrontendDebounce time.Duration
FrontendDebounceMax time.Duration
BackendDebounce time.Duration
BackendDebounceMax time.Duration
ShutdownTimeout time.Duration
StartupTimeout time.Duration
KubeAPITimeout time.Duration
Backends []BackendSpec
BackendSelectors []BackendSelectorSpec
Values []ValuesSpec
Secrets []SecretsSpec
TLSCerts []TLSCertSpec
TLSCertDebounce time.Duration
TLSCertDebounceMax time.Duration
ValuesDirs []ValuesDirSpec
ValuesDirPollInterval time.Duration
MetricsAddr string
MetricsReadHeaderTimeout time.Duration
MetricsReadTimeout time.Duration
MetricsWriteTimeout time.Duration
MetricsIdleTimeout time.Duration
ExtraVarnishd []string // Additional args passed to varnishd (after --)
LogLevel slog.Level
LogFormat string // "text" or "json"
AdminTimeout time.Duration
Drain bool
DrainDelay time.Duration
DrainPollInterval time.Duration
DrainTimeout time.Duration
VCLTemplateWatchInterval time.Duration
FileWatch bool
ValuesDirWatch bool
VarnishstatPath string
TemplateDelimLeft string
TemplateDelimRight string
TemplateFuncs string
VCLReloadRetries int
VCLReloadRetryInterval time.Duration
VCLKept int
DebounceLatencyBuckets []float64
Zone string
VarnishstatExport bool
VarnishstatExportFilter []string
VarnishncsaEnabled bool
VarnishncsaPath string
VarnishncsaFormat string // -F format string
VarnishncsaQuery string // -q VSL query
VarnishncsaBackend bool // -b backend mode (default: client)
VarnishncsaOutput string // -w file path (empty = stdout)
VarnishncsaPrefix string // line prefix for stdout output
ExcludeAnnotations []string
}
Config holds the parsed configuration for the k8s-httpcache process.
type ListenAddrSpec ¶
type ListenAddrSpec struct {
Name string // optional name (e.g. "http")
Host string // bind IP (e.g. "0.0.0.0", "127.0.0.1", or "" for all interfaces); unset for UDS listeners
Port int32 // numeric port extracted from the address; 0 for UDS listeners
Raw string // original flag value passed through to varnishd
UDS bool // unix domain socket listener (absolute path or @abstract); Host/Port are unset
}
ListenAddrSpec describes a Varnish listen address parsed from the varnishd -a flag format: [name=][bind-ip]:port[,proto[,proto...]].
type SecretsSpec ¶
type SecretsSpec struct {
Name string // template key, accessible as .Secrets.<Name>.<key>
SecretName string // Kubernetes Secret name
Namespace string // Kubernetes namespace (resolved from [namespace/]secret or --namespace)
}
SecretsSpec describes one Secret to watch and expose as template values.
type TLSCertSpec ¶
type TLSCertSpec struct {
Name string // logical/SNI label (logging, metrics, dedup key)
SecretName string // Kubernetes Secret name (kubernetes.io/tls)
Namespace string // Kubernetes namespace (resolved from [namespace/]secret or --namespace)
}
TLSCertSpec describes one kubernetes.io/tls Secret to watch and install as a frontend TLS certificate.
type ValuesDirSpec ¶
type ValuesDirSpec struct {
Name string // template key, accessible as .Values.<Name>.<key>
Path string // filesystem directory path
}
ValuesDirSpec describes a filesystem directory to poll for YAML values.
type ValuesSpec ¶
type ValuesSpec struct {
Name string // template key, accessible as .Values.<Name>.<key>
ConfigMapName string // Kubernetes ConfigMap name
Namespace string // Kubernetes namespace (resolved from [namespace/]configmap or --namespace)
}
ValuesSpec describes one ConfigMap to watch and expose as template values.