Skip to content

Commit

Permalink
Revert "Add capabilities list to container specification"
Browse files Browse the repository at this point in the history
This reverts commit 18d9170.

This is reverted to replace with a different model since a full cap list
specified on clients means the client must specify the base cap spec for
nodes it may not know about.

Instead we intend to split this into add/drop lists.
  • Loading branch information
cpuguy83 committed Jul 16, 2020
1 parent 967c829 commit 8c7b14d
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 317 deletions.
1 change: 0 additions & 1 deletion agent/exec/dockerapi/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 209,6 @@ func (c *containerConfig) hostConfig() *enginecontainer.HostConfig {
PortBindings: c.portBindings(),
Init: c.init(),
Isolation: c.isolation(),
Capabilities: c.spec().Capabilities,
}

// The format of extra hosts on swarmkit is specified in:
Expand Down
20 changes: 0 additions & 20 deletions agent/exec/dockerapi/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 256,3 @@ func TestIsolation(t *testing.T) {
t.Fatalf("expected %s, got %s", expected, actual)
}
}

func TestCapabilities(t *testing.T) {
c := containerConfig{
task: &api.Task{
Spec: api.TaskSpec{
Runtime: &api.TaskSpec_Container{
Container: &api.ContainerSpec{
Capabilities: []string{"CAP_NET_RAW", "CAP_SYS_CHROOT"},
},
},
},
},
}

expected := []string{"CAP_NET_RAW", "CAP_SYS_CHROOT"}
actual := c.hostConfig().Capabilities
if !reflect.DeepEqual(actual, expected) {
t.Fatalf("expected %s, got %s", expected, actual)
}
}
7 changes: 0 additions & 7 deletions api/api.pb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5067,13 5067,6 @@ file {
type_name: ".docker.swarmkit.v1.ContainerSpec.SysctlsEntry"
json_name: "sysctls"
}
field {
name: "capabilities"
number: 27
label: LABEL_REPEATED
type: TYPE_STRING
json_name: "capabilities"
}
nested_type {
name: "LabelsEntry"
field {
Expand Down
346 changes: 141 additions & 205 deletions api/specs.pb.go

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions api/specs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 355,6 @@ message ContainerSpec {
//
// https://docs.docker.com/engine/reference/commandline/run/#configure-namespaced-kernel-parameters-sysctls-at-runtime
map<string, string> sysctls = 26;

// Capabilities is the list of Linux capabilities to be available for container (this overrides the default set of capabilities)
repeated string capabilities = 27;
}

// EndpointSpec defines the properties that can be configured to
Expand Down
72 changes: 0 additions & 72 deletions cmd/swarmctl/service/flagparser/capability.go

This file was deleted.

9 changes: 0 additions & 9 deletions cmd/swarmctl/service/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 54,6 @@ var (
return err
}

if err := flagparser.ParseAddCapability(cmd, spec, "add-capability"); err != nil {
return err
}
if err := flagparser.ParseRemoveCapability(cmd, spec, "rm-capability"); err != nil {
return err
}

if reflect.DeepEqual(spec, &service.Spec) {
return errors.New("no changes detected")
}
Expand All @@ -84,8 77,6 @@ func init() {
updateCmd.Flags().StringSlice("rm-secret", nil, "remove a secret from the service")
updateCmd.Flags().StringSlice("add-config", nil, "add a new config to the service")
updateCmd.Flags().StringSlice("rm-config", nil, "remove a config from the service")
updateCmd.Flags().StringSlice("add-capability", nil, "add a new capability to the service")
updateCmd.Flags().StringSlice("rm-capability", nil, "remove a capability from the service")
updateCmd.Flags().Bool("force", false, "force tasks to restart even if nothing has changed")
flagparser.AddServiceFlags(updateCmd.Flags())
}

0 comments on commit 8c7b14d

Please sign in to comment.