hetzner-k3s icon indicating copy to clipboard operation
hetzner-k3s copied to clipboard

Call first_master earlier and exclude from other_masters

Open cwilhelm opened this issue 5 months ago • 2 comments

get first_master earlier and exclude it from other_masters #311

cwilhelm avatar Jan 31 '24 16:01 cwilhelm

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

sonarcloud[bot] avatar Feb 01 '24 08:02 sonarcloud[bot]

Do you mind describing these changes a bit more? How do these solve the problem you highlighted in https://github.com/vitobotta/hetzner-k3s/issues/311 exactly?

I am not keen with introducing a "first master index" config setting" as it's brittle.

I think we can implement a more automatic recovery from this kind of scenario (first master deleted and replaced with a new one): when setting up a master which doesn't have the API responding yet, we can simply query the other masters and pick the token from the first one that responds to API calls.

So

  • new cluster, no masters active: when setting up the first master no other masters will respond to API calls yet, so assume it's a new cluster and pick the first master as main
  • new cluster, first master already active while we are setting up the other masters: we repeat the above for each master identically. In this case, since the first master is assumed to be active already when we set up master2 and master3, it will pick the token from master1
  • existing cluster, first master replaced: again before setting up the replacement master, we query if other masters are responding to the API, if yes we pick the token from one of them and use that token to have the replacement first master join the others instead of initializing a new cluster.

WDYT?

vitobotta avatar Apr 12 '24 11:04 vitobotta

Thanks again for the PR. I am closing because I handled this in a more robust way in https://github.com/vitobotta/hetzner-k3s/pull/348 for the upcoming new major version v2.0.0.

vitobotta avatar Apr 28 '24 16:04 vitobotta