mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
refactor: remove docker dependency for Pid container property
This commit is contained in:
@@ -627,7 +627,7 @@ func (s *Server) CreateServiceContainer(
|
||||
Binds: spec.Container.Volumes,
|
||||
Init: spec.Container.Init,
|
||||
Mounts: mounts,
|
||||
PidMode: spec.Container.Pid,
|
||||
PidMode: container.PidMode(spec.Container.PidMode),
|
||||
PortBindings: portBindings,
|
||||
Privileged: spec.Container.Privileged,
|
||||
Resources: container.Resources{
|
||||
|
||||
+3
-4
@@ -11,7 +11,6 @@ import (
|
||||
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/distribution/reference"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
"github.com/psviderski/uncloud/internal/machine/api/pb"
|
||||
@@ -257,8 +256,8 @@ type ContainerSpec struct {
|
||||
Init *bool
|
||||
// LogDriver overrides the default logging driver for the container. Each Docker daemon can have its own default.
|
||||
LogDriver *LogDriver
|
||||
// Pid allows setting the PID name space, currently only "" or "host" is supported.
|
||||
Pid container.PidMode
|
||||
// PidMode sets the PID namespace mode for the container. Currently only "" or "host" is supported.
|
||||
PidMode string
|
||||
// Privileged gives extended privileges to the container. This is a security risk and should be used with caution.
|
||||
Privileged bool
|
||||
// PullPolicy determines when to pull the image from the registry or use the image already available in the cluster.
|
||||
@@ -266,7 +265,7 @@ type ContainerSpec struct {
|
||||
PullPolicy string
|
||||
// Resource allocation for the container.
|
||||
Resources ContainerResources
|
||||
// Namespaced kernel parameters to be set in container
|
||||
// Namespaced kernel parameters to be set in the container.
|
||||
Sysctls map[string]string
|
||||
// User overrides the default user of the image used to run the container. Format: user|UID[:group|GID].
|
||||
User string
|
||||
|
||||
@@ -206,7 +206,7 @@ func TestContainerSpec_Clone(t *testing.T) {
|
||||
original := ContainerSpec{
|
||||
CapAdd: []string{"NET_ADMIN"},
|
||||
CapDrop: []string{"ALL"},
|
||||
Pid: container.PidMode("host"),
|
||||
PidMode: "host",
|
||||
Command: []string{"sh", "-c", "echo hello"},
|
||||
Entrypoint: []string{"/bin/bash"},
|
||||
Env: EnvVars{
|
||||
|
||||
@@ -53,7 +53,7 @@ func ServiceSpecFromCompose(project *types.Project, serviceName string) (api.Ser
|
||||
Healthcheck: healthcheckFromCompose(service.HealthCheck),
|
||||
Image: service.Image,
|
||||
Init: service.Init,
|
||||
Pid: container.PidMode(service.Pid),
|
||||
PidMode: service.Pid,
|
||||
Privileged: service.Privileged,
|
||||
PullPolicy: pullPolicy,
|
||||
Resources: resourcesFromCompose(service),
|
||||
|
||||
@@ -127,7 +127,7 @@ func TestServiceSpecFromCompose(t *testing.T) {
|
||||
"max-file": "3",
|
||||
},
|
||||
},
|
||||
Pid: "host",
|
||||
PidMode: "host",
|
||||
Privileged: true,
|
||||
PullPolicy: api.PullPolicyAlways,
|
||||
Resources: api.ContainerResources{
|
||||
|
||||
@@ -58,7 +58,7 @@ func TestEvalContainerSpecChange_ContainerPid(t *testing.T) {
|
||||
newSpec := api.ServiceSpec{
|
||||
Container: api.ContainerSpec{
|
||||
Image: "nginx:latest",
|
||||
Pid: "host",
|
||||
PidMode: "host",
|
||||
CapAdd: []string{"NET_ADMIN"},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user