haproxy

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: Apache-2.0 Imports: 46 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.

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.

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 BufferSize = 16000

BufferSize is the default value of HAproxy tune.bufsize. Not recommended to change it Map payload or socket data cannot be bigger than tune.bufsize

Variables

This section is empty.

Functions

func DeepCopyBackend

func DeepCopyBackend(original *models.Backend) (*models.Backend, error)

func DeepCopyFrontend

func DeepCopyFrontend(original *models.Frontend) (*models.Frontend, error)

func HashSHA1

func HashSHA1(data string) string

HashSHA1 returns the SHA-1 hash of a string in hexadecimal

Types

type BackendImpactedInCycle

type BackendImpactedInCycle struct {
	Name         string
	HTTPRouteKey client.ObjectKey
	BackendRef   gatewayv1.HTTPBackendRef
}

type BackendOwnerType

type BackendOwnerType string
const (
	BackendOwnerTypeHTTPRoute BackendOwnerType = "HTTPRoute"
	BackendOwnerTypeTLSRoute  BackendOwnerType = "TLSRoute"
)

type BackendPort

type BackendPort struct {
	// contains filtered or unexported fields
}

BackendPort is used to store both a backend name and the Service Port (not the target Port)

type BackendReferencedBy

type BackendReferencedBy struct {
	// contains filtered or unexported fields
}

func NewBackendOwners

func NewBackendOwners() BackendReferencedBy

type BackendsImpactedInCycle

type BackendsImpactedInCycle struct {
	Upserted map[string]map[client.ObjectKey]BackendImpactedInCycle // map[backendName] -> map [routeKey]
	Deleted  map[string]struct{}                                    // map[backendName]
	// For unreferenced backends, just update the metadata
	Unreferenced map[string]struct{} // map[backendName]
}

type Configuration

type Configuration struct {
	// contains filtered or unexported fields
}

type Endpoints

type Endpoints struct {
	// contains filtered or unexported fields
}

type ErrMapRuntimeUpdate

type ErrMapRuntimeUpdate struct {
	Err     error
	Type    string
	MapName string
	Key     string
	Value   string
}

ErrMapRuntimeUpdate is an error type for runtime map update failures

func (*ErrMapRuntimeUpdate) Error

func (e *ErrMapRuntimeUpdate) Error() string

type FirstSync

type FirstSync struct {
	// contains filtered or unexported fields
}

type HaproxyConfMgr

type HaproxyConfMgr interface {
	// ComputeDiffs computes the HAProxy configuration diffs.
	ComputeDiffs(ctx context.Context) error
	GetDiffs() diffs.HaproxyConfDiffs
}

func NewHaproxyConfMgr

func NewHaproxyConfMgr(logger *slog.Logger, controllerStore *tree.ControllerStore, startupStructured structured.Structured,
	params HaproxyConfMgrParams, haproxyClient api.HAProxyClient, k8sClient client.Client,
) HaproxyConfMgr

type HaproxyConfMgrImpl

type HaproxyConfMgrImpl struct {
	// contains filtered or unexported fields
}

func (*HaproxyConfMgrImpl) ComputeDiffs

func (b *HaproxyConfMgrImpl) ComputeDiffs(ctx context.Context) error

func (*HaproxyConfMgrImpl) GetDiffs

type HaproxyConfMgrParams

type HaproxyConfMgrParams struct {
	HaproxyConfParams
	// contains filtered or unexported fields
}

func NewHaproxyConfMgrParams

func NewHaproxyConfMgrParams(extractGVK utilsk8s.ExtractGVK, haproxyConfParams HaproxyConfParams,
	certificateStorage storage.CertificateStorage, mapsStorageEx storage.MapsStorageEx,
) (HaproxyConfMgrParams, error)

type HaproxyConfParams

type HaproxyConfParams struct {
	// HaproxyDirs contains all the needed dir
	// used for example in map files reference
	HaproxyDirs
	// Templates for all generated names (Frontend, Backend, Server)
	templates.Templates
	// IPv4BindAddress is the IPv4 address to bind to.
	IPv4BindAddress string
	// IPv6BindAddress is the IPv6 address to bind to.
	IPv6BindAddress string
	// DefaultsSectionName is the defaults name to use to create FE/BE/...
	DefaultsSectionName string
	// StoreCertificateStructureType contains the structure type of the certificates storage
	StoreCertificateStructureType storage.StructureType
	StoreMapsStructureType        storage.StructureType
	// LindID: an ID for the link to the cluster
	LinkID string
	// TimeoutWaitForRuntime speficied the max time to wait for HUG library to the runtime.Runtime at startup
	// This is used in combination with UpdateHaproxyThroughRuntime = true
	// If UpdateHaproxyThroughRuntime = false, the gate library does not need runtime.Runtime and does not wait for it.
	TimeoutWaitForRuntime time.Duration
	// DisableIPv4 indicates whether IPv4 is disabled.
	DisableIPv4 bool
	// DisableIPv6 indicates whether IPv6 is disabled.
	DisableIPv6 bool
	// RuntimeUpdateHaproxy is a flag that indicates to the gate library to try to perform runtime commands
	RuntimeUpdateHaproxy bool
	// StoreCertificatesOnDisk is a flag that indicates to the gate library to store certificates on disk
	StoreCertificateOnDisk bool
	// StoreMapsOnDisk is a flag that indicates to the gate library to store maps on disk
	StoreMapsOnDisk bool
}

type HaproxyConfUpdateResult

type HaproxyConfUpdateResult struct {
	Error                   error          // nil if successful
	UpdatedSectionsMetaData map[string]any // map[section name]metadata
}

type HaproxyDirs

type HaproxyDirs struct {
	CfgDir        string
	MainCfgFile   string
	RouteLuaFile  string
	HaproxyBinary string
	RuntimeDir    string
	StateDir      string
	AuxDir        string
	PIDFile       string
	RuntimeSocket string
	MasterSocket  string
	PatternDir    string
	ErrFileDir    string
	CertsDir      string
	CertListDir   string
	MapsDir       string
}

type RouteMgrImpl

type RouteMgrImpl struct {
	// contains filtered or unexported fields
}

func (*RouteMgrImpl) ResetMapFiles added in v0.9.0

func (b *RouteMgrImpl) ResetMapFiles()

type RuntimeServerStateData

type RuntimeServerStateData struct {
	BackendName string
	ServerName  string
	IP          string
	State       string
	Port        int
}

type ServerDiff added in v0.9.0

type ServerDiff struct {
	// contains filtered or unexported fields
}

type SvcEndpoints

type SvcEndpoints map[discoveryV1.AddressType]Endpoints

SvcEndpoints describes endpoints of a service port map[discoveryV1.AddressType]map[port]map[address]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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