Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes undefined group['node'] if missing from hosts.ini #2

Merged
merged 8 commits into from
Sep 20, 2022

Conversation

ioagel
Copy link
Owner

@ioagel ioagel commented Sep 20, 2022

  • consolidates handling of master taints in group_vars, all.yml
...

k3s_node_exists: "{{ 'true' if groups['node'] | default([]) | length >= 1 else 'false' }}"

...

extra_server_args: >-
  {{ extra_args }}
  {{ '--node-taint node-role.kubernetes.io/master=true:NoSchedule' if k3s_node_exists | bool else '' }}
  --tls-san {{ apiserver_endpoint }}
  --disable servicelb
  --disable traefik

There is no need for users to mess with the roles even for the taint functionality. The addition to extra_server_args avoids duplication in files: roles/k3s/master/tasks/main.yml and roles/k3s/master/templates/k3s.service.j2. For k3s anyway, taints are another extra server arg.
Now even if a user wants to run for example, 3 master and 2 worker nodes with all of them being schedulable, they just have to delete the taint entry in extra_server_args variable.

The new addition in extra_server_args: --tls-san {{ apiserver_endpoint }} is mandatory, because the ip of our virtual ip needs to be in the SANs of the api server certificate, otherwise we cannot access our cluster.

About testing and linting

In the ipv6 molecule test, because we override the extra_server_args, I added the 2 new entries:

  • --tls-san {{ apiserver_endpoint }}
  • {{ '--node-taint node-role.kubernetes.io/master=true:NoSchedule' if k3s_node_exists | bool else '' }}

The rest of the changes were to make the linter happy, despite my commits had nothing to do with breaking the linter. I wonder if anyone could make any pull request without the linting action failing... ;-)
I think it is fixed even in a hacky way!
By the way I noticed intermittent failures in the metallb wait task in GitHub actions and I had to increase it to 120s. After that I had no failures.

- increases the metallb timeout error due to intermittent testing errors in GitHub actions
- fixing line too long error
@ioagel ioagel merged commit 862d419 into master Sep 20, 2022
@ioagel ioagel deleted the fix_taints_bug branch September 22, 2022 13:28
ioagel added a commit that referenced this pull request Sep 25, 2022
* add virtual-ip to certificate SAN entries

Adds the kube-vip IP as a Subject Alternative Name in the TLS cert. It is needed otherwise you cannot access the cluster.

* fixes bug with master taints (#1)

- improves taint logic

* fixes typo

* fixes formatting

* fixes undefined group['node'] if missing from hosts.ini (#2)

* fixes undefined group['node'] if missing from hosts.ini

- improves application of master taint by centralizing code

* improves molecule testing, fixes linting

* hacking at linter problems, small tweaks

- increases the metallb timeout error due to intermittent testing errors in GitHub actions

* improves context by renaming taint variable

- makes variable boolean

* fix bug

* removes linting hacks

Co-authored-by: Ioannis Angelakopoulos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant