mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-12 13:31:52 +00:00
kubeadm: skip CRI detection for 'kubeadm config validate'
This commit is contained in:
parent
3da7802b7c
commit
259dd93e71
@ -332,21 +332,21 @@ func ValidateConfig(config []byte, allowExperimental bool) error {
|
||||
|
||||
// Validate InitConfiguration and ClusterConfiguration if there are any in the config
|
||||
if kubeadmutil.GroupVersionKindsHasInitConfiguration(gvks...) || kubeadmutil.GroupVersionKindsHasClusterConfiguration(gvks...) {
|
||||
if _, err := documentMapToInitConfiguration(gvkmap, true, allowExperimental, true, false); err != nil {
|
||||
if _, err := documentMapToInitConfiguration(gvkmap, true, allowExperimental, true, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Validate JoinConfiguration if there is any
|
||||
if kubeadmutil.GroupVersionKindsHasJoinConfiguration(gvks...) {
|
||||
if _, err := documentMapToJoinConfiguration(gvkmap, true, allowExperimental, true, false); err != nil {
|
||||
if _, err := documentMapToJoinConfiguration(gvkmap, true, allowExperimental, true, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Validate ResetConfiguration if there is any
|
||||
if kubeadmutil.GroupVersionKindsHasResetConfiguration(gvks...) {
|
||||
if _, err := documentMapToResetConfiguration(gvkmap, true, allowExperimental, true, false); err != nil {
|
||||
if _, err := documentMapToResetConfiguration(gvkmap, true, allowExperimental, true, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -510,30 +510,24 @@ func TestValidateConfig(t *testing.T) {
|
||||
cfg: dedent.Dedent(fmt.Sprintf(`
|
||||
apiVersion: %s
|
||||
kind: InitConfiguration
|
||||
nodeRegistration:
|
||||
criSocket: %s
|
||||
name: foo bar # not a valid subdomain
|
||||
`, gv, constants.UnknownCRISocket)),
|
||||
`, gv)),
|
||||
expectedError: true,
|
||||
},
|
||||
{
|
||||
name: "unknown API GVK",
|
||||
cfg: dedent.Dedent(fmt.Sprintf(`
|
||||
cfg: dedent.Dedent(`
|
||||
apiVersion: foo/bar # not a valid GroupVersion
|
||||
kind: zzz # not a valid Kind
|
||||
nodeRegistration:
|
||||
criSocket: %s
|
||||
`, constants.UnknownCRISocket)),
|
||||
`),
|
||||
expectedError: true,
|
||||
},
|
||||
{
|
||||
name: "legacy API GVK",
|
||||
cfg: dedent.Dedent(fmt.Sprintf(`
|
||||
cfg: dedent.Dedent(`
|
||||
apiVersion: kubeadm.k8s.io/v1beta1 # legacy API
|
||||
kind: InitConfiguration
|
||||
nodeRegistration:
|
||||
criSocket: %s
|
||||
`, constants.UnknownCRISocket)),
|
||||
`),
|
||||
expectedError: true,
|
||||
},
|
||||
{
|
||||
@ -542,9 +536,7 @@ func TestValidateConfig(t *testing.T) {
|
||||
apiVersion: %s
|
||||
kind: InitConfiguration
|
||||
foo: bar
|
||||
nodeRegistration:
|
||||
criSocket: %s
|
||||
`, gv, constants.UnknownCRISocket)),
|
||||
`, gv)),
|
||||
expectedError: true,
|
||||
},
|
||||
{
|
||||
@ -552,9 +544,7 @@ func TestValidateConfig(t *testing.T) {
|
||||
cfg: dedent.Dedent(fmt.Sprintf(`
|
||||
apiVersion: %s
|
||||
kind: InitConfiguration
|
||||
nodeRegistration:
|
||||
criSocket: %s
|
||||
`, gv, constants.UnknownCRISocket)),
|
||||
`, gv)),
|
||||
expectedError: false,
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user