refactor labels used in cri server
remove the duplication of labels used in cri/server and move them to a common package cri/labels Signed-off-by: Akhil Mohan <makhil@vmware.com>
This commit is contained in:
@@ -40,6 +40,7 @@ import (
|
||||
"github.com/containerd/containerd/v2/pkg/cri/annotations"
|
||||
criconfig "github.com/containerd/containerd/v2/pkg/cri/config"
|
||||
cio "github.com/containerd/containerd/v2/pkg/cri/io"
|
||||
crilabels "github.com/containerd/containerd/v2/pkg/cri/labels"
|
||||
customopts "github.com/containerd/containerd/v2/pkg/cri/opts"
|
||||
containerstore "github.com/containerd/containerd/v2/pkg/cri/store/container"
|
||||
"github.com/containerd/containerd/v2/pkg/cri/util"
|
||||
@@ -260,7 +261,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
|
||||
return nil, fmt.Errorf("failed to get container spec opts: %w", err)
|
||||
}
|
||||
|
||||
containerLabels := buildLabels(config.Labels, image.ImageSpec.Config.Labels, containerKindContainer)
|
||||
containerLabels := buildLabels(config.Labels, image.ImageSpec.Config.Labels, crilabels.ContainerKindContainer)
|
||||
|
||||
sandboxInfo, err := c.client.SandboxStore().Get(ctx, sandboxID)
|
||||
if err != nil {
|
||||
@@ -271,7 +272,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
|
||||
containerd.WithSpec(spec, specOpts...),
|
||||
containerd.WithRuntime(sandboxInfo.Runtime.Name, sandboxInfo.Runtime.Options),
|
||||
containerd.WithContainerLabels(containerLabels),
|
||||
containerd.WithContainerExtension(containerMetadataExtension, &meta),
|
||||
containerd.WithContainerExtension(crilabels.ContainerMetadataExtension, &meta),
|
||||
)
|
||||
|
||||
opts = append(opts, containerd.WithSandbox(sandboxID))
|
||||
|
||||
Reference in New Issue
Block a user