Skip to content

Commit

Permalink
chore: rename to universal_ebpf and legacy_ebpf
Browse files Browse the repository at this point in the history
  • Loading branch information
mavimo committed Oct 16, 2023
1 parent b7546be commit cf2276a
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 4 deletions.
4 changes: 2 additions & 2 deletions charts/agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ it can act like a boolean
{{- end -}}

{{- define "agent.universalEbpfEnforced" -}}
{{- if (and (eq "true" (include "agent.ebpfEnabled" .)) (eq "universal" .Values.ebpf.kind )) -}}
{{- if (and (eq "true" (include "agent.ebpfEnabled" .)) (or (eq "universal" .Values.ebpf.kind ) (eq "universal_ebpf" .Values.ebpf.kind ))) -}}
true
{{- end -}}
{{- end -}}

{{- define "agent.legacyEbpfEnforced" -}}
{{- if (and (eq "true" (include "agent.ebpfEnabled" .)) (eq "legacy" .Values.ebpf.kind )) -}}
{{- if (and (eq "true" (include "agent.ebpfEnabled" .)) (or (eq "legacy" .Values.ebpf.kind ) (eq "legacy_ebpf" .Values.ebpf.kind ))) -}}
true
{{- end -}}
{{- end -}}
Expand Down
76 changes: 76 additions & 0 deletions charts/agent/tests/universal_ebpf_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ tests:
- isNull:
path: spec.template.spec.containers[*].env[?(@.name == "SYSDIG_AGENT_DRIVER")]

# TODO: remove before merge
- it: Ensure that when the eBPF is enabled and we specify to use the "legacy" driver we create the sysdig container with the SYSDIG_BPF_PROBE and with SYSDIG_AGENT_DRIVER environment variables
set:
ebpf:
Expand All @@ -47,6 +48,24 @@ tests:
path: spec.template.spec.containers[*].env[?(@.name == "SYSDIG_AGENT_DRIVER")].value
value: legacy_ebpf

- it: Ensure that when the eBPF is enabled and we specify to use the "legacy_ebpf" driver we create the sysdig container with the SYSDIG_BPF_PROBE and with SYSDIG_AGENT_DRIVER environment variables
set:
ebpf:
enabled: true
kind: legacy
asserts:
- isEmpty:
path: spec.template.spec.initContainers[*].env[?(@.name == "SYSDIG_BPF_PROBE")].value
- equal:
path: spec.template.spec.initContainers[*].env[?(@.name == "SYSDIG_AGENT_DRIVER")].value
value: legacy_ebpf
- isEmpty:
path: spec.template.spec.containers[*].env[?(@.name == "SYSDIG_BPF_PROBE")].value
- equal:
path: spec.template.spec.containers[*].env[?(@.name == "SYSDIG_AGENT_DRIVER")].value
value: legacy_ebpf

# TODO: remove before merge
- it: Ensure that when the eBPF is enabled and we specify to use the "universal" driver we create the sysdig container without the SYSDIG_BPF_PROBE and with the SYSDIG_AGENT_DRIVER environment variables
set:
ebpf:
Expand All @@ -59,6 +78,28 @@ tests:
path: spec.template.spec.containers[*].env[?(@.name == "SYSDIG_AGENT_DRIVER")].value
value: universal_ebpf

- it: Ensure that when the eBPF is enabled and we specify to use the "universal_ebpf" driver we create the sysdig container without the SYSDIG_BPF_PROBE and with the SYSDIG_AGENT_DRIVER environment variables
set:
ebpf:
enabled: true
kind: universal_ebpf
asserts:
- isNull:
path: spec.template.spec.containers[*].env[?(@.name == "SYSDIG_BPF_PROBE")]
- equal:
path: spec.template.spec.containers[*].env[?(@.name == "SYSDIG_AGENT_DRIVER")].value
value: universal_ebpf

- it: Ensure that when the eBPF is enabled and we specify to use the "universal_ebpf" driver we don't create the init container
set:
ebpf:
enabled: true
kind: universal_ebpf
asserts:
- isNull:
path: spec.template.spec.initContainers

# TODO: remove before merge
- it: Ensure that when the eBPF is enabled and we specify to use the "universal" driver we don't create the init container
set:
ebpf:
Expand All @@ -68,6 +109,17 @@ tests:
- isNull:
path: spec.template.spec.initContainers

- it: Ensure that when the eBPF is enabled and we specify to use the "legacy_ebpf" driver we create the init container
set:
ebpf:
enabled: true
kind: legacy_ebpf
asserts:
- matchRegex:
path: spec.template.spec.initContainers[*].image
pattern: quay.io/sysdig/agent-kmodule:.*

# TODO: remove before merge
- it: Ensure that when the eBPF is enabled and we specify to use the "legacy" driver we create the init container
set:
ebpf:
Expand All @@ -78,6 +130,17 @@ tests:
path: spec.template.spec.initContainers[*].image
pattern: quay.io/sysdig/agent-kmodule:.*

- it: Ensure that when the eBPF is enabled and we specify to use the "universal_ebpf" driver we use the slim container
set:
ebpf:
enabled: true
kind: universal_ebpf
asserts:
- matchRegex:
path: spec.template.spec.containers[*].image
pattern: quay.io/sysdig/agent-slim:.*

# TODO: remove before merge
- it: Ensure that when the eBPF is enabled and we specify to use the "universal" driver we use the slim container
set:
ebpf:
Expand All @@ -88,6 +151,19 @@ tests:
path: spec.template.spec.containers[*].image
pattern: quay.io/sysdig/agent-slim:.*

- it: Ensure that when the eBPF is enabled and we specify to use the "universal_ebpf" driver we use the slim container also if is slim container is not enabled
set:
slim:
enabled: false
ebpf:
enabled: true
kind: universal_ebpf
asserts:
- matchRegex:
path: spec.template.spec.containers[*].image
pattern: quay.io/sysdig/agent-slim:.*

# TODO: remove before merge
- it: Ensure that when the eBPF is enabled and we specify to use the "universal" driver we use the slim container also if is slim container is not enabled
set:
slim:
Expand Down
4 changes: 3 additions & 1 deletion charts/agent/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"enum": [
"auto",
"legacy",
"universal"
"universal",
"legacy_ebpf",
"universal_ebpf"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion charts/agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ ebpf:
# Enable eBPF support for Sysdig Agent
enabled: false

# Define the kind of eBPF driver that can be used in the agent. Can be `auto`, `legacy` or `universal`
# Define the kind of eBPF driver that can be used in the agent. Can be `auto`, `legacy_ebpf` or `universal_ebpf`
kind: auto

slim:
Expand Down

0 comments on commit cf2276a

Please sign in to comment.