Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ linters:
- linters:
- godot
path: internal/annotation/load_balancer.go
- linters:
- godot
path: internal/config/load_balancer_envs.go
- linters:
- errcheck
- gosec
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ repos:
require_serial: false
additional_dependencies: [prettier@3.7.4]
files: \.(md|ya?ml)$
exclude: ^(CHANGELOG.md|chart/templates/.*|chart/.snapshots/.*|docs/reference/load_balancer_annotations\.md)$
exclude: ^(CHANGELOG.md|chart/templates/.*|chart/.snapshots/.*|docs/reference/load_balancer_.*\.md|)$

- repo: local
hooks:
Expand Down
24 changes: 24 additions & 0 deletions docs/reference/load_balancer_envs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Load Balancer Environment Variables

This page contains all environment variables, which can be specified to configure the Load Balancer controller of HCCM.

Some environment variables define global defaults. These defaults can be overridden by setting the corresponding annotation. If you remove such an annotation while a global default is configured, the global default will be applied again.

Enums are depicted in the `Type` column and possible options are separated via the pipe symbol `|`.

| Environment Variable | Type | Default | Description |
| --- | --- | --- | --- |
| `HCLOUD_LOAD_BALANCERS_ALGORITHM_TYPE` | `round_robin \| least_connections` | `round_robin` | Configures the default Load Balancer algorithm. |
| `HCLOUD_LOAD_BALANCERS_DISABLE_IPV6` | `bool` | `false` | Disables the use of IPv6 for the Load Balancer by default. |
| `HCLOUD_LOAD_BALANCERS_DISABLE_PRIVATE_INGRESS` | `bool` | `false` | Disables the use of the private network for ingress by default. |
| `HCLOUD_LOAD_BALANCERS_DISABLE_PUBLIC_NETWORK` | `bool` | `false` | Disables the public interface of the Load Balancer by default. |
| `HCLOUD_LOAD_BALANCERS_ENABLED` | `bool` | `true` | Controls whether the load balancer controller of HCCM should run. |
| `HCLOUD_LOAD_BALANCERS_HEALTH_CHECK_INTERVAL` | `int` | `10` | Configures the default time interval in seconds in which health checks are performed. |
| `HCLOUD_LOAD_BALANCERS_HEALTH_CHECK_RETRIES` | `int` | `3` | Configures the default amount of unsuccessful retries needed until a target is considered unhealthy. |
| `HCLOUD_LOAD_BALANCERS_HEALTH_CHECK_TIMEOUT` | `int` | `15` | Configures the default time in seconds after an attempt is considered a timeout. |
| `HCLOUD_LOAD_BALANCERS_LOCATION` | `string` | `-` | Specifies the default location where the Load Balancer will be created in. Mutually exclusive with hcloudLoadBalancersNetworkZone. |
| `HCLOUD_LOAD_BALANCERS_NETWORK_ZONE` | `string` | `-` | Specifies the default network zone where the Load Balancer will be created in. Mutually exclusive with hcloudLoadBalancersLocation. |
| `HCLOUD_LOAD_BALANCERS_PRIVATE_SUBNET_IP_RANGE` | `string` | `-` | Configures the default IP range in CIDR block notation of the subnet to attach to. |
| `HCLOUD_LOAD_BALANCERS_TYPE` | `string` | `lb11` | Configures the default Load Balancer type this Load Balancer should be created with. |
| `HCLOUD_LOAD_BALANCERS_USES_PROXYPROTOCOL` | `bool` | `false` | Enables the proxyprotocol for a Load Balancer service by default. |
| `HCLOUD_LOAD_BALANCERS_USE_PRIVATE_IP` | `bool` | `false` | Configures the Load Balancer to use the private IP for Load Balancer server targets by default. |
15 changes: 0 additions & 15 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,6 @@ const (
hcloudNetworkDisableAttachedCheck = "HCLOUD_NETWORK_DISABLE_ATTACHED_CHECK"
hcloudNetworkRoutesEnabled = "HCLOUD_NETWORK_ROUTES_ENABLED"

hcloudLoadBalancersAlgorithmType = "HCLOUD_LOAD_BALANCERS_ALGORITHM_TYPE"
hcloudLoadBalancersDisableIPv6 = "HCLOUD_LOAD_BALANCERS_DISABLE_IPV6"
hcloudLoadBalancersDisablePrivateIngress = "HCLOUD_LOAD_BALANCERS_DISABLE_PRIVATE_INGRESS"
hcloudLoadBalancersDisablePublicNetwork = "HCLOUD_LOAD_BALANCERS_DISABLE_PUBLIC_NETWORK"
hcloudLoadBalancersEnabled = "HCLOUD_LOAD_BALANCERS_ENABLED"
hcloudLoadBalancersHealthCheckInterval = "HCLOUD_LOAD_BALANCERS_HEALTH_CHECK_INTERVAL"
hcloudLoadBalancersHealthCheckRetries = "HCLOUD_LOAD_BALANCERS_HEALTH_CHECK_RETRIES"
hcloudLoadBalancersHealthCheckTimeout = "HCLOUD_LOAD_BALANCERS_HEALTH_CHECK_TIMEOUT"
hcloudLoadBalancersLocation = "HCLOUD_LOAD_BALANCERS_LOCATION"
hcloudLoadBalancersNetworkZone = "HCLOUD_LOAD_BALANCERS_NETWORK_ZONE"
hcloudLoadBalancersPrivateSubnetIPRange = "HCLOUD_LOAD_BALANCERS_PRIVATE_SUBNET_IP_RANGE"
hcloudLoadBalancersType = "HCLOUD_LOAD_BALANCERS_TYPE"
hcloudLoadBalancersUsePrivateIP = "HCLOUD_LOAD_BALANCERS_USE_PRIVATE_IP"
hcloudLoadBalancersUsesProxyProtocol = "HCLOUD_LOAD_BALANCERS_USES_PROXYPROTOCOL"

hcloudMetricsEnabled = "HCLOUD_METRICS_ENABLED"
hcloudMetricsAddress = "HCLOUD_METRICS_ADDRESS"
)
Expand Down
95 changes: 95 additions & 0 deletions internal/config/load_balancer_envs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package config

const (
// hcloudLoadBalancersEnabled controls whether the load balancer controller of HCCM should run.
//
// Type: bool
// Default: true
hcloudLoadBalancersEnabled = "HCLOUD_LOAD_BALANCERS_ENABLED"

// hcloudLoadBalancersLocation specifies the default location where the Load Balancer will be
// created in.
//
// Mutually exclusive with hcloudLoadBalancersNetworkZone.
//
// Type: string
hcloudLoadBalancersLocation = "HCLOUD_LOAD_BALANCERS_LOCATION"

// hcloudLoadBalancersNetworkZone specifies the default network zone where the Load Balancer will be
// created in.
//
// Mutually exclusive with hcloudLoadBalancersLocation.
//
// Type: string
hcloudLoadBalancersNetworkZone = "HCLOUD_LOAD_BALANCERS_NETWORK_ZONE"

// hcloudLoadBalancersDisablePrivateIngress disables the use of the private network for ingress by default.
//
// Type: bool
// Default: false
hcloudLoadBalancersDisablePrivateIngress = "HCLOUD_LOAD_BALANCERS_DISABLE_PRIVATE_INGRESS"

// hcloudLoadBalancersUsePrivateIP configures the Load Balancer to use the private IP for
// Load Balancer server targets by default.
//
// Type: bool
// Default: false
hcloudLoadBalancersUsePrivateIP = "HCLOUD_LOAD_BALANCERS_USE_PRIVATE_IP"

// hcloudLoadBalancersDisableIPv6 disables the use of IPv6 for the Load Balancer by default.
//
// Type: bool
// Default: false
hcloudLoadBalancersDisableIPv6 = "HCLOUD_LOAD_BALANCERS_DISABLE_IPV6"

// hcloudLoadBalancersAlgorithmType configures the default Load Balancer algorithm.
//
// Type: round_robin | least_connections
// Default: round_robin
hcloudLoadBalancersAlgorithmType = "HCLOUD_LOAD_BALANCERS_ALGORITHM_TYPE"

// hcloudLoadBalancersDisablePublicNetwork disables the public interface of the Load Balancer by default.
//
// Type: bool
// Default: false
hcloudLoadBalancersDisablePublicNetwork = "HCLOUD_LOAD_BALANCERS_DISABLE_PUBLIC_NETWORK"

// hcloudLoadBalancersHealthCheckInterval configures the default time interval in seconds
// in which health checks are performed.
//
// Type: int
// Default: 10
hcloudLoadBalancersHealthCheckInterval = "HCLOUD_LOAD_BALANCERS_HEALTH_CHECK_INTERVAL"

// hcloudLoadBalancersHealthCheckRetries configures the default amount of unsuccessful retries
// needed until a target is considered unhealthy.
//
// Type: int
// Default: 3
hcloudLoadBalancersHealthCheckRetries = "HCLOUD_LOAD_BALANCERS_HEALTH_CHECK_RETRIES"

// hcloudLoadBalancersHealthCheckTimeout configures the default time in seconds after an attempt is
// considered a timeout.
//
// Type: int
// Default: 15
hcloudLoadBalancersHealthCheckTimeout = "HCLOUD_LOAD_BALANCERS_HEALTH_CHECK_TIMEOUT"

// hcloudLoadBalancersPrivateSubnetIPRange configures the default IP range in CIDR block notation of
// the subnet to attach to.
//
// Type: string
hcloudLoadBalancersPrivateSubnetIPRange = "HCLOUD_LOAD_BALANCERS_PRIVATE_SUBNET_IP_RANGE"

// hcloudLoadBalancersType configures the default Load Balancer type this Load Balancer should be created with.
//
// Type: string
// Default: lb11
hcloudLoadBalancersType = "HCLOUD_LOAD_BALANCERS_TYPE"

// hcloudLoadBalancersUsesProxyProtocol enables the proxyprotocol for a Load Balancer service by default.
//
// Type: bool
// Default: false
hcloudLoadBalancersUsesProxyProtocol = "HCLOUD_LOAD_BALANCERS_USES_PROXYPROTOCOL"
)
Loading