func (k *K8sDataStore) RetrieveAllPods() []*telemetrymodel.Pod {
	k.lock.Lock()
	defer k.lock.Unlock()
	var str []string
	for k := range k.podMap {
		str = append(str, k)
	}
	var nList []*telemetrymodel.Pod
	sort.Strings(str)
	for _, v := range str {
		p, _ := k.retrievePod(v)
		nList = append(nList, p)
	}
	return nList
}
RetrieveAllPods returns a list of all pods in the data store.
package datastore
import (
	"github.com/contiv/vpp/plugins/crd/cache/telemetrymodel"
	"github.com/contiv/vpp/plugins/ksr/model/node"
	pod2 "github.com/contiv/vpp/plugins/ksr/model/pod"
	"github.com/pkg/errors"
	"sort"
	"sync"
)
type K8sDataStore struct {
	lock       *sync.Mutex
	k8sNodeMap map[string]*node.Node
	podMap     map[string]*telemetrymodel.Pod
}
func NewK8sDataStore() *K8sDataStore {
	return &K8sDataStore{
		&sync.Mutex{},
		make(map[string]*node.Node),
		make(map[string]*telemetrymodel.Pod),
	}
}
func (k *K8sDataStore) CreateK8sNode(name string, PodCIDR string, ProviderID string,
	Addresses []*node.NodeAddress, NodeInfo *node.NodeSystemInfo) error {
	k.lock.Lock()
	defer k.lock.Unlock()
	newNode := node.Node{Name: name, Pod_CIDR: PodCIDR, Provider_ID: ProviderID, Addresses: Addresses, NodeInfo: NodeInfo}
	_, ok := k.k8sNodeMap[name]
	if ok {
		return errors.Errorf("Duplicate k8s node with name %+v found", name)
	}
	k.k8sNodeMap[name] = &newNode
	return nil
}
func (k *K8sDataStore) RetrieveK8sNode(name string) (*node.Node, error) {
	k.lock.Lock()
	defer k.lock.Unlock()
	return k.retrieveK8sNode(name)
}
func (k *K8sDataStore) UpdateK8sNode(name string, PodCIDR string, ProviderID string,
	Addresses []*node.NodeAddress, NodeInfo *node.NodeSystemInfo) error {
	k.lock.Lock()
	defer k.lock.Unlock()
	k8snode, err := k.retrieveK8sNode(name)
	if err != nil {
		return errors.Errorf("Cannot find k8s node %+v in k8s cache node map", name)
	}
	k8snode.Addresses = Addresses
	k8snode.NodeInfo = NodeInfo
	k8snode.Provider_ID = ProviderID
	k8snode.Pod_CIDR = PodCIDR
	return nil
}
func (k *K8sDataStore) DeleteK8sNode(name string) error {
	k.lock.Lock()
	defer k.lock.Unlock()
	_, err := k.retrieveK8sNode(name)
	if err != nil {
		return errors.Errorf("k8s node with name %+v not found", name)
	}
	delete(k.k8sNodeMap, name)
	return nil
}
func (k *K8sDataStore) RetrieveAllK8sNodes() []*node.Node {
	k.lock.Lock()
	defer k.lock.Unlock()
	var str []string
	for k := range k.k8sNodeMap {
		str = append(str, k)
	}
	var nList []*node.Node
	sort.Strings(str)
	for _, v := range str {
		n, _ := k.retrieveK8sNode(v)
		nList = append(nList, n)
	}
	return nList
}
func (k *K8sDataStore) CreatePod(name, Namespace string, label []*pod2.Pod_Label, IPAddress,
	hostIPAddress string, container []*pod2.Pod_Container) error {
	k.lock.Lock()
	defer k.lock.Unlock()
	labels := make([]*telemetrymodel.PodLabel, 0)
	for _, l := range label {
		labels = append(labels, &telemetrymodel.PodLabel{Key: l.Key, Value: l.Value})
	}
	newPod := telemetrymodel.Pod{
		Name:          name,
		Namespace:     Namespace,
		Label:         labels,
		IPAddress:     IPAddress,
		HostIPAddress: hostIPAddress,
	}
	_, ok := k.podMap[name]
	if ok {
		return errors.Errorf("Duplicate pod with name %+v found", name)
	}
	k.podMap[name] = &newPod
	return nil
}
func (k *K8sDataStore) RetrievePod(name string) (*telemetrymodel.Pod, error) {
	k.lock.Lock()
	defer k.lock.Unlock()
	return k.retrievePod(name)
}
func (k *K8sDataStore) UpdatePod(name string, namespace string, label []*pod2.Pod_Label,
	IPAddress, hostIPAddress string, container []*pod2.Pod_Container) error {
	k.lock.Lock()
	defer k.lock.Unlock()
	pod, err := k.retrievePod(name)
	if err != nil {
		return errors.Errorf("Cannot find pod %+v in k8s cache pod map", name)
	}
	labels := make([]*telemetrymodel.PodLabel, 0)
	for _, l := range label {
		labels = append(labels, &telemetrymodel.PodLabel{Key: l.Key, Value: l.Value})
	}
	pod.Label = labels
	pod.Namespace = namespace
	pod.IPAddress = IPAddress
	pod.HostIPAddress = hostIPAddress
	return nil
}
func (k *K8sDataStore) DeletePod(name string) error {
	k.lock.Lock()
	defer k.lock.Unlock()
	_, err := k.retrievePod(name)
	if err != nil {
		return errors.Errorf("pod with name %+v not found", name)
	}
	delete(k.podMap, name)
	return nil
}