mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-12 05:08:50 +00:00
kubeadm config migrate uses AnyConfigFileAndDefaultsToInternal, which can unmarshal config from file only if InitConfiguration or JoinConfiguration are present. Even with that in mind, it can only return a singlie config object, with InitConfiguration taking precendence over JoinConfiguration. Thus, the following cases were not handled properly, while they were perfectly valid for kubeadm init/join: - ClusterConfiguration only file caused kubeadm config migrate to exit with error. - Init + Join configurations in the same file caused Init + Cluster configuration to be produced (ignoring JoinConfiguration). The same is valid when the combo is Init + Cluster + Join configurations. - Cluster + Join configuration ignores ClusterConfiguration and only JoinConfiguration gets migrated. To fix this, the following is done: - Introduce MigrateOldConfigFromFile which migrates old config from a file, while ensuring that all kubeadm originated input config kinds are taken care of. Add comprehensive unit tests for this. - Replace the use of AnyConfigFileAndDefaultsToInternal in kubeadm config migrate with MigrateOldConfigFromFile. - Remove the no longer used and error prone AnyConfigFileAndDefaultsToInternal. Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>