docs: fixup comments, var names

This commit is contained in:
Seth Hoenig 2021-02-08 10:58:44 -06:00
parent f5cc4c5d44
commit 152534fe21
5 changed files with 21 additions and 21 deletions

View File

@ -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

View File

@ -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
@ -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

View File

@ -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

View File

@ -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 (
@ -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
}

View File

@ -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
@ -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 {