kubelet: silence "unknown runtime class" errors when unsupported

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2024-03-13 15:57:04 +09:00
parent 6680700b5d
commit 4a776f66ec
No known key found for this signature in database
GPG Key ID: 49524C6F9F638F1A

View File

@ -2456,6 +2456,11 @@ func (kl *Kubelet) runtimeClassSupportsRecursiveReadOnlyMounts(pod *v1.Pod) bool
// runtimeClassSupportsRecursiveReadOnlyMounts checks whether the runtime class supports recursive read-only mounts.
// The kubelet feature gate is not checked here.
func runtimeClassSupportsRecursiveReadOnlyMounts(runtimeClassName string, runtimeHandlers []kubecontainer.RuntimeHandler) bool {
if len(runtimeHandlers) == 0 {
// The runtime does not support returning the handler list.
// No need to print a warning here.
return false
}
for _, h := range runtimeHandlers {
if h.Name == runtimeClassName {
return h.SupportsRecursiveReadOnlyMounts