Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,17 @@ export ROBOT_PASSWORD=<Your Robot Password>
go test ./tests/e2e -tags e2e,robot -v
```

### Annotation Reference Generation
### Annotation and Environment Variable Reference Generation

The [Load Balancer annotation reference](docs/reference/load_balancer_annotations.md) is autogenerated via a custom written tool. This tool can be found at `tools/doc_generation.go`.
The [Load Balancer annotation reference](docs/reference/load_balancer_annotations.md) and the [Load Balancer environment variable reference](docs/reference/load_balancer_envs.md) are autogenerated via a custom written tool. This tool can be found at `tools/doc_generation.go`.

The docstring format contains a description, starting with the constant name. The next lines can contain additional information about the annotation. Supported fields are:

- `Type`: Specifies the type of the annotation. If the annotation is an enum, all possible values need to be separated via a pipe symbol `|`.
- `Default`: Specifies the default value of the annotation. When no default value is set, `-` is displayed.
- `Read-only`: Specifies whether the annotation is read-only or not. If the annotation is read-only, it will be set by the HCCM and cannot be set by the user.
- `Internal`: Specifies whether the annotation is for internal use only. If the annotation is internal, it will not be displayed in the reference documentation.
- You can reference other annotations or env vars by wrapping the target constant name in square brackets, e.g. `[LBAlgorithmType]`.

#### Example

Expand Down
56 changes: 28 additions & 28 deletions docs/reference/load_balancer_annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,42 @@ This page contains all annotations, which can be specified at a Service of type
- Read-only annotations are set by the Cloud Controller Manager.
- Enums are depicted in the `Type` column and possible options are separated via the pipe symbol `|`.

| Annotation | Type | Default | Read-only | Description |
| Name | Type | Default | Read-only | Description |
| --- | --- | --- | --- | --- |
| `load-balancer.hetzner.cloud/algorithm-type` | `round_robin \| least_connections` | `round_robin` | `No` | Specifies the algorithm type of the Load Balancer. |
| `load-balancer.hetzner.cloud/certificate-type` | `uploaded \| managed` | `uploaded` | `No` | Defines the type of certificate the Load Balancer should use. |
| `load-balancer.hetzner.cloud/disable-private-ingress` | `bool` | `false` | `No` | Disables the use of the private network for ingress. |
| `load-balancer.hetzner.cloud/disable-public-network` | `bool` | `false` | `No` | Disables the public network of the Hetzner Cloud Load Balancer. It will still have a public network assigned, but all traffic is routed over the private network. |
| `load-balancer.hetzner.cloud/health-check-http-domain` | `string` | `-` | `No` | Specifies the domain we try to access when performing the health check. |
| `load-balancer.hetzner.cloud/health-check-http-path` | `string` | `-` | `No` | Specifies the path we try to access when performing the health check. |
| `load-balancer.hetzner.cloud/health-check-http-validate-certificate` | `bool` | `-` | `No` | Specifies whether the health check should validate the SSL certificate that comes from the target nodes. |
| `load-balancer.hetzner.cloud/health-check-interval` | `int` | `-` | `No` | Specifies the interval in which time we perform a health check in seconds. |
| `load-balancer.hetzner.cloud/health-check-port` | `int` | `-` | `No` | Specifies the port the health check is be performed on. |
| `load-balancer.hetzner.cloud/health-check-protocol` | `tcp \| http \| https` | `tcp` | `No` | Sets the protocol the health check should be performed over. |
| `load-balancer.hetzner.cloud/health-check-retries` | `int` | `-` | `No` | Specifies the number of time a health check is retried until a target is marked as unhealthy. |
| `load-balancer.hetzner.cloud/health-check-timeout` | `int` | `-` | `No` | Specifies the timeout of a single health check. |
| `load-balancer.hetzner.cloud/hostname` | `string` | `-` | `No` | Specifies the hostname of the Load Balancer. This will be used as ingress address instead of the Load Balancer IP addresses if specified. |
| `load-balancer.hetzner.cloud/http-certificates` | `string` | `-` | `No` | A comma separated list of IDs or Names of Certificates assigned to the service. |
| `load-balancer.hetzner.cloud/http-cookie-lifetime` | `int` | `-` | `No` | Specifies the lifetime of the HTTP cookie. |
| `load-balancer.hetzner.cloud/http-cookie-name` | `string` | `-` | `No` | Specifies the cookie name when using HTTP or HTTPS as protocol. |
| `load-balancer.hetzner.cloud/http-managed-certificate-domains` | `string` | `-` | `No` | Contains a comma separated list of the domain names of the managed certificate. All domains are used to create a single managed certificate. |
| `load-balancer.hetzner.cloud/http-managed-certificate-name` | `string` | `-` | `No` | Contains the name of the managed certificate to create by the Cloud Controller manager. Ignored if `load-balancer.hetzner.cloud/http-managed-certificate-name` is missing or set to "uploaded". |
| `load-balancer.hetzner.cloud/http-redirect-http` | `bool` | `false` | `No` | Create a redirect from HTTP to HTTPS. |
| `load-balancer.hetzner.cloud/http-status-codes` | `string` | `-` | `No` | Is a comma separated list of HTTP status codes which we expect. |
| `load-balancer.hetzner.cloud/http-sticky-sessions` | `bool` | `false` | `No` | Enables the sticky sessions feature of Hetzner Cloud HTTP Load Balancers. |
| `load-balancer.hetzner.cloud/id` | `string` | `-` | `Yes` | Is the ID assigned to the Hetzner Cloud Load Balancer by the backend. Deprecated: This annotation is not used. It is reserved for possible future use. |
| `load-balancer.hetzner.cloud/ipv4` | `string` | `-` | `Yes` | Is the public IPv4 address assigned to the Load Balancer by the backend. |
| `load-balancer.hetzner.cloud/ipv4-rdns` | `string` | `-` | `Yes` | Is the reverse DNS record assigned to the IPv4 address of the Load Balancer. |
| `load-balancer.hetzner.cloud/ipv6` | `string` | `-` | `Yes` | Is the public IPv6 address assigned to the Load Balancer by the backend. |
| `load-balancer.hetzner.cloud/ipv6-disabled` | `bool` | `false` | `No` | Disables the use of IPv6 for the Load Balancer. Set this annotation if you use external-dns. |
| `load-balancer.hetzner.cloud/ipv6-rdns` | `string` | `-` | `Yes` | Is the reverse DNS record assigned to the IPv6 address of the Load Balancer. |
| `load-balancer.hetzner.cloud/location` | `string` | `-` | `No` | Specifies the location where the Load Balancer will be created in. Changing the location to a different value after the load balancer was created has no effect. In order to move a load balancer to a different location it is necessary to delete and re-create it. Note, that this will lead to the load balancer getting new public IPs assigned. Mutually exclusive with LBNetworkZone. |
| `load-balancer.hetzner.cloud/ipv6-disabled` | `bool` | `false` | `No` | Disables the use of IPv6 for the Load Balancer. Set this annotation if you use external-dns. |
| `load-balancer.hetzner.cloud/name` | `string` | `-` | `No` | Is the name of the Load Balancer. The name will be visible in the Hetzner Cloud API console. |
| `load-balancer.hetzner.cloud/network-zone` | `string` | `-` | `No` | Specifies the network zone where the Load Balancer will be created in. Changing the network zone to a different value after the load balancer was created has no effect. In order to move a load balancer to a different network zone it is necessary to delete and re-create it. Note, that this will lead to the load balancer getting new public IPs assigned. Mutually exclusive with LBLocation. |
| `load-balancer.hetzner.cloud/node-selector` | `string` | `-` | `No` | Can be set to restrict which Nodes are added as targets to the Load Balancer. It accepts a Kubernetes label selector string, using either the set-based or equality-based formats. If the selector can not be parsed, the targets in the Load Balancer are not updated and an Event is created with the error message. Format: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors |
| `load-balancer.hetzner.cloud/disable-public-network` | `bool` | `false` | `No` | Disables the public network of the Hetzner Cloud Load Balancer. It will still have a public network assigned, but all traffic is routed over the private network. |
| `load-balancer.hetzner.cloud/disable-private-ingress` | `bool` | `false` | `No` | Disables the use of the private network for ingress. |
| `load-balancer.hetzner.cloud/use-private-ip` | `bool` | `false` | `No` | Configures the Load Balancer to use the private IP for Load Balancer server targets. |
| `load-balancer.hetzner.cloud/private-ipv4` | `string` | `-` | `No` | Specifies the IPv4 address to assign to the load balancer in the private network that it's attached to. |
| `load-balancer.hetzner.cloud/private-subnet-ip-range` | `string` | `-` | `No` | Specifies an existing subnet to which the load balancer will be attached. The value must be in the CIDR notation. The subnet must belong to the network defined in the CCM configuration and must already exist. See: https://docs.hetzner.cloud/reference/cloud#network-actions-add-a-subnet-to-a-network |
| `load-balancer.hetzner.cloud/hostname` | `string` | `-` | `No` | Specifies the hostname of the Load Balancer. This will be used as ingress address instead of the Load Balancer IP addresses if specified. |
| `load-balancer.hetzner.cloud/protocol` | `tcp \| http \| https` | `tcp` | `No` | Specifies the protocol of the service. |
| `load-balancer.hetzner.cloud/algorithm-type` | `round_robin \| least_connections` | `round_robin` | `No` | Specifies the algorithm type of the Load Balancer. |
| `load-balancer.hetzner.cloud/type` | `string` | `lb11` | `No` | Specifies the type of the Load Balancer. |
| `load-balancer.hetzner.cloud/use-private-ip` | `bool` | `false` | `No` | Configures the Load Balancer to use the private IP for Load Balancer server targets. |
| `load-balancer.hetzner.cloud/location` | `string` | `-` | `No` | Specifies the location where the Load Balancer will be created in. Changing the location to a different value after the load balancer was created has no effect. In order to move a load balancer to a different location it is necessary to delete and re-create it. Note, that this will lead to the load balancer getting new public IPs assigned. Mutually exclusive with `load-balancer.hetzner.cloud/network-zone`. |
| `load-balancer.hetzner.cloud/network-zone` | `string` | `-` | `No` | Specifies the network zone where the Load Balancer will be created in. Changing the network zone to a different value after the load balancer was created has no effect. In order to move a load balancer to a different network zone it is necessary to delete and re-create it. Note, that this will lead to the load balancer getting new public IPs assigned. Mutually exclusive with `load-balancer.hetzner.cloud/location`. |
| `load-balancer.hetzner.cloud/node-selector` | `string` | `-` | `No` | Can be set to restrict which Nodes are added as targets to the Load Balancer. It accepts a Kubernetes label selector string, using either the set-based or equality-based formats. If the selector can not be parsed, the targets in the Load Balancer are not updated and an Event is created with the error message. Format: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors |
| `load-balancer.hetzner.cloud/uses-proxyprotocol` | `bool` | `false` | `No` | Specifies if the Load Balancer services should use the proxy protocol. |
| `load-balancer.hetzner.cloud/http-cookie-name` | `string` | `-` | `No` | Specifies the cookie name when using HTTP or HTTPS as protocol. |
| `load-balancer.hetzner.cloud/http-cookie-lifetime` | `int` | `-` | `No` | Specifies the lifetime of the HTTP cookie. |
| `load-balancer.hetzner.cloud/certificate-type` | `uploaded \| managed` | `uploaded` | `No` | Defines the type of certificate the Load Balancer should use. |
| `load-balancer.hetzner.cloud/http-certificates` | `string` | `-` | `No` | A comma separated list of IDs or Names of Certificates assigned to the service. |
| `load-balancer.hetzner.cloud/http-managed-certificate-name` | `string` | `-` | `No` | Contains the name of the managed certificate to create by the Cloud Controller manager. Ignored if `load-balancer.hetzner.cloud/certificate-type` is missing or set to "uploaded". |
| `load-balancer.hetzner.cloud/http-managed-certificate-domains` | `string` | `-` | `No` | Contains a comma separated list of the domain names of the managed certificate. All domains are used to create a single managed certificate. |
| `load-balancer.hetzner.cloud/http-redirect-http` | `bool` | `false` | `No` | Create a redirect from HTTP to HTTPS. |
| `load-balancer.hetzner.cloud/http-sticky-sessions` | `bool` | `false` | `No` | Enables the sticky sessions feature of Hetzner Cloud HTTP Load Balancers. |
| `load-balancer.hetzner.cloud/health-check-protocol` | `tcp \| http \| https` | `tcp` | `No` | Sets the protocol the health check should be performed over. |
| `load-balancer.hetzner.cloud/health-check-port` | `int` | `-` | `No` | Specifies the port the health check is be performed on. |
| `load-balancer.hetzner.cloud/health-check-interval` | `int` | `-` | `No` | Specifies the interval in which time we perform a health check in seconds. |
| `load-balancer.hetzner.cloud/health-check-timeout` | `int` | `-` | `No` | Specifies the timeout of a single health check. |
| `load-balancer.hetzner.cloud/health-check-retries` | `int` | `-` | `No` | Specifies the number of time a health check is retried until a target is marked as unhealthy. |
| `load-balancer.hetzner.cloud/health-check-http-domain` | `string` | `-` | `No` | Specifies the domain we try to access when performing the health check. |
| `load-balancer.hetzner.cloud/health-check-http-path` | `string` | `-` | `No` | Specifies the path we try to access when performing the health check. |
| `load-balancer.hetzner.cloud/health-check-http-validate-certificate` | `bool` | `-` | `No` | Specifies whether the health check should validate the SSL certificate that comes from the target nodes. |
| `load-balancer.hetzner.cloud/http-status-codes` | `string` | `-` | `No` | Is a comma separated list of HTTP status codes which we expect. |
| `load-balancer.hetzner.cloud/id` | `string` | `-` | `Yes` | Is the ID assigned to the Hetzner Cloud Load Balancer by the backend. Deprecated: This annotation is not used. It is reserved for possible future use. |
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 hcloud-cloud-controller-manager.

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 `|`.

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `HCLOUD_LOAD_BALANCERS_ENABLED` | `bool` | `true` | Controls whether the load balancer controller of HCCM should run. |
| `HCLOUD_LOAD_BALANCERS_LOCATION` | `string` | `-` | Specifies the default location where the Load Balancer will be created in. Mutually exclusive with `HCLOUD_LOAD_BALANCERS_NETWORK_ZONE`. |
| `HCLOUD_LOAD_BALANCERS_NETWORK_ZONE` | `string` | `-` | Specifies the default network zone where the Load Balancer will be created in. Mutually exclusive with `HCLOUD_LOAD_BALANCERS_LOCATION`. |
| `HCLOUD_LOAD_BALANCERS_DISABLE_PRIVATE_INGRESS` | `bool` | `false` | Disables the use of the private network for ingress 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. |
| `HCLOUD_LOAD_BALANCERS_DISABLE_IPV6` | `bool` | `false` | Disables the use of IPv6 for the Load Balancer by default. |
| `HCLOUD_LOAD_BALANCERS_ALGORITHM_TYPE` | `round_robin \| least_connections` | `round_robin` | Configures the default Load Balancer algorithm. |
| `HCLOUD_LOAD_BALANCERS_DISABLE_PUBLIC_NETWORK` | `bool` | `false` | Disables the public interface of the Load Balancer by default. |
| `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_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. |
6 changes: 3 additions & 3 deletions internal/annotation/load_balancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const (
// location it is necessary to delete and re-create it. Note, that this
// will lead to the load balancer getting new public IPs assigned.
//
// Mutually exclusive with LBNetworkZone.
// Mutually exclusive with [LBNetworkZone].
//
// Type: string
LBLocation Name = "load-balancer.hetzner.cloud/location"
Expand All @@ -125,7 +125,7 @@ const (
// that this will lead to the load balancer getting new public IPs
// assigned.
//
// Mutually exclusive with LBLocation.
// Mutually exclusive with [LBLocation].
//
// Type: string
LBNetworkZone Name = "load-balancer.hetzner.cloud/network-zone"
Expand Down Expand Up @@ -175,7 +175,7 @@ const (

// LBSvcHTTPManagedCertificateName contains the name of the managed
// certificate to create by the Cloud Controller manager. Ignored if
// LBSvcHTTPCertificateType is missing or set to "uploaded".
// [LBSvcHTTPCertificateType] is missing or set to "uploaded".
//
// Type: string
LBSvcHTTPManagedCertificateName Name = "load-balancer.hetzner.cloud/http-managed-certificate-name"
Expand Down
Loading
Loading