voxpupuli / puppet-k8s

Home for the K8s Puppet module
Apache License 2.0
9 stars 12 forks source link

all K8s::Server::Resources/Kubectl_apply fail on bootstrapping a new cluster #23

Closed rwaffen closed 1 year ago

rwaffen commented 1 year ago

on the first run on an empty control plane with managing etcd all the K8s::Server::Resources/Kubectl_apply fail. on the second run you see that it now adds the etcd-servers from puppetdb to KUBE_APISERVER_ARGS

-KUBE_APISERVER_ARGS="... --etcd-servers= ...."
+KUBE_APISERVER_ARGS="... --etcd-servers=https://controller-0.example.com:2379 ..."

is this per design, because the resources are only send to puppetdb at the end of the first puppet run? or is this some kind of race-condition?

will test this a bit more, because i'm not sure if it is every time or only very often.

rwaffen commented 1 year ago

okay, it's not every time. but i think because i revert/clear/clean my control plane node again and again, there might be some leftovers in the puppetdb. maybe have to test also with empty puppetdb. or we add a note to documentation on first run on first controller on empty puppetdb 🤔

ananace commented 1 year ago

Maybe deferring setup if there aren't any etcd servers could improve the first run experience, skipping setup of resources - and maybe also skipping apiserver setup entirely by injecting something like this in the discovery block;

if $_discovery['etcd_servers'] !~ Array[Data, 1] {
  notfy { 'Deferring apiserver setup, no etcd servers': }
  return()
}

In that vein, perhaps an empty list of etcd servers should be a failure condition if discovery isn't enabled, since the cluster will never install without them.

rwaffen commented 1 year ago

fixed