-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(agent): [SMAGENT-8424] Allow for custom security context (#2062)
Introduce a new top-level entry customSecurityContext in Values, so to be able to override the securityContext automatically populated by the chart. This is to be used sparingly, and particularly in circumstances where a very harcoded securityContext should be used instead (like in the case of BottleRocket).
- Loading branch information
Showing
7 changed files
with
156 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
suite: Security Context tests | ||
templates: | ||
- templates/daemonset.yaml | ||
kubernetesProvider: | ||
scheme: | ||
"v1/Node": | ||
gvr: | ||
version: "v1" | ||
resource: "nodes" | ||
namespaced: false | ||
objects: | ||
- apiVersion: v1 | ||
kind: Node | ||
metadata: | ||
name: fakenode | ||
status: | ||
nodeInfo: | ||
osImage: fake-os-image | ||
tests: | ||
- it: Ensure the securityContext for a privileged agent is exactly what was defined | ||
set: | ||
privileged: true | ||
asserts: | ||
- equal: | ||
path: spec.template.spec.containers[?(@.name == "sysdig")].securityContext | ||
value: | ||
allowPrivilegeEscalation: true | ||
privileged: true | ||
readOnlyRootFilesystem: false | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
|
||
- it: Ensure the securityContext for a non-privileged agent contains the keys defined | ||
set: | ||
ebpf: | ||
enabled: true | ||
kind: universal_ebpf | ||
privileged: false | ||
asserts: | ||
- isSubset: | ||
path: spec.template.spec.containers[?(@.name == "sysdig")].securityContext | ||
content: | ||
allowPrivilegeEscalation: false | ||
seccompProfile: | ||
type: Unconfined | ||
- isNotSubset: | ||
path: spec.template.spec.containers[?(@.name == "sysdig")].securityContext | ||
content: | ||
allowPrivilegeEscalation: false | ||
privileged: true | ||
readOnlyRootFilesystem: false | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
|
||
- it: Ensure the customSecurityContext is honored | ||
set: | ||
customSecurityContext: | ||
allowPrivilegeEscalation: true | ||
readOnlyRootFilesystem: false | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
seLinuxOptions: | ||
type: super_t | ||
seccompProfile: | ||
type: Unconfined | ||
capabilities: | ||
add: | ||
- AUDIT_CONTROL | ||
- BLOCK_SUSPEND | ||
- DAC_READ_SEARCH | ||
- IPC_LOCK | ||
- IPC_OWNER | ||
- LEASE | ||
- LINUX_IMMUTABLE | ||
- MAC_ADMIN | ||
- MAC_OVERRIDE | ||
- NET_ADMIN | ||
- NET_BROADCAST | ||
- SYSLOG | ||
- SYS_ADMIN | ||
- SYS_BOOT | ||
- SYS_MODULE | ||
- SYS_NICE | ||
- SYS_PACCT | ||
- SYS_PTRACE | ||
- SYS_RAWIO | ||
- SYS_RESOURCE | ||
- SYS_TIME | ||
- SYS_TTY_CONFIG | ||
- WAKE_ALARM | ||
asserts: | ||
- equal: | ||
path: spec.template.spec.containers[?(@.name == "sysdig")].securityContext | ||
value: | ||
allowPrivilegeEscalation: true | ||
readOnlyRootFilesystem: false | ||
runAsNonRoot: false | ||
runAsUser: 0 | ||
seLinuxOptions: | ||
type: super_t | ||
seccompProfile: | ||
type: Unconfined | ||
capabilities: | ||
add: | ||
- AUDIT_CONTROL | ||
- BLOCK_SUSPEND | ||
- DAC_READ_SEARCH | ||
- IPC_LOCK | ||
- IPC_OWNER | ||
- LEASE | ||
- LINUX_IMMUTABLE | ||
- MAC_ADMIN | ||
- MAC_OVERRIDE | ||
- NET_ADMIN | ||
- NET_BROADCAST | ||
- SYSLOG | ||
- SYS_ADMIN | ||
- SYS_BOOT | ||
- SYS_MODULE | ||
- SYS_NICE | ||
- SYS_PACCT | ||
- SYS_PTRACE | ||
- SYS_RAWIO | ||
- SYS_RESOURCE | ||
- SYS_TIME | ||
- SYS_TTY_CONFIG | ||
- WAKE_ALARM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -404,3 +404,4 @@ tests: | |
tag: 1.31.2 | ||
# Allow to modify DNS policy | ||
dnsPolicy: null | ||
customSecurityContext: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ apiVersion: v2 | |
name: sysdig-deploy | ||
description: A chart with various Sysdig components for Kubernetes | ||
type: application | ||
version: 1.70.0 | ||
version: 1.71.0 | ||
maintainers: | ||
- name: AlbertoBarba | ||
email: [email protected] | ||
|
@@ -26,7 +26,7 @@ dependencies: | |
- name: agent | ||
# repository: https://charts.sysdig.com | ||
repository: file://../agent | ||
version: ~1.33.0 | ||
version: ~1.34.0 | ||
alias: agent | ||
condition: agent.enabled | ||
- name: common | ||
|