Enable image config labels in ctr and CRI container creation

Signed-off-by: Phil Estes <estesp@amazon.com>
This commit is contained in:
Phil Estes
2021-09-09 13:17:42 -04:00
parent d081457ba4
commit f40df3d72b
8 changed files with 78 additions and 10 deletions

View File

@@ -249,3 +249,16 @@ func fullID(ctx context.Context, c containerd.Container) string {
}
return fmt.Sprintf("%s-%s", ns, id)
}
// buildLabel builds the labels from command line labels and the image labels
func buildLabels(cmdLabels, imageLabels map[string]string) map[string]string {
labels := make(map[string]string)
for k, v := range imageLabels {
labels[k] = v
}
// labels from the command line will override image and the initial image config labels
for k, v := range cmdLabels {
labels[k] = v
}
return labels
}