Skip to content

Commit

Permalink
Add 'avoid-buggy-ips' support of MetalLB (kubernetes-sigs#9166)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoKim98 authored and nolimitkun committed Mar 19, 2023
1 parent 0be6f0c commit 9878d14
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/metallb.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ You have to explicitly enable the MetalLB extension and set an IP address range
```yaml
metallb_enabled: true
metallb_speaker_enabled: true
metallb_avoid_buggy_ips: true
metallb_ip_range:
- 10.5.0.0/16
```
Expand Down Expand Up @@ -73,12 +74,13 @@ In this scenarion you should disable the MetalLB speaker and configure the `cali

```yaml
metallb_speaker_enabled: false
metallb_avoid_buggy_ips: true
metallb_ip_range:
- 10.5.0.0/16
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
metallb_speaker_enabled: false
Expand All @@ -90,11 +92,13 @@ metallb_additional_address_pools:
- 10.6.0.0/16
protocol: "bgp"
auto_assign: false
avoid_buggy_ips: true
kube_service_pool_2:
ip_range:
- 10.10.0.0/16
protocol: "bgp"
auto_assign: false
avoid_buggy_ips: true
calico_advertise_service_loadbalancer_ips:
- 10.5.0.0/16
- 10.6.0.0/16
Expand Down
3 changes: 2 additions & 1 deletion inventory/sample/group_vars/k8s_cluster/addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ metallb_speaker_enabled: true
# - "10.5.0.50-10.5.0.99"
# metallb_pool_name: "loadbalanced"
# metallb_auto_assign: true
# metallb_avoid_buggy_ips: false
# metallb_speaker_nodeselector:
# kubernetes.io/os: "linux"
# metallb_controller_nodeselector:
Expand Down Expand Up @@ -198,6 +199,7 @@ metallb_speaker_enabled: true
# - "10.5.1.50-10.5.1.99"
# protocol: "layer2"
# auto_assign: false
# avoid_buggy_ips: false
# metallb_protocol: "bgp"
# metallb_peers:
# - peer_address: 192.0.2.1
Expand All @@ -207,7 +209,6 @@ metallb_speaker_enabled: true
# peer_asn: 64513
# my_asn: 4200000000


argocd_enabled: false
# argocd_version: v2.4.7
# argocd_namespace: argocd
Expand Down
1 change: 1 addition & 0 deletions roles/kubernetes-apps/metallb/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ metallb_speaker_tolerations:
metallb_controller_tolerations: []
metallb_pool_name: "loadbalanced"
metallb_auto_assign: true
metallb_avoid_buggy_ips: false
8 changes: 8 additions & 0 deletions roles/kubernetes-apps/metallb/templates/metallb-config.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ data:
{% if metallb_auto_assign == false %}
auto-assign: false
{% 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 %}
- name: {{ pool }}
protocol: {{ metallb_additional_address_pools[pool].protocol }}
addresses:
{% for ip_range in metallb_additional_address_pools[pool].ip_range %}
- {{ ip_range }}
{% endfor %}
{% if metallb_additional_address_pools[pool].auto_assign is defined %}
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 %}
{% endif %}

0 comments on commit 9878d14

Please sign in to comment.