Skip to content

Commit

Permalink
Pick kube-vip interface automatically by default (#238)
Browse files Browse the repository at this point in the history
* Pick kube-vip interface automatically by default

* molecule: Fix ipv6 scenario

* Choose a more restrictive molecule timeout in CI
  • Loading branch information
sleiner authored Feb 20, 2023
1 parent 65bbc8e commit 7bc198a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
- name: Test with molecule
run: molecule test --scenario-name ${{ matrix.scenario }}
timeout-minutes: 90
env:
ANSIBLE_K3S_LOG_DIR: ${{ runner.temp }}/logs/k3s-ansible/${{ matrix.scenario }}
ANSIBLE_SSH_RETRIES: 4
Expand Down
5 changes: 5 additions & 0 deletions molecule/ipv6/overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
# See: https://github.com/flannel-io/flannel/blob/67d603aaf45ef80f5dd39f43714fc5e6f8a637eb/Documentation/troubleshooting.md#Vagrant # noqa yaml[line-length]
flannel_iface: eth1

# In this scenario, we have multiple interfaces that the VIP could be
# broadcasted on. Since we have assigned a dedicated private network
# here, let's make sure that it is used.
kube_vip_iface: eth1

# The test VMs might be a bit slow, so we give them more time to join the cluster:
retry_count: 45

Expand Down
5 changes: 5 additions & 0 deletions roles/k3s/master/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
# If you want to explicitly define an interface that ALL control nodes
# should use to propagate the VIP, define it here. Otherwise, kube-vip
# will determine the right interface automatically at runtime.
kube_vip_iface: null

server_init_args: >-
{% if groups['master'] | length > 1 %}
{% if ansible_hostname == hostvars[groups['master'][0]]['ansible_hostname'] %}
Expand Down
4 changes: 3 additions & 1 deletion roles/k3s/master/templates/vip.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ spec:
value: "true"
- name: port
value: "6443"
{% if kube_vip_iface %}
- name: vip_interface
value: {{ flannel_iface }}
value: {{ kube_vip_iface }}
{% endif %}
- name: vip_cidr
value: "{{ apiserver_endpoint | ansible.utils.ipsubnet | ansible.utils.ipaddr('prefix') }}"
- name: cp_enable
Expand Down

0 comments on commit 7bc198a

Please sign in to comment.