Skip to content

Commit cb8253e

Browse files
authored
Merge pull request #4791 from crosbymichael/base-runtime-opts
[cri] don't clear base security settings
2 parents 59a0667 + 3d358c9 commit cb8253e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

pkg/cri/server/container_create_linux.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,20 @@ func (c *criService) containerSpec(id string, sandboxID string, sandboxPid uint3
114114

115115
specOpts := []oci.SpecOpts{
116116
customopts.WithoutRunMount,
117-
customopts.WithoutDefaultSecuritySettings,
117+
}
118+
// only clear the default security settings if the runtime does not have a custom
119+
// base runtime spec spec. Admins can use this functionality to define
120+
// default ulimits, seccomp, or other default settings.
121+
if ociRuntime.BaseRuntimeSpec == "" {
122+
specOpts = append(specOpts, customopts.WithoutDefaultSecuritySettings)
123+
}
124+
specOpts = append(specOpts,
118125
customopts.WithRelativeRoot(relativeRootfsPath),
119126
customopts.WithProcessArgs(config, imageConfig),
120127
oci.WithDefaultPathEnv,
121128
// this will be set based on the security context below
122129
oci.WithNewPrivileges,
123-
}
130+
)
124131
if config.GetWorkingDir() != "" {
125132
specOpts = append(specOpts, oci.WithProcessCwd(config.GetWorkingDir()))
126133
} else if imageConfig.WorkingDir != "" {

0 commit comments

Comments
 (0)