func (p *pod) GetResmgrLabelKeys() []string {
	return keysInNamespace(p.Labels, kubernetes.ResmgrKeyNamespace)
}
Get all label keys in the cri-resource-manager namespace.
package cache
import (
	"encoding/json"
	"strconv"
	"strings"
	v1 "k8s.io/api/core/v1"
	cri "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
	"github.com/intel/cri-resource-manager/pkg/apis/resmgr"
	"github.com/intel/cri-resource-manager/pkg/cgroups"
	"github.com/intel/cri-resource-manager/pkg/cri/resource-manager/kubernetes"
)
const (
	KeyResourceAnnotation = "intel.com/resources"
)
func (p *pod) fromRunRequest(req *cri.RunPodSandboxRequest) error {
	cfg := req.Config
	if cfg == nil {
		return cacheError("pod %s has no config", p.ID)
	}
	meta := cfg.Metadata
	if meta == nil {
		return cacheError("pod %s has no request metadata", p.ID)
	}
	p.containers = make(map[string]string)
	p.UID = meta.Uid
	p.Name = meta.Name
	p.Namespace = meta.Namespace
	p.State = PodState(int32(PodStateReady))
	p.Labels = cfg.Labels
	p.Annotations = cfg.Annotations
	p.CgroupParent = cfg.GetLinux().GetCgroupParent()
	if err := p.discoverQOSClass(); err != nil {
		p.cache.Error("%v", err)
	}
	p.parseResourceAnnotations()
	return nil
}
func (p *pod) fromListResponse(pod *cri.PodSandbox, status *PodStatus) error {
	meta := pod.Metadata
	if meta == nil {
		return cacheError("pod %s has no reply metadata", p.ID)
	}
	p.containers = make(map[string]string)
	p.UID = meta.Uid
	p.Name = meta.Name
	p.Namespace = meta.Namespace
	p.State = PodState(int32(pod.State))
	p.Labels = pod.Labels
	p.Annotations = pod.Annotations
	p.CgroupParent = status.CgroupParent
	if err := p.discoverQOSClass(); err != nil {
		p.cache.Error("%v", err)
	}
	p.parseResourceAnnotations()
	return nil
}
func (p *pod) GetInitContainers() []Container {
	if p.Resources == nil {
		return nil
	}
	containers := []Container{}
	for id, c := range p.cache.Containers {
		if id != c.CacheID {
			continue
		}
		if _, ok := p.Resources.InitContainers[c.ID]; ok {
			containers = append(containers, c)
		}
	}
	return containers
}
func (p *pod) GetContainers() []Container {
	containers := []Container{}
	for id, c := range p.cache.Containers {
		if c.PodID != p.ID || id != c.CacheID {
			continue
		}
		if p.Resources != nil {
			if _, ok := p.Resources.InitContainers[c.ID]; ok {
				continue
			}
		}
		containers = append(containers, c)
	}
	return containers
}
func (p *pod) getContainer(name string) *container {
	var found *container
	if id, ok := p.containers[name]; ok {
		return p.cache.Containers[id]
	}
	for _, c := range p.GetContainers() {
		cptr := c.(*container)
		p.containers[cptr.Name] = cptr.ID
		if cptr.Name == name {
			found = cptr
		}
	}
	return found
}
func (p *pod) GetContainer(name string) (Container, bool) {
	c := p.getContainer(name)
	return c, c != nil
}
func (p *pod) GetID() string {
	return p.ID
}
func (p *pod) GetUID() string {
	return p.UID
}
func (p *pod) GetName() string {
	return p.Name
}
func (p *pod) GetNamespace() string {
	return p.Namespace
}
func (p *pod) GetState() PodState {
	return p.State
}
func (p *pod) GetLabelKeys() []string {
	keys := make([]string, len(p.Labels))
	idx := 0
	for key := range p.Labels {
		keys[idx] = key
		idx++
	}
	return keys
}
func (p *pod) GetLabel(key string) (string, bool) {
	value, ok := p.Labels[key]
	return value, ok
}