mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Merge pull request #106858 from cmssczy/add_RegisterWithTaints_validation_test
add kubelet config validation test for RegisterWithTaints
This commit is contained in:
commit
08c31088c1
@ -133,7 +133,7 @@ func ValidateKubeletConfiguration(kc *kubeletconfig.KubeletConfiguration) error
|
|||||||
allErrors = append(allErrors, fmt.Errorf("invalid taint: %v", nodeTaint))
|
allErrors = append(allErrors, fmt.Errorf("invalid taint: %v", nodeTaint))
|
||||||
}
|
}
|
||||||
if nodeTaint.TimeAdded != nil {
|
if nodeTaint.TimeAdded != nil {
|
||||||
allErrors = append(allErrors, fmt.Errorf("taint TimeAdded is not nil"))
|
allErrors = append(allErrors, fmt.Errorf("invalid configuration: taint.TimeAdded is not nil"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
componentbaseconfig "k8s.io/component-base/config"
|
componentbaseconfig "k8s.io/component-base/config"
|
||||||
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
|
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
|
||||||
@ -483,6 +484,15 @@ func TestValidateKubeletConfiguration(t *testing.T) {
|
|||||||
},
|
},
|
||||||
errMsg: "invalid configuration: memoryThrottlingFactor 1.1 must be greater than 0 and less than or equal to 1.0",
|
errMsg: "invalid configuration: memoryThrottlingFactor 1.1 must be greater than 0 and less than or equal to 1.0",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "invalid Taint.TimeAdded",
|
||||||
|
configure: func(conf *kubeletconfig.KubeletConfiguration) *kubeletconfig.KubeletConfiguration {
|
||||||
|
now := metav1.Now()
|
||||||
|
conf.RegisterWithTaints = []v1.Taint{{TimeAdded: &now}}
|
||||||
|
return conf
|
||||||
|
},
|
||||||
|
errMsg: "invalid configuration: taint.TimeAdded is not nil",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
|
Loading…
Reference in New Issue
Block a user