Documentation ¶
Index ¶
- func BuildDaemonSet(name string, podSpec *v1.PodSpec, mutators map[string][]PodSpecMutatorFunc) *apps.DaemonSet
- func BuildSelfHostedComponentLabelQuery(componentName string) string
- func BuildSelfhostedComponentLabels(component string) map[string]string
- func CreateSelfHostedControlPlane(manifestsDir, kubeConfigDir string, cfg *kubeadmapi.InitConfiguration, ...) error
- func GetDefaultMutators() map[string][]PodSpecMutatorFunc
- func GetMutatorsFromFeatureGates(featureGates map[string]bool) map[string][]PodSpecMutatorFunc
- type PodSpecMutatorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDaemonSet ¶
func BuildDaemonSet(name string, podSpec *v1.PodSpec, mutators map[string][]PodSpecMutatorFunc) *apps.DaemonSet
BuildDaemonSet is responsible for mutating the PodSpec and returns a DaemonSet which is suitable for self-hosting
func BuildSelfHostedComponentLabelQuery ¶
BuildSelfHostedComponentLabelQuery creates the right query for matching a self-hosted Pod
func BuildSelfhostedComponentLabels ¶
BuildSelfhostedComponentLabels returns the labels for a self-hosted component
func CreateSelfHostedControlPlane ¶
func CreateSelfHostedControlPlane(manifestsDir, kubeConfigDir string, cfg *kubeadmapi.InitConfiguration, client clientset.Interface, waiter apiclient.Waiter, dryRun bool) error
CreateSelfHostedControlPlane is responsible for turning a Static Pod-hosted control plane to a self-hosted one It achieves that task this way:
- Load the Static Pod specification from disk (from /etc/kubernetes/manifests)
- Extract the PodSpec from that Static Pod specification
- Mutate the PodSpec to be compatible with self-hosting (add the right labels, taints, etc. so it can schedule correctly)
- Build a new DaemonSet object for the self-hosted component in question. Use the above mentioned PodSpec
- Create the DaemonSet resource. Wait until the Pods are running.
- Remove the Static Pod manifest file. The kubelet will stop the original Static Pod-hosted component that was running.
- The self-hosted containers should now step up and take over.
- In order to avoid race conditions, we have to make sure that static pod is deleted correctly before we continue Otherwise, there is a race condition when we proceed without kubelet having restarted the API server correctly and the next .Create call flakes
- Do that for the kube-apiserver, kube-controller-manager and kube-scheduler in a loop
func GetDefaultMutators ¶
func GetDefaultMutators() map[string][]PodSpecMutatorFunc
GetDefaultMutators gets the mutator functions that always should be used
func GetMutatorsFromFeatureGates ¶
func GetMutatorsFromFeatureGates(featureGates map[string]bool) map[string][]PodSpecMutatorFunc
GetMutatorsFromFeatureGates returns all mutators needed based on the feature gates passed
Types ¶
type PodSpecMutatorFunc ¶
PodSpecMutatorFunc is a function capable of mutating a PodSpec