Skip to content

Commit

Permalink
chore: rename to universal_ebpf and legacy_ebpf & remove auto (#1405)
Browse files Browse the repository at this point in the history
  • Loading branch information
mavimo authored Oct 17, 2023
1 parent b7546be commit f96c39d
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 12 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
2 changes: 1 addition & 1 deletion charts/agent/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ spec:
{{- if (include "agent.universalEbpfEnforced" .) }}
- name: SYSDIG_AGENT_DRIVER
value: universal_ebpf
{{- else if (and (include "agent.ebpfEnabled" .) (eq "legacy" .Values.ebpf.kind )) }}
{{- else if (include "agent.legacyEbpfEnforced" .) }}
- name: SYSDIG_AGENT_DRIVER
value: legacy_ebpf
{{- end }}
Expand Down
88 changes: 83 additions & 5 deletions charts/agent/tests/universal_ebpf_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,40 @@ tests:
- isNull:
path: spec.template.spec.containers[*].env[?(@.name == "SYSDIG_AGENT_DRIVER")]

- it: Ensure that when the eBPF is enabled with the default driver we create the sysdig container with the SYSDIG_BPF_PROBE and without SYSDIG_AGENT_DRIVER environment variables
- it: Ensure that when the eBPF is enabled the default driver is "legacy_ebpf" we create the sysdig container with the SYSDIG_BPF_PROBE and SYSDIG_AGENT_DRIVER=legacy_ebpf environment variables
set:
ebpf:
enabled: true
asserts:
- isEmpty:
path: spec.template.spec.initContainers[*].env[?(@.name == "SYSDIG_BPF_PROBE")].value
- isNull:
path: spec.template.spec.initContainers[*].env[?(@.name == "SYSDIG_AGENT_DRIVER")]
- 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
- isNull:
path: spec.template.spec.containers[*].env[?(@.name == "SYSDIG_AGENT_DRIVER")]
- equal:
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_ebpf
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 "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 +67,19 @@ 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 "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

# 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 +92,16 @@ 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 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 +111,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 +132,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 +153,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
5 changes: 3 additions & 2 deletions charts/agent/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
"kind": {
"type": "string",
"enum": [
"auto",
"legacy",
"universal"
"universal",
"legacy_ebpf",
"universal_ebpf"
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions charts/agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ 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`
kind: auto
# Define the kind of eBPF driver that can be used in the agent. Can be `legacy_ebpf` or `universal_ebpf`
kind: legacy_ebpf

slim:
# Uses a slim version of the Sysdig Agent
Expand Down

0 comments on commit f96c39d

Please sign in to comment.