Skip to content

Commit a2dc682

Browse files
committed
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 <[email protected]> (cherry picked from commit dac2543)
1 parent 8098a6e commit a2dc682

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

pkg/cri/server/sandbox_run.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ func toCNILabels(id string, config *runtime.PodSandboxConfig) map[string]string
409409
"K8S_POD_NAMESPACE": config.GetMetadata().GetNamespace(),
410410
"K8S_POD_NAME": config.GetMetadata().GetName(),
411411
"K8S_POD_INFRA_CONTAINER_ID": id,
412+
"K8S_POD_UID": config.GetMetadata().GetUid(),
412413
"IgnoreUnknown": "1",
413414
}
414415
}

0 commit comments

Comments
 (0)