kubernetes/cmd/kubeadm/app
Lubomir I. Ivanov 6cf3e36c37 kubeadm: statically default the "from cluster" InitConfiguration
During operations such as "upgrade", kubeadm fetches the
ClusterConfiguration object from the kubeadm ConfigMap.
However, due to requiring node specifics it wraps it in an
InitConfiguration object. The function responsible for that is:
  app/util/config#FetchInitConfigurationFromCluster().

A problem with this function (and sub-calls) is that it ignores
the static defaults applied from versioned types
(e.g. v1beta3/defaults.go) and only applies dynamic defaults for:
- API endpoints
- node registration
- etc...

The introduction of Init|JoinConfiguration.ImagePullPolicy now
has static defaulting of the NodeRegistration object with a default
policy of "PullIfNotPresent". Respect this defaulting by constructing
a defaulted internal InitConfiguration from
FetchInitConfigurationFromCluster() and only then apply the dynamic
defaults over it.

This fixes a bug where "kubeadm upgrade ..." fails when pulling images
due to an empty ("") ImagePullPolicy. We could assume that empty
string means default policy on runtime in:
cmd/kubeadm/app/preflight/checks.go#ImagePullCheck()

but that might actually not be the user intent during "init" and "join",
due to e.g. a typo. Similarly, we don't allow empty tokens
on runtime and error out.
2021-07-08 02:52:11 +03:00
..
apis Merge pull request #103496 from neolit123/1.22-add-defaulting-v1beta3-imagepull 2021-07-06 22:11:48 -07:00
cmd Merge pull request #103471 from pacoxu/patch-1 2021-07-04 23:06:53 -07:00
componentconfigs re-order the imports in kubeadm 2021-07-04 16:41:27 +08:00
constants Merge pull request #103142 from serathius/etcd-3.5.0 2021-07-07 12:40:22 -07:00
discovery re-order the imports in kubeadm 2021-07-04 16:41:27 +08:00
features re-order the imports in kubeadm 2021-07-04 16:41:27 +08:00
images re-order the imports in kubeadm 2021-07-04 16:41:27 +08:00
phases re-order the imports in kubeadm 2021-07-04 16:41:27 +08:00
preflight kubeadm: statically default ImagePullPolicy in v1beta3 2021-07-05 21:48:06 +03:00
util kubeadm: statically default the "from cluster" InitConfiguration 2021-07-08 02:52:11 +03:00
kubeadm.go re-order the imports in kubeadm 2021-07-04 16:41:27 +08:00