From a656b7ed9af78a37520cceb30af8fec0aae1fa88 Mon Sep 17 00:00:00 2001 From: Louis Tu <92532497+tu1h@users.noreply.github.com> Date: Tue, 9 Jan 2024 15:22:13 +0800 Subject: [PATCH] Add kube_vip_lb_fwdmethod option for kube-vip (#10762) Signed-off-by: tu1h --- docs/kube-vip.md | 6 ++++++ roles/kubernetes/node/defaults/main.yml | 1 + .../node/templates/manifests/kube-vip.manifest.j2 | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/docs/kube-vip.md b/docs/kube-vip.md index 846ec099a..d5878ab6a 100644 --- a/docs/kube-vip.md +++ b/docs/kube-vip.md @@ -70,3 +70,9 @@ If using [control plane load-balancing](https://kube-vip.io/docs/about/architect ```yaml kube_vip_lb_enable: true ``` + +In addition, [load-balancing method](https://kube-vip.io/docs/installation/flags/#environment-variables) could be changed: + +```yaml +kube_vip_lb_fwdmethod: masquerade +``` diff --git a/roles/kubernetes/node/defaults/main.yml b/roles/kubernetes/node/defaults/main.yml index cbe95835c..0522187b9 100644 --- a/roles/kubernetes/node/defaults/main.yml +++ b/roles/kubernetes/node/defaults/main.yml @@ -86,6 +86,7 @@ kube_vip_bgppeers: kube_vip_address: kube_vip_enableServicesElection: false kube_vip_lb_enable: false +kube_vip_lb_fwdmethod: local # Requests for load balancer app loadbalancer_apiserver_memory_requests: 32M diff --git a/roles/kubernetes/node/templates/manifests/kube-vip.manifest.j2 b/roles/kubernetes/node/templates/manifests/kube-vip.manifest.j2 index b95b47469..936ad44d2 100644 --- a/roles/kubernetes/node/templates/manifests/kube-vip.manifest.j2 +++ b/roles/kubernetes/node/templates/manifests/kube-vip.manifest.j2 @@ -77,6 +77,10 @@ spec: {% if kube_vip_lb_enable %} - name: lb_enable value: "true" +{% endif %} +{% if kube_vip_lb_fwdmethod %} + - name: lb_fwdmethod + value: {{ kube_vip_lb_fwdmethod | string | to_json }} {% endif %} image: {{ kube_vip_image_repo }}:{{ kube_vip_image_tag }} imagePullPolicy: {{ k8s_image_pull_policy }}