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, )
| 101 | // DefaultCRIAnnotations are the default set of CRI annotations to |
| 102 | // pass to sandboxes and containers. |
| 103 | func 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 | } |
no test coverage detected
searching dependent graphs…