kubelet: change map[string]RuntimeHandler to []RuntimeHandler

The map is changed to an array so as to retain the order of the original array
propagated from the CRI runtime.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2024-03-09 09:48:07 +09:00
parent d3d06c3c7e
commit 27f24a62e3
5 changed files with 17 additions and 16 deletions

View File

@@ -123,11 +123,12 @@ func (kl *Kubelet) HandlerSupportsUserNamespaces(rtHandler string) (bool, error)
if rtHandlers == nil {
return false, fmt.Errorf("runtime handlers are not set")
}
h, found := rtHandlers[rtHandler]
if !found {
return false, fmt.Errorf("the handler %q is not known", rtHandler)
for _, h := range rtHandlers {
if h.Name == rtHandler {
return h.SupportsUserNamespaces, nil
}
}
return h.SupportsUserNamespaces, nil
return false, fmt.Errorf("the handler %q is not known", rtHandler)
}
// GetKubeletMappings gets the additional IDs allocated for the Kubelet.