remove uses of platforms.Platform alias

Commit 3c8469a782 removed uses of the api
types.Platform type from public interfaces, instead using the type from
the OCI image spec.

For convenience, it also introduced an alias in the platforms package.
While this alias allows packages that already import containerd's
platforms package (now a separate module), it may also cause confusion
(it's not clear that it's an alias for the OCI type), and for packages
that do not depend on containerd's platforms package / module may now
be resulting in an extra dependency.

Let's remove the use of this alias, and instead use the OCI type directly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-05-28 14:56:30 +02:00
parent 45e30913bc
commit 446e63579c
10 changed files with 32 additions and 29 deletions

View File

@@ -241,7 +241,7 @@ func TestVolumeMounts(t *testing.T) {
for _, test := range []struct {
desc string
platform platforms.Platform
platform imagespec.Platform
criMounts []*runtime.Mount
usernsEnabled bool
imageVolumes map[string]struct{}
@@ -293,7 +293,7 @@ func TestVolumeMounts(t *testing.T) {
},
{
desc: "should make relative paths absolute on Linux",
platform: platforms.Platform{OS: "linux"},
platform: imagespec.Platform{OS: "linux"},
imageVolumes: map[string]struct{}{
"./test-volume-1": {},
"C:/test-volume-2": {},
@@ -309,7 +309,7 @@ func TestVolumeMounts(t *testing.T) {
},
{
desc: "should include mappings for image volumes on Linux",
platform: platforms.Platform{OS: "linux"},
platform: imagespec.Platform{OS: "linux"},
usernsEnabled: true,
imageVolumes: map[string]struct{}{
"/test-volume-1/": {},
@@ -323,7 +323,7 @@ func TestVolumeMounts(t *testing.T) {
},
{
desc: "should NOT include mappings for image volumes on Linux if !userns",
platform: platforms.Platform{OS: "linux"},
platform: imagespec.Platform{OS: "linux"},
usernsEnabled: false,
imageVolumes: map[string]struct{}{
"/test-volume-1/": {},
@@ -336,7 +336,7 @@ func TestVolumeMounts(t *testing.T) {
},
{
desc: "should convert rel imageVolume paths to abs paths and add userns mappings",
platform: platforms.Platform{OS: "linux"},
platform: imagespec.Platform{OS: "linux"},
usernsEnabled: true,
imageVolumes: map[string]struct{}{
"test-volume-1/": {},