kata-monitor: minor fixes

fix comment and use literals

Signed-off-by: Francesco Giudici <fgiudici@redhat.com>
This commit is contained in:
Francesco Giudici 2021-08-30 15:55:28 +02:00
parent fff82b4ef5
commit 53ec4df953

View File

@ -117,8 +117,7 @@ func parseEndpoint(endpoint string) (string, string, error) {
} }
} }
// getSandboxes get kata sandbox from the container engine. // getSandboxes gets kata sandboxes from the container engine.
// this will be called only after monitor start.
func (km *KataMonitor) getSandboxes() (map[string]struct{}, error) { func (km *KataMonitor) getSandboxes() (map[string]struct{}, error) {
sandboxMap := make(map[string]struct{}) sandboxMap := make(map[string]struct{})
@ -166,7 +165,11 @@ func (km *KataMonitor) getSandboxes() (map[string]struct{}, error) {
// get low level container runtime // get low level container runtime
// containerd stores the pod runtime in "/runtimeType" while CRI-O stores it the // containerd stores the pod runtime in "/runtimeType" while CRI-O stores it the
// io.kubernetes.cri-o.RuntimeHandler annotation: check for both. // io.kubernetes.cri-o.RuntimeHandler annotation: check for both.
keys := []string{"/runtimeType", "/runtimeSpec/annotations/io.kubernetes.cri-o.RuntimeHandler"} const (
containerdRuntimeMarker = "/runtimeType"
crioRuntimeMarker = "/runtimeSpec/annotations/io.kubernetes.cri-o.RuntimeHandler"
)
keys := []string{containerdRuntimeMarker, crioRuntimeMarker}
for _, key := range keys { for _, key := range keys {
pointer, _ := gojsonpointer.NewJsonPointer(key) pointer, _ := gojsonpointer.NewJsonPointer(key)
rt, _, _ := pointer.Get(res) rt, _, _ := pointer.Get(res)