From e874e2597ee0ecaf80e5a0df2d5d65e83f7a2e33 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 9 Feb 2021 13:24:01 -0500 Subject: [PATCH] [cri] add pod annotations to CNI call Signed-off-by: Michael Crosby --- pkg/cri/annotations/annotations.go | 4 ++++ pkg/cri/server/sandbox_run.go | 1 + 2 files changed, 5 insertions(+) diff --git a/pkg/cri/annotations/annotations.go b/pkg/cri/annotations/annotations.go index b69f136a8..68a0f4837 100644 --- a/pkg/cri/annotations/annotations.go +++ b/pkg/cri/annotations/annotations.go @@ -53,6 +53,10 @@ const ( // ContainerName is the name of the container in the pod ContainerName = "io.kubernetes.cri.container-name" + // ImageName is the name of the image used to create the container ImageName = "io.kubernetes.cri.image-name" + + // PodAnnotations are the annotations of the pod + PodAnnotations = "io.kubernetes.cri.pod-annotations" ) diff --git a/pkg/cri/server/sandbox_run.go b/pkg/cri/server/sandbox_run.go index 39ded4966..0ae6466ac 100644 --- a/pkg/cri/server/sandbox_run.go +++ b/pkg/cri/server/sandbox_run.go @@ -370,6 +370,7 @@ func (c *criService) setupPodNetwork(ctx context.Context, sandbox *sandboxstore. func cniNamespaceOpts(id string, config *runtime.PodSandboxConfig) ([]cni.NamespaceOpts, error) { opts := []cni.NamespaceOpts{ cni.WithLabels(toCNILabels(id, config)), + cni.WithCapability(annotations.PodAnnotations, config.Annotations), } portMappings := toCNIPortMappings(config.GetPortMappings())