-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Description
Add SecurityContext to containers in the kubernetes runtime as noted in this TODO:
// TODO: add SecurityContext options (runAsUser, runAsNonRoot, sysctls)There are several settings that can be configured in SecurityContext, some of which can only be set on the whole Pod, others can only be set per-container, and others can be set in either context (container-level overriding pod-level).
| Setting | Type | Pod | Container | ConfigureWorkerw/ default |
Stepoverride (if worker allows) |
Pipelineoverride (if worker allows) |
Apply if volumes need it |
|---|---|---|---|---|---|---|---|
| allowPrivilegeEscalation | boolean | ✅ | ➖ | ➖ implicitly toggled by privileged |
➖ | ||
| capabilities | object | ✅ | ➕ ✔️ via CRD |
➕ | ➖ | ||
| - add, drop | string arrays | ||||||
| fsGroup | integer | ✅ | ➖ | ➖ | ➖ | 💾 | |
| fsGroupChangePolicy | string | ✅ | ➖ | ➖ | ➖ | 💾 | |
| privileged | boolean | ✅ | ➕ ✔️ allow list of images via opt/env |
➕ config exists |
➖ | ||
| procMount | string | ✅ | ➖ | ➖ | ➖ | ||
| readOnlyRootFilesystem | boolean | ✅ | ➖ | ➖ | ➖ | 💾 | |
| runAsGroup | integer | ✅ | ✅ | ➖ | ➕ | ❔ | |
| runAsNonRoot | boolean | ✅ | ✅ | ➕ ✔️ pod-level only via CRD |
➕ | ❔ | |
| runAsUser | integer | ✅ | ✅ | ➖ | ➕ config exists (missing in k8s) |
➖ | |
| seLinuxOptions | object | ✅ | ✅ | ❔ | ❔ | ❔ | |
| - level, role, type, user | strings | ||||||
| seccompProfile | object | ✅ | ✅ | ❔ | ❔ | ❔ | |
| - localhostProfile, type | strings | ||||||
| supplementalGroups | integer array | ✅ | ➖ | ➖ | ❔ | 💾 | |
| sysctls | object array | ✅ | ➕ ✔️ via CRD |
➖ulimits exists(but k8s can't do per-step sysctls) |
➕ | ||
| - name, value | strings | ||||||
| windowsOptions | object | ✅ | ✅ | N/A | N/A | N/A | |
| - gmsa*, hostProcess, runAsUserName | mixed |
Value
Allow using Vela in clusters where an admissions controller blocks the creation of pods unless SecurityContext requirements are met.
Make pipelines follow the principle of least-privileges: Like "privileged" only increase access if requested (and permitted).
Definition of Done
- Each k8s worker can add global SecurityContext to all pipeline containers.
- Different workers can have different settings (configurable somehow by the vela admin).
- Maybe surface minimal override configuration for this in the pipeline yaml or in the repo settings.
Effort (Optional)
Adding the SecurityContext should be straight-forward.
But, how to configure that is not clear.
Impacted Personas (Optional)
Anyone who uses the kubernetes runtime and wants to apply SecurityContext settings.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status