darwin: runtime support
This commit attemts to support containerd on darwin platform. With an external runtime shim, ctr run should work with, for instance, --runtime=io.containerd.runu.v1. An example of runtime and shim is managed under different repository (github.com/ukontainer/runu/). Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
This commit is contained in:
parent
5dd38792a8
commit
a43fa9f284
@ -30,8 +30,7 @@ const (
|
|||||||
// DefaultFIFODir is the default location used by client-side cio library
|
// DefaultFIFODir is the default location used by client-side cio library
|
||||||
// to store FIFOs.
|
// to store FIFOs.
|
||||||
DefaultFIFODir = "/var/run/containerd/fifo"
|
DefaultFIFODir = "/var/run/containerd/fifo"
|
||||||
// DefaultRuntime is the default Darwin runtime.
|
// DefaultRuntime would be a multiple of choices, thus empty
|
||||||
// NOTE: there is no runtime on Darwin as of now.
|
|
||||||
DefaultRuntime = ""
|
DefaultRuntime = ""
|
||||||
// DefaultConfigDir is the default location for config files.
|
// DefaultConfigDir is the default location for config files.
|
||||||
DefaultConfigDir = "/etc/containerd"
|
DefaultConfigDir = "/etc/containerd"
|
||||||
|
44
platforms/defaults_darwin.go
Normal file
44
platforms/defaults_darwin.go
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// +build darwin
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package platforms
|
||||||
|
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
|
||||||
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DefaultSpec returns the current platform's default platform specification.
|
||||||
|
func DefaultSpec() specs.Platform {
|
||||||
|
return specs.Platform{
|
||||||
|
OS: runtime.GOOS,
|
||||||
|
Architecture: runtime.GOARCH,
|
||||||
|
// The Variant field will be empty if arch != ARM.
|
||||||
|
Variant: cpuVariant(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default returns the default matcher for the platform.
|
||||||
|
func Default() MatchComparer {
|
||||||
|
return Ordered(DefaultSpec(), specs.Platform{
|
||||||
|
// darwin runtime also supports Linux binary via runu/LKL
|
||||||
|
OS: "linux",
|
||||||
|
Architecture: runtime.GOARCH,
|
||||||
|
})
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
//go:build !windows
|
//go:build !windows && !darwin
|
||||||
// +build !windows
|
// +build !windows,!darwin
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright The containerd Authors.
|
Copyright The containerd Authors.
|
||||||
|
35
services/tasks/local_darwin.go
Normal file
35
services/tasks/local_darwin.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// +build darwin
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright The containerd Authors.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tasks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/containerd/containerd/plugin"
|
||||||
|
"github.com/containerd/containerd/runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
var tasksServiceRequires = []plugin.Type{
|
||||||
|
plugin.RuntimePluginV2,
|
||||||
|
plugin.MetadataPlugin,
|
||||||
|
plugin.TaskMonitorPlugin,
|
||||||
|
}
|
||||||
|
|
||||||
|
// loadV1Runtimes on darwin returns an empty map. There are no v1 runtimes
|
||||||
|
func loadV1Runtimes(ic *plugin.InitContext) (map[string]runtime.PlatformRuntime, error) {
|
||||||
|
return make(map[string]runtime.PlatformRuntime), nil
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
//go:build !windows && !freebsd
|
//go:build !windows && !freebsd && !darwin
|
||||||
// +build !windows,!freebsd
|
// +build !windows,!freebsd,!darwin
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright The containerd Authors.
|
Copyright The containerd Authors.
|
||||||
|
Loading…
Reference in New Issue
Block a user