config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

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

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.

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.

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

Constants

View Source
const (
	DefaultWaitForRuntimeTimeout = 10 * time.Second
	DefaultCertsDirName          = "certs"
	DefaultCertFilesDirName      = "certlists"
	DefaultMapsDirName           = "maps"
	DefaultErrFilesDirName       = "errorfiles"
	DefaultPatternDirName        = "patterns"
)

Variables

This section is empty.

Functions

func NewBaseLogger

func NewBaseLogger(handlerType logging.LogHandlerType, defaultLevel slog.Level, categoryLevels map[v3.Category]slog.Level) (*slog.Logger, *logging.CategoryFilterHandler)

Types

type Configuration

type Configuration struct {
	// Initial Structured config used at startup
	InitialStructuredHaproxyConf structured.Structured
	Logger                       *slog.Logger
	LogHandler                   *logging.CategoryFilterHandler
	// TransferHaproxyConfChannel is used to send the HaproxyConfDiffs to the application
	TransferHaproxyConfChannel chan diffs.HaproxyConfDiffs
	// MetricsConfig specifies the metrics config.
	MetricsConfig MetricsConfig
	// ControllerPodConfig contains information about this Pod.
	ControllerPodConfig ControllerPodConfig
	//  Namespace and name of the controller conf CRD:  HugConf
	HugConfCRD types.NamespacedName
	// LogHandlerType defines the type of log Handler we want: json or text
	// Default will be json
	LogHandlerType logging.LogHandlerType
	Kubeconfig     string
	// ControllerName is the name of this controller.
	ControllerName string
	// LeaderElectionConfig contains the configuration for leader election.
	LeaderElectionConfig LeaderElectionConfig
	// Namespaces is a list of namespaces to watch.
	// If empty, all namespaces are watched.
	Namespaces []string
	// HaproxyConfParams contains the needed configuration to compute the FE/BE/...
	HaproxyParams haproxy.HaproxyConfParams
	// SyncPeriod is the duration we wait after handling one batch before the next one
	SyncPeriod time.Duration
	// StartupSyncPeriod is the first (at startup) duration we wait after handling one batch before the next one
	// After the first one, SyncPeriod will be used
	StartupSyncPeriod time.Duration
	// CacheResyncPeriod is the manager cache SyncPeriod
	// SyncPeriod determines the minimum frequency at which watched resources are
	// reconciled. A lower period will correct entropy more quickly, but reduce
	// responsiveness to change if there are many watched resources. Change this
	// value only if you know what you are doing. Defaults to 10 hours if unset.
	// there will a 10 percent jitter between the SyncPeriod of all controllers
	// so that all controllers will not send list requests simultaneously.
	//
	// This applies to all controllers.
	CacheResyncPeriod time.Duration
	// InitialStructuredHaproxyConfOK bool
	InitialStructuredHaproxyConfOK bool
}

func (*Configuration) ApplyDefaults

func (cfg *Configuration) ApplyDefaults()

func (*Configuration) Check

func (c *Configuration) Check() error

Checker is a function to check the configuration. This can be a different for EE or CE

type ControllerPodConfig

type ControllerPodConfig struct {
	// PodIP is the IP address of this Pod.
	PodIP string
	// Namespace is the namespace of this Pod.
	Namespace string
	// Name is the name of the Pod.
	Name string
}

ControllerPodConfig contains information about this Pod.

type GateConfigOptions

type GateConfigOptions []func(c *Configuration) error

type K8sLogging

type K8sLogging struct {
	LogConverter io.Writer
	// AtomicLevel is an atomically changeable, dynamic logging level.
	AtomicLevel zap.AtomicLevel
	RLogger     logr.Logger
}

type LeaderElectionConfig

type LeaderElectionConfig struct {
	// LockName holds the name of the leader election lock.
	LockName string
	// Enabled indicates whether leader election is enabled.
	Enabled bool
}

LeaderElectionConfig contains the configuration for leader election.

type MetricsAuthMode added in v0.9.1

type MetricsAuthMode string

MetricsAuthMode defines the authentication mode for the metrics endpoint.

const (
	MetricsAuthNone     MetricsAuthMode = "none"
	MetricsAuthKubeRBAC MetricsAuthMode = "kube-rbac"
	MetricsAuthBasic    MetricsAuthMode = "basic"
)

type MetricsConfig

type MetricsConfig struct {
	// AuthMode is the authentication mode for the metrics endpoint.
	AuthMode MetricsAuthMode
	// BasicAuthUser is the username for basic auth (when AuthMode is "basic").
	BasicAuthUser string
	// BasicAuthPassword is the password for basic auth (when AuthMode is "basic").
	BasicAuthPassword string
	// Port is the port the metrics should be exposed on.
	Port int
	// Enabled is the flag for toggling metrics on or off.
	Enabled bool
	// Secure is the flag for toggling the metrics endpoint to https.
	Secure bool
}

MetricsConfig specifies the metrics config.

Jump to

Keyboard shortcuts

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