Skip to content

Commit

Permalink
docs: fixup comments, var names
Browse files Browse the repository at this point in the history
  • Loading branch information
shoenig committed Feb 8, 2021
1 parent ce4b59c commit 6dd5de4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions drivers/exec/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ type Config struct {

func (c *Config) validate() error {
switch c.DefaultModePID {
case executor.IsoModePrivate, executor.IsoModeHost:
case executor.IsolationModePrivate, executor.IsolationModeHost:
default:
return fmt.Errorf("default_pid_mode must be %q or %q, got %q", executor.IsoModePrivate, executor.IsoModeHost, c.DefaultModePID)
return fmt.Errorf("default_pid_mode must be %q or %q, got %q", executor.IsolationModePrivate, executor.IsolationModeHost, c.DefaultModePID)
}

switch c.DefaultModeIPC {
case executor.IsoModePrivate, executor.IsoModeHost:
case executor.IsolationModePrivate, executor.IsolationModeHost:
default:
return fmt.Errorf("default_ipc_mode must be %q or %q, got %q", executor.IsoModePrivate, executor.IsoModeHost, c.DefaultModeIPC)
return fmt.Errorf("default_ipc_mode must be %q or %q, got %q", executor.IsolationModePrivate, executor.IsolationModeHost, c.DefaultModeIPC)
}

return nil
Expand Down
8 changes: 4 additions & 4 deletions drivers/exec/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ func TestExecDriver_NoOrphans(t *testing.T) {

config := &Config{
NoPivotRoot: false,
DefaultModePID: executor.IsoModePrivate,
DefaultModeIPC: executor.IsoModePrivate,
DefaultModePID: executor.IsolationModePrivate,
DefaultModeIPC: executor.IsolationModePrivate,
}

var data []byte
Expand Down Expand Up @@ -735,8 +735,8 @@ func TestExecDriver_NoPivotRoot(t *testing.T) {

config := &Config{
NoPivotRoot: true,
DefaultModePID: executor.IsoModePrivate,
DefaultModeIPC: executor.IsoModePrivate,
DefaultModePID: executor.IsolationModePrivate,
DefaultModeIPC: executor.IsolationModePrivate,
}

var data []byte
Expand Down
8 changes: 4 additions & 4 deletions drivers/java/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ type Config struct {

func (c *Config) validate() error {
switch c.DefaultModePID {
case executor.IsoModePrivate, executor.IsoModeHost:
case executor.IsolationModePrivate, executor.IsolationModeHost:
default:
return fmt.Errorf("default_pid_mode must be %q or %q, got %q", executor.IsoModePrivate, executor.IsoModeHost, c.DefaultModePID)
return fmt.Errorf("default_pid_mode must be %q or %q, got %q", executor.IsolationModePrivate, executor.IsolationModeHost, c.DefaultModePID)
}

switch c.DefaultModeIPC {
case executor.IsoModePrivate, executor.IsoModeHost:
case executor.IsolationModePrivate, executor.IsolationModeHost:
default:
return fmt.Errorf("default_ipc_mode must be %q or %q, got %q", executor.IsoModePrivate, executor.IsoModeHost, c.DefaultModeIPC)
return fmt.Errorf("default_ipc_mode must be %q or %q, got %q", executor.IsolationModePrivate, executor.IsolationModeHost, c.DefaultModeIPC)
}

return nil
Expand Down
12 changes: 6 additions & 6 deletions drivers/shared/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ const (
// of 0.9.x
ExecutorVersionPre0_9 = "1.1.0"

// IsoModePrivate represents the private isolation mode for a namespace
IsoModePrivate = "private"
// IsolationModePrivate represents the private isolation mode for a namespace
IsolationModePrivate = "private"

// IsoModeHost represents the host isolation mode for a namespace
IsoModeHost = "host"
// IsolationModeHost represents the host isolation mode for a namespace
IsolationModeHost = "host"
)

var (
Expand Down Expand Up @@ -141,10 +141,10 @@ type ExecCommand struct {
// NetworkIsolation is the network isolation configuration.
NetworkIsolation *drivers.NetworkIsolationSpec

// DefaultModePID is the default PID isolation mode (private or host).
// DefaultModePID is the default PID isolation mode
DefaultModePID string

// DefaultModeIPC is the default IPC isolation mode (private or host).
// DefaultModeIPC is the default IPC isolation mode
DefaultModeIPC string
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/shared/executor/executor_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,10 @@ func supportedCaps() []string {

func configureNamespaces(pidMode, ipcMode string) lconfigs.Namespaces {
namespaces := lconfigs.Namespaces{{Type: lconfigs.NEWNS}}
if pidMode == IsoModePrivate {
if pidMode == IsolationModePrivate {
namespaces = append(namespaces, lconfigs.Namespace{Type: lconfigs.NEWPID})
}
if ipcMode == IsoModePrivate {
if ipcMode == IsolationModePrivate {
namespaces = append(namespaces, lconfigs.Namespace{Type: lconfigs.NEWIPC})
}
return namespaces
Expand All @@ -589,7 +589,7 @@ func configureIsolation(cfg *lconfigs.Config, command *ExecCommand) error {
// disable pivot_root if set in the driver's configuration
cfg.NoPivotRoot = command.NoPivotRoot

// setup default namespaces as configured
// set up default namespaces as configured
cfg.Namespaces = configureNamespaces(command.DefaultModePID, command.DefaultModeIPC)

if command.NetworkIsolation != nil {
Expand Down

0 comments on commit 6dd5de4

Please sign in to comment.