sandbox: send pod UID to CNI plugins as K8S_POD_UID
CNI plugins that need to wait for network state to converge may want to cancel waiting when a short lived pod is deleted. However, there is a race between when kubelet asks the runtime to create the sandbox for the pod, and when the plugin is able request the pod object from the apiserver. It may be the case that the plugin receives the new pod, rather than the pod the sandbox request was initiated for. Passing the pod UID to the plugin allows the plugin to check whether the pod it gets from the apiserver is actually the pod its sandbox request was started for. Signed-off-by: Dan Williams <dcbw@redhat.com>
This commit is contained in:
parent
0396089f79
commit
dac2543a07
@ -409,6 +409,7 @@ func toCNILabels(id string, config *runtime.PodSandboxConfig) map[string]string
|
||||
"K8S_POD_NAMESPACE": config.GetMetadata().GetNamespace(),
|
||||
"K8S_POD_NAME": config.GetMetadata().GetName(),
|
||||
"K8S_POD_INFRA_CONTAINER_ID": id,
|
||||
"K8S_POD_UID": config.GetMetadata().GetUid(),
|
||||
"IgnoreUnknown": "1",
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user