MCPcopy Index your code
hub / github.com/containerd/containerd / DefaultCRIAnnotations

Function DefaultCRIAnnotations

internal/cri/annotations/annotations.go:103–135  ·  view source on GitHub ↗

DefaultCRIAnnotations are the default set of CRI annotations to pass to sandboxes and containers.

(
	sandboxID string,
	containerName string,
	imageName string,
	config *runtime.PodSandboxConfig,
	sandbox bool,
)

Source from the content-addressed store, hash-verified

101// DefaultCRIAnnotations are the default set of CRI annotations to
102// pass to sandboxes and containers.
103func DefaultCRIAnnotations(
104 sandboxID string,
105 containerName string,
106 imageName string,
107 config *runtime.PodSandboxConfig,
108 sandbox bool,
109) []oci.SpecOpts {
110 opts := []oci.SpecOpts{
111 customopts.WithAnnotation(SandboxID, sandboxID),
112 customopts.WithAnnotation(SandboxNamespace, config.GetMetadata().GetNamespace()),
113 customopts.WithAnnotation(SandboxUID, config.GetMetadata().GetUid()),
114 customopts.WithAnnotation(SandboxName, config.GetMetadata().GetName()),
115 }
116 ctrType := ContainerTypeContainer
117 if sandbox {
118 ctrType = ContainerTypeSandbox
119 // Sandbox log dir and sandbox image name get passed for sandboxes, the other metadata always
120 // gets sent however.
121 opts = append(
122 opts,
123 customopts.WithAnnotation(SandboxLogDir, config.GetLogDirectory()),
124 customopts.WithAnnotation(SandboxImageName, imageName),
125 )
126 } else {
127 // Image name and container name get passed for containers.
128 opts = append(
129 opts,
130 customopts.WithAnnotation(ContainerName, containerName),
131 customopts.WithAnnotation(ImageName, imageName),
132 )
133 }
134 return append(opts, customopts.WithAnnotation(ContainerType, ctrType))
135}

Callers 6

buildLinuxSpecMethod · 0.92
buildWindowsSpecMethod · 0.92
buildDarwinSpecMethod · 0.92
sandboxContainerSpecMethod · 0.92
sandboxContainerSpecMethod · 0.92
sandboxContainerSpecMethod · 0.92

Calls 3

GetMetadataMethod · 0.80
GetNamespaceMethod · 0.65
GetNameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…