kubeadm: fix failure in e2e_kubeadm related to kubelet-config

The featureGates field in ClusterConfiguration ends up
as a map[interface{}]interface{} in the test suite
and cannot be casted to map[string]bool directly.
Adapt the test to use map[interface{}]interface{}.
This commit is contained in:
Lubomir I. Ivanov 2021-11-10 21:56:22 +02:00
parent e1571bf665
commit 7fa7f6d400

View File

@ -84,11 +84,15 @@ var _ = Describe("kubelet-config ConfigMap", func() {
// https://github.com/kubernetes/kubeadm/issues/1582
var UnversionedKubeletConfigMap bool
if _, ok := m["featureGates"]; ok {
if featureGates, ok := m["featureGates"].(map[string]bool); ok {
if featureGates, ok := m["featureGates"].(map[interface{}]interface{}); ok {
// TODO: update the default to true once this graduates to Beta.
UnversionedKubeletConfigMap = false
if val, ok := featureGates["UnversionedKubeletConfigMap"]; ok {
UnversionedKubeletConfigMap = val
if valBool, ok := val.(bool); ok {
UnversionedKubeletConfigMap = valBool
} else {
framework.Failf("unable to cast the value of feature gate UnversionedKubeletConfigMap to bool")
}
}
} else {
framework.Failf("unable to cast the featureGates field in the %s ConfigMap", kubeadmConfigName)