Add a platform.ParseAll helper
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
This commit is contained in:
@@ -39,7 +39,6 @@ import (
|
||||
"github.com/containerd/containerd/runtime"
|
||||
shimbinary "github.com/containerd/containerd/runtime/v2/shim"
|
||||
"github.com/containerd/containerd/sandbox"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
// Config for the v2 runtime
|
||||
@@ -63,7 +62,7 @@ func init() {
|
||||
},
|
||||
InitFn: func(ic *plugin.InitContext) (interface{}, error) {
|
||||
config := ic.Config.(*Config)
|
||||
supportedPlatforms, err := parsePlatforms(config.Platforms)
|
||||
supportedPlatforms, err := platforms.ParseAll(config.Platforms)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -387,18 +386,6 @@ func (m *ShimManager) Delete(ctx context.Context, id string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func parsePlatforms(platformStr []string) ([]ocispec.Platform, error) {
|
||||
p := make([]ocispec.Platform, len(platformStr))
|
||||
for i, v := range platformStr {
|
||||
parsed, err := platforms.Parse(v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
p[i] = parsed
|
||||
}
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// TaskManager wraps task service client on top of shim manager.
|
||||
type TaskManager struct {
|
||||
manager *ShimManager
|
||||
|
||||
Reference in New Issue
Block a user