forked from github/multus-cni
Caches all pod delegates json for pods deletion without k8s info
This fixes #243 with following changes: + Optimize to fetch Pod from k8s client + Change to use cache always in DEL. + If failed to fetch the pod info from k8s clinet in deletion, use cached delegates as emergency bailout + Add test cases for cache fixed conflicts in multus/multus.go & multus/multus_test.go
This commit is contained in:
committed by
dougbtv
parent
363b7fbc06
commit
57f1d7afc7
@@ -103,6 +103,11 @@ func (f *FakeKubeClient) AddPod(pod *v1.Pod) {
|
||||
f.pods[key] = pod
|
||||
}
|
||||
|
||||
func (f *FakeKubeClient) DeletePod(pod *v1.Pod) {
|
||||
key := fmt.Sprintf("%s/%s", pod.ObjectMeta.Namespace, pod.ObjectMeta.Name)
|
||||
delete(f.pods, key)
|
||||
}
|
||||
|
||||
func NewFakePod(name string, netAnnotation string, defaultNetAnnotation string) *v1.Pod {
|
||||
pod := &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
|
Reference in New Issue
Block a user