diff --git a/pkg/server/container_create.go b/pkg/server/container_create.go index faac8f797..833501de0 100644 --- a/pkg/server/container_create.go +++ b/pkg/server/container_create.go @@ -28,7 +28,7 @@ import ( "github.com/davecgh/go-spew/spew" imagespec "github.com/opencontainers/image-spec/specs-go/v1" runtimespec "github.com/opencontainers/runtime-spec/specs-go" - "github.com/opencontainers/selinux/go-selinux/label" + selinux "github.com/opencontainers/selinux/go-selinux" "github.com/pkg/errors" "golang.org/x/net/context" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" @@ -163,7 +163,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta } defer func() { if retErr != nil { - _ = label.ReleaseLabel(spec.Process.SelinuxLabel) + selinux.ReleaseLabel(spec.Process.SelinuxLabel) } }() diff --git a/pkg/server/container_create_unix.go b/pkg/server/container_create_unix.go index 239d91872..d5f0bc955 100644 --- a/pkg/server/container_create_unix.go +++ b/pkg/server/container_create_unix.go @@ -31,6 +31,7 @@ import ( "github.com/containerd/containerd/oci" imagespec "github.com/opencontainers/image-spec/specs-go/v1" runtimespec "github.com/opencontainers/runtime-spec/specs-go" + selinux "github.com/opencontainers/selinux/go-selinux" "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" @@ -159,7 +160,7 @@ func (c *criService) containerSpec(id string, sandboxID string, sandboxPid uint3 if len(labelOptions) == 0 { // Use pod level SELinux config if sandbox, err := c.sandboxStore.Get(sandboxID); err == nil { - labelOptions, err = label.DupSecOpt(sandbox.ProcessLabel) + labelOptions, err = selinux.DupSecOpt(sandbox.ProcessLabel) if err != nil { return nil, err } diff --git a/pkg/server/sandbox_run.go b/pkg/server/sandbox_run.go index 43c44f754..dd4c51e36 100644 --- a/pkg/server/sandbox_run.go +++ b/pkg/server/sandbox_run.go @@ -29,7 +29,6 @@ import ( cni "github.com/containerd/go-cni" "github.com/containerd/typeurl" "github.com/davecgh/go-spew/spew" - "github.com/opencontainers/selinux/go-selinux/label" "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/net/context" @@ -43,6 +42,7 @@ import ( "github.com/containerd/cri/pkg/netns" sandboxstore "github.com/containerd/cri/pkg/store/sandbox" "github.com/containerd/cri/pkg/util" + selinux "github.com/opencontainers/selinux/go-selinux" ) func init() { @@ -161,7 +161,7 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox sandbox.ProcessLabel = spec.Process.SelinuxLabel defer func() { if retErr != nil { - _ = label.ReleaseLabel(sandbox.ProcessLabel) + selinux.ReleaseLabel(sandbox.ProcessLabel) } }() diff --git a/pkg/server/sandbox_run_unix.go b/pkg/server/sandbox_run_unix.go index a86dd2197..8391872c4 100644 --- a/pkg/server/sandbox_run_unix.go +++ b/pkg/server/sandbox_run_unix.go @@ -28,7 +28,7 @@ import ( "github.com/containerd/containerd/plugin" imagespec "github.com/opencontainers/image-spec/specs-go/v1" runtimespec "github.com/opencontainers/runtime-spec/specs-go" - "github.com/opencontainers/selinux/go-selinux/label" + selinux "github.com/opencontainers/selinux/go-selinux" "github.com/pkg/errors" "golang.org/x/sys/unix" runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2" @@ -124,7 +124,7 @@ func (c *criService) sandboxContainerSpec(id string, config *runtime.PodSandboxC } defer func() { if retErr != nil { - _ = label.ReleaseLabel(processLabel) + selinux.ReleaseLabel(processLabel) } }()