From eed5627e6da0555d2527d64761c86dd58ae39ca5 Mon Sep 17 00:00:00 2001 From: Johannes Liebermann Date: Tue, 22 Sep 2020 17:28:54 +0200 Subject: [PATCH 1/3] docs/metallb: Clarify address_pool knob The current sample config is confusing. The address_pools knob is a map with string keys and lists of strings as values. There are no knobs named "default" or "special_addresses". These were intended as sample names for pools. Fixes #632. --- docs/configuration-reference/components/metallb.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/configuration-reference/components/metallb.md b/docs/configuration-reference/components/metallb.md index 3116e7f18..a87d4d05f 100644 --- a/docs/configuration-reference/components/metallb.md +++ b/docs/configuration-reference/components/metallb.md @@ -50,8 +50,8 @@ MetalLB component configuration example: ```tf component "metallb" { address_pools = { - default = ["147.63.8.20/32"] - special_addresses = ["147.85.47.16/29", "147.85.47.24/29"] + pool1 = ["147.63.8.20/32"] + pool2 = ["147.85.47.16/29", "147.85.47.24/29"] } controller_node_selectors = { "kubernetes.io/hostname" = "worker3" @@ -85,7 +85,7 @@ Example: | Argument | Description | Default | Type | Required | |-----------------------------|--------------------------------------------------------------------------------------------|:-------:|:---------------------------------------------------------------------------------------------------------------|:--------:| -| `address_pools` | A map which allows specifying one or more CIDRs which MetalLB can use to expose services. | - | object({default = list(string), special_addresses = list(string)}) | true | +| `address_pools` | A map which allows specifying one or more CIDRs which MetalLB can use to expose services. | - | map(list(string)) | true | | `controller_node_selectors` | A map with specific labels to run MetalLB controller pods selectively on a group of nodes. | - | map(string) | false | | `speaker_node_selectors` | A map with specific labels to run MetalLB speaker pods selectively on a group of nodes. | - | map(string) | false | | `controller_toleration` | Specify one or more tolerations for controller pods. | - | list(object({key = string, effect = string, operator = string, value = string, toleration_seconds = string })) | false | From a2b39784a8638ad754fb162b52ee107ecf8bb336 Mon Sep 17 00:00:00 2001 From: Johannes Liebermann Date: Tue, 22 Sep 2020 18:54:41 +0200 Subject: [PATCH 2/3] docs/metallb: Add missing whitespace --- docs/configuration-reference/components/metallb.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/configuration-reference/components/metallb.md b/docs/configuration-reference/components/metallb.md index a87d4d05f..3177d3d34 100644 --- a/docs/configuration-reference/components/metallb.md +++ b/docs/configuration-reference/components/metallb.md @@ -100,6 +100,7 @@ To apply the MetalLB component: ```bash lokoctl component apply metallb ``` + ## Deleting To destroy the component: From 2631fda724e20d370d26577a1a7544ea90ce3f95 Mon Sep 17 00:00:00 2001 From: Johannes Liebermann Date: Tue, 22 Sep 2020 19:58:36 +0200 Subject: [PATCH 3/3] docs/metallb: Explain IP allocation logic --- .../components/metallb.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/configuration-reference/components/metallb.md b/docs/configuration-reference/components/metallb.md index 3177d3d34..2f966a929 100644 --- a/docs/configuration-reference/components/metallb.md +++ b/docs/configuration-reference/components/metallb.md @@ -77,6 +77,28 @@ component "metallb" { MetalLB will use the specified CIDR for exposing services of type `LoadBalancer`. +### Advanced IP allocation + +By default, MetalLB uses all specified address pools to allocate IP addresses to services. To +request an address from a specific pool, set the `metallb.universe.tf/address-pool` annotation for +the relevant service: + +```yaml +apiVersion: v1 +kind: Service +metadata: + name: nginx + annotations: + metallb.universe.tf/address-pool: pool2 +spec: + ports: + - port: 80 + targetPort: 80 + selector: + app: nginx + type: LoadBalancer +``` + ## Attribute reference Table of all the arguments accepted by the component.