Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 34545f3

Browse files
committed
sandbox: expose share sandbox pidns setting
So that we let callers decide if kata-agent should let all containers in a sandbox share the same pid namespace. Fixes: #426 Signed-off-by: Peng Tao <bergwolf@gmail.com>
1 parent c324b55 commit 34545f3

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

virtcontainers/kata_agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ func (k *kataAgent) startSandbox(sandbox *Sandbox) error {
528528
req := &grpc.CreateSandboxRequest{
529529
Hostname: hostname,
530530
Storages: storages,
531-
SandboxPidns: false,
531+
SandboxPidns: sandbox.sharePidNs,
532532
}
533533

534534
_, err = k.sendReq(req)

virtcontainers/sandbox.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ type SandboxConfig struct {
358358
Annotations map[string]string
359359

360360
ShmSize uint64
361+
362+
// SharePidNs sets all containers to share the same sandbox level pid namespace.
363+
SharePidNs bool
361364
}
362365

363366
// valid checks that the sandbox configuration is valid.
@@ -462,7 +465,8 @@ type Sandbox struct {
462465

463466
wg *sync.WaitGroup
464467

465-
shmSize uint64
468+
shmSize uint64
469+
sharePidNs bool
466470
}
467471

468472
// ID returns the sandbox identifier string.
@@ -743,6 +747,7 @@ func newSandbox(sandboxConfig SandboxConfig) (*Sandbox, error) {
743747
annotationsLock: &sync.RWMutex{},
744748
wg: &sync.WaitGroup{},
745749
shmSize: sandboxConfig.ShmSize,
750+
sharePidNs: sandboxConfig.SharePidNs,
746751
}
747752

748753
if err = globalSandboxList.addSandbox(s); err != nil {

0 commit comments

Comments
 (0)