kubeadm: simplify fuzzing of ClusterConfiguration

- Pin the ClusterConfiguration when fuzzing
the internal InitConfiguration that embeds it. Kubeadm includes
separate constructs for this embedding in the internal type
and this round trip is not viable.
- Remove the artificial calls to SetDefaults_ClusterConfiguration()
in v1beta{2|3}'s converters from public to internal InitConfiguration.
- Make sure the internal InitConfiguration.ClusterConfiguration is
defaulted in initconfiguration.go instead.
This commit is contained in:
Lubomir I. Ivanov
2021-04-29 02:00:59 +03:00
parent 6c3654db1b
commit 8eca7298b1
4 changed files with 15 additions and 43 deletions

View File

@@ -340,6 +340,13 @@ func documentMapToInitConfiguration(gvkmap kubeadmapi.DocumentMap, allowDeprecat
// If ClusterConfiguration was given, populate it in the InitConfiguration struct
if clustercfg != nil {
initcfg.ClusterConfiguration = *clustercfg
} else {
// Populate the internal InitConfiguration.ClusterConfiguration with defaults
extclustercfg := &kubeadmapiv1.ClusterConfiguration{}
kubeadmscheme.Scheme.Default(extclustercfg)
if err := kubeadmscheme.Scheme.Convert(extclustercfg, &initcfg.ClusterConfiguration, nil); err != nil {
return nil, err
}
}
// Load any component configs