Skip to content

Commit

Permalink
Merge pull request #190 from strelok899/adding-IPVS-option
Browse files Browse the repository at this point in the history
Adding-IPVS-option
  • Loading branch information
MonolithProjects authored Feb 8, 2024
2 parents 8d68186 + 3bf1b22 commit 4a35717
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ rke2_kubevip_image: ghcr.io/kube-vip/kube-vip:v0.6.4
# Specify which image is used for kube-vip cloud provider container
rke2_kubevip_cloud_provider_image: ghcr.io/kube-vip/kube-vip-cloud-provider:v0.0.4

# Enable kube-vip IPVS load balancer for control plane
rke2_kubevip_ipvs_lb_enable: false
# Enable layer 4 load balancing for control plane using IPVS kernel module
# Must use kube-vip version 0.4.0 or later

# (Optional) A list of kube-vip flags
# All flags can be found here https://kube-vip.io/docs/installation/flags/
# rke2_kubevip_args: []
Expand Down
6 changes: 6 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ rke2_kubevip_image: ghcr.io/kube-vip/kube-vip:v0.6.4
# Specify which image is used for kube-vip cloud provider container
rke2_kubevip_cloud_provider_image: ghcr.io/kube-vip/kube-vip-cloud-provider:v0.0.4

# Enable kube-vip IPVS load balancer for control plane
rke2_kubevip_ipvs_lb_enable: false
# Enable layer 4 load balancing for control plane using IPVS kernel module
# Must use kube-vip version 0.4.0 or later


# (Optional) A list of kube-vip flags
# All flags can be found here https://kube-vip.io/docs/installation/flags/
# rke2_kubevip_args: []
Expand Down
13 changes: 13 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@
when:
- rke2_ha_mode | bool

- name: Enable IPVS kernel module
community.general.modprobe:
name: ip_vs
state: present
persistent: present
when:
- rke2_kubevip_ipvs_lb_enable | bool
- inventory_hostname in groups[rke2_servers_group_name]
- rke2_ha_mode | bool
- rke2_ha_mode_kubevip | bool
- not rke2_ha_mode_keepalived | bool


- name: Copy kube-vip manifests to the masternode
ansible.builtin.include_tasks: kubevip.yml
when:
Expand Down
2 changes: 2 additions & 0 deletions templates/kube-vip/kube-vip.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ spec:
value: "{{ rke2_api_ip }}"
- name: prometheus_server
value: :2112
- name: lb_enable
value: "{{ rke2_kubevip_ipvs_lb_enable }}"
{% if rke2_kubevip_args is defined %}
{% for item in rke2_kubevip_args %}
- name: {{ item.param }}
Expand Down

0 comments on commit 4a35717

Please sign in to comment.