Browse Source

Add 'avoid-buggy-ips' support of MetalLB (#9166)

pull/9166/merge
Ho Kim 2 years ago
committed by GitHub
parent
commit
e31890806c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 2 deletions
  1. 6
      docs/metallb.md
  2. 3
      inventory/sample/group_vars/k8s_cluster/addons.yml
  3. 1
      roles/kubernetes-apps/metallb/defaults/main.yml
  4. 8
      roles/kubernetes-apps/metallb/templates/metallb-config.yml.j2

6
docs/metallb.md

@ -19,6 +19,7 @@ You have to explicitly enable the MetalLB extension and set an IP address range
```yaml ```yaml
metallb_enabled: true metallb_enabled: true
metallb_speaker_enabled: true metallb_speaker_enabled: true
metallb_avoid_buggy_ips: true
metallb_ip_range: metallb_ip_range:
- 10.5.0.0/16 - 10.5.0.0/16
``` ```
@ -73,12 +74,13 @@ In this scenarion you should disable the MetalLB speaker and configure the `cali
```yaml ```yaml
metallb_speaker_enabled: false metallb_speaker_enabled: false
metallb_avoid_buggy_ips: true
metallb_ip_range: metallb_ip_range:
- 10.5.0.0/16 - 10.5.0.0/16
calico_advertise_service_loadbalancer_ips: "{{ metallb_ip_range }}" calico_advertise_service_loadbalancer_ips: "{{ metallb_ip_range }}"
``` ```
If you have additional loadbalancer IP pool in `metallb_additional_address_pools`, ensure to add them to the list.
If you have additional loadbalancer IP pool in `metallb_additional_address_pools` , ensure to add them to the list.
```yaml ```yaml
metallb_speaker_enabled: false metallb_speaker_enabled: false
@ -90,11 +92,13 @@ metallb_additional_address_pools:
- 10.6.0.0/16 - 10.6.0.0/16
protocol: "bgp" protocol: "bgp"
auto_assign: false auto_assign: false
avoid_buggy_ips: true
kube_service_pool_2: kube_service_pool_2:
ip_range: ip_range:
- 10.10.0.0/16 - 10.10.0.0/16
protocol: "bgp" protocol: "bgp"
auto_assign: false auto_assign: false
avoid_buggy_ips: true
calico_advertise_service_loadbalancer_ips: calico_advertise_service_loadbalancer_ips:
- 10.5.0.0/16 - 10.5.0.0/16
- 10.6.0.0/16 - 10.6.0.0/16

3
inventory/sample/group_vars/k8s_cluster/addons.yml

@ -166,6 +166,7 @@ metallb_speaker_enabled: true
# - "10.5.0.50-10.5.0.99" # - "10.5.0.50-10.5.0.99"
# metallb_pool_name: "loadbalanced" # metallb_pool_name: "loadbalanced"
# metallb_auto_assign: true # metallb_auto_assign: true
# metallb_avoid_buggy_ips: false
# metallb_speaker_nodeselector: # metallb_speaker_nodeselector:
# kubernetes.io/os: "linux" # kubernetes.io/os: "linux"
# metallb_controller_nodeselector: # metallb_controller_nodeselector:
@ -198,6 +199,7 @@ metallb_speaker_enabled: true
# - "10.5.1.50-10.5.1.99" # - "10.5.1.50-10.5.1.99"
# protocol: "layer2" # protocol: "layer2"
# auto_assign: false # auto_assign: false
# avoid_buggy_ips: false
# metallb_protocol: "bgp" # metallb_protocol: "bgp"
# metallb_peers: # metallb_peers:
# - peer_address: 192.0.2.1 # - peer_address: 192.0.2.1
@ -207,7 +209,6 @@ metallb_speaker_enabled: true
# peer_asn: 64513 # peer_asn: 64513
# my_asn: 4200000000 # my_asn: 4200000000
argocd_enabled: false argocd_enabled: false
# argocd_version: v2.4.7 # argocd_version: v2.4.7
# argocd_namespace: argocd # argocd_namespace: argocd

1
roles/kubernetes-apps/metallb/defaults/main.yml

@ -20,3 +20,4 @@ metallb_speaker_tolerations:
metallb_controller_tolerations: [] metallb_controller_tolerations: []
metallb_pool_name: "loadbalanced" metallb_pool_name: "loadbalanced"
metallb_auto_assign: true metallb_auto_assign: true
metallb_avoid_buggy_ips: false

8
roles/kubernetes-apps/metallb/templates/metallb-config.yml.j2

@ -34,6 +34,9 @@ data:
{% if metallb_auto_assign == false %} {% if metallb_auto_assign == false %}
auto-assign: false auto-assign: false
{% endif %} {% endif %}
{% if metallb_avoid_buggy_ips == true %}
avoid-buggy-ips: true
{% endif %}
{% if metallb_additional_address_pools is defined %}{% for pool in metallb_additional_address_pools %} {% if metallb_additional_address_pools is defined %}{% for pool in metallb_additional_address_pools %}
- name: {{ pool }} - name: {{ pool }}
protocol: {{ metallb_additional_address_pools[pool].protocol }} protocol: {{ metallb_additional_address_pools[pool].protocol }}
@ -41,6 +44,11 @@ data:
{% for ip_range in metallb_additional_address_pools[pool].ip_range %} {% for ip_range in metallb_additional_address_pools[pool].ip_range %}
- {{ ip_range }} - {{ ip_range }}
{% endfor %} {% endfor %}
{% if metallb_additional_address_pools[pool].auto_assign is defined %}
auto-assign: {{ metallb_additional_address_pools[pool].auto_assign }} auto-assign: {{ metallb_additional_address_pools[pool].auto_assign }}
{% endif %}
{% if metallb_additional_address_pools[pool].avoid_buggy_ips is defined %}
avoid-buggy-ips: {{ metallb_additional_address_pools[pool].avoid_buggy_ips }}
{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
Loading…
Cancel
Save