mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
kubelet: Add validation for EnableNodeLogQuery
This commit is contained in:
parent
aadad09410
commit
26279a5282
@ -262,5 +262,13 @@ func ValidateKubeletConfiguration(kc *kubeletconfig.KubeletConfiguration, featur
|
|||||||
allErrors = append(allErrors, fmt.Errorf("invalid configuration: the containerRuntimeEndpoint was not specified or empty"))
|
allErrors = append(allErrors, fmt.Errorf("invalid configuration: the containerRuntimeEndpoint was not specified or empty"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if kc.EnableSystemLogQuery && !localFeatureGate.Enabled(features.NodeLogQuery) {
|
||||||
|
allErrors = append(allErrors, fmt.Errorf("invalid configuration: NodeLogQuery feature gate is required for enableSystemLogHandler"))
|
||||||
|
}
|
||||||
|
if kc.EnableSystemLogQuery && !kc.EnableSystemLogHandler {
|
||||||
|
allErrors = append(allErrors,
|
||||||
|
fmt.Errorf("invalid configuration: enableSystemLogHandler is required for enableSystemLogQuery"))
|
||||||
|
}
|
||||||
|
|
||||||
return utilerrors.NewAggregate(allErrors)
|
return utilerrors.NewAggregate(allErrors)
|
||||||
}
|
}
|
||||||
|
@ -563,6 +563,24 @@ func TestValidateKubeletConfiguration(t *testing.T) {
|
|||||||
},
|
},
|
||||||
errMsg: "invalid configuration: Specifying shutdownGracePeriodByPodPriority requires feature gate GracefulNodeShutdownBasedOnPodPriority",
|
errMsg: "invalid configuration: Specifying shutdownGracePeriodByPodPriority requires feature gate GracefulNodeShutdownBasedOnPodPriority",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "enableSystemLogQuery is enabled without NodeLogQuery feature gate",
|
||||||
|
configure: func(conf *kubeletconfig.KubeletConfiguration) *kubeletconfig.KubeletConfiguration {
|
||||||
|
conf.EnableSystemLogQuery = true
|
||||||
|
return conf
|
||||||
|
},
|
||||||
|
errMsg: "invalid configuration: NodeLogQuery feature gate is required for enableSystemLogHandler",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "enableSystemLogQuery is enabled without enableSystemLogHandler",
|
||||||
|
configure: func(conf *kubeletconfig.KubeletConfiguration) *kubeletconfig.KubeletConfiguration {
|
||||||
|
conf.FeatureGates = map[string]bool{"NodeLogQuery": true}
|
||||||
|
conf.EnableSystemLogHandler = false
|
||||||
|
conf.EnableSystemLogQuery = true
|
||||||
|
return conf
|
||||||
|
},
|
||||||
|
errMsg: "invalid configuration: enableSystemLogHandler is required for enableSystemLogQuery",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
|
Loading…
Reference in New Issue
Block a user