mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 18:24:07 +00:00
add kubelet validation for containerLogMaxFiles
This commit is contained in:
parent
810e9e212e
commit
a0b74011b2
@ -342,6 +342,10 @@ func ValidateKubeletConfiguration(kc *kubeletconfig.KubeletConfiguration, featur
|
||||
allErrors = append(allErrors, fmt.Errorf("invalid configuration: containerLogMonitorInterval must be a positive time duration greater than or equal to 3s"))
|
||||
}
|
||||
|
||||
if kc.ContainerLogMaxFiles <= 1 {
|
||||
allErrors = append(allErrors, fmt.Errorf("invalid configuration: containerLogMaxFiles must be greater than 1"))
|
||||
}
|
||||
|
||||
if kc.PodLogsDir == "" {
|
||||
allErrors = append(allErrors, fmt.Errorf("invalid configuration: podLogsDir was not specified"))
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ var (
|
||||
},
|
||||
ContainerRuntimeEndpoint: "unix:///run/containerd/containerd.sock",
|
||||
ContainerLogMaxWorkers: 1,
|
||||
ContainerLogMaxFiles: 5,
|
||||
ContainerLogMonitorInterval: metav1.Duration{Duration: 10 * time.Second},
|
||||
SingleProcessOOMKill: ptr.To(!kubeletutil.IsCgroup2UnifiedMode()),
|
||||
CrashLoopBackOff: kubeletconfig.CrashLoopBackOffConfig{
|
||||
@ -700,6 +701,13 @@ func TestValidateKubeletConfiguration(t *testing.T) {
|
||||
return config
|
||||
},
|
||||
errMsg: `invalid configuration: pod logs path "/🧪" mut contains ASCII characters only`,
|
||||
}, {
|
||||
name: "invalid containerLogMaxFiles",
|
||||
configure: func(conf *kubeletconfig.KubeletConfiguration) *kubeletconfig.KubeletConfiguration {
|
||||
conf.ContainerLogMaxFiles = 1
|
||||
return conf
|
||||
},
|
||||
errMsg: "invalid configuration: containerLogMaxFiles must be greater than 1",
|
||||
}, {
|
||||
name: "invalid ContainerRuntimeEndpoint",
|
||||
configure: func(conf *kubeletconfig.KubeletConfiguration) *kubeletconfig.KubeletConfiguration {
|
||||
|
Loading…
Reference in New Issue
Block a user