From 4a776f66ec44acf59b76b5aade7f3469dbd5f185 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Wed, 13 Mar 2024 15:57:04 +0900 Subject: [PATCH] kubelet: silence "unknown runtime class" errors when unsupported Signed-off-by: Akihiro Suda --- pkg/kubelet/kubelet_pods.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/kubelet/kubelet_pods.go b/pkg/kubelet/kubelet_pods.go index b8804b9b3cb..8f520a8fd3f 100644 --- a/pkg/kubelet/kubelet_pods.go +++ b/pkg/kubelet/kubelet_pods.go @@ -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