Add nodeselector and tolerations for metallb (#7334)

* add nodeselector and tolerations for metallb

* remove unnecessary commented lines in metallb template

* set default speaker toleration to match original manifest
pull/7265/head
François Hernandez 2021-03-08 16:57:42 +01:00 committed by GitHub
parent dc5df57c26
commit c7db72e1da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 4 deletions

View File

@ -132,6 +132,28 @@ cert_manager_enabled: false
metallb_enabled: false
# metallb_ip_range:
# - "10.5.0.50-10.5.0.99"
# metallb_speaker_nodeselector:
# kubernetes.io/os: "linux"
# metallb_controller_nodeselector:
# kubernetes.io/os: "linux"
# metallb_speaker_tolerations:
# - key: "node-role.kubernetes.io/master"
# operator: "Equal"
# value: ""
# effect: "NoSchedule"
# - key: "node-role.kubernetes.io/control-plane"
# operator: "Equal"
# value: ""
# effect: "NoSchedule"
# metallb_controller_tolerations:
# - key: "node-role.kubernetes.io/master"
# operator: "Equal"
# value: ""
# effect: "NoSchedule"
# - key: "node-role.kubernetes.io/control-plane"
# operator: "Equal"
# value: ""
# effect: "NoSchedule"
# metallb_version: v0.9.5
# metallb_protocol: "layer2"
# metallb_port: "7472"

View File

@ -6,3 +6,11 @@ metallb_port: "7472"
metallb_limits_cpu: "100m"
metallb_limits_mem: "100Mi"
metallb_peers: []
metallb_speaker_nodeselector: {}
metallb_controller_nodeselector: {}
metallb_speaker_tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
metallb_controller_tolerations: []

View File

@ -345,11 +345,14 @@ spec:
kubernetes.io/os: linux
serviceAccountName: speaker
terminationGracePeriodSeconds: 2
{% if metallb_speaker_nodeselector %}
nodeSelector:
{{ metallb_speaker_nodeselector | to_nice_yaml | indent(width=8) }}
{%- endif %}
{% if metallb_speaker_tolerations %}
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
{{ metallb_speaker_tolerations | to_nice_yaml(indent=2) | indent(width=8) }}
{% endif %}
---
apiVersion: apps/v1
kind: Deployment
@ -374,6 +377,14 @@ spec:
app: metallb
component: controller
spec:
{% if metallb_controller_nodeselector %}
nodeSelector:
{{ metallb_controller_nodeselector | to_nice_yaml | indent(width=8) }}
{%- endif %}
{% if metallb_controller_tolerations %}
tolerations:
{{ metallb_controller_tolerations | to_nice_yaml(indent=2) | indent(width=8) }}
{% endif %}
containers:
- args:
- --port={{ metallb_port }}