Skip to content

Commit

Permalink
fix(agent): properly render security block content (#1577)
Browse files Browse the repository at this point in the history
  • Loading branch information
aroberts87 authored Jan 26, 2024
1 parent bcd7f01 commit 5762662
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/agent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ sources:
- https://app.sysdigcloud.com/#/settings/user
- https://github.com/draios/sysdig
type: application
version: 1.19.2
version: 1.19.3
10 changes: 8 additions & 2 deletions charts/agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,8 @@ and set the agent chart parameters accordingly
{{- if and (not .Values.secure.enabled) $secureFeatProvided }}
{{ fail "Set secure.enabled=true when specifying sysdig.settings.feature.mode is `secure` or `secure_light`" }}
{{- end }}

{{ include "agent.monitorFeatures" . }}
{{ include "agent.secureFeatures" . }}

{{- end -}}

{{/*
Expand Down Expand Up @@ -431,6 +429,14 @@ agent config to prevent a backend push from enabling them after installation.
{{- $_ := set $secureConfig "drift_control" (dict "enabled" false) }}
{{- $_ := set $secureConfig "drift_killer" (dict "enabled" false) }}
{{- end }}

{{/* Finally, check sysdig.settings for any additional security block confiugration.
If so, merge it with $secureConfig and unset .Values.sysdig.settings.security */}}
{{- if hasKey .Values.sysdig.settings "security" }}
{{- $secureConfig := merge $secureConfig.security .Values.sysdig.settings.security }}
{{- $_ := unset .Values.sysdig.settings "security"}}
{{- end }}

{{ toYaml $secureConfig }}
{{- end }}

Expand Down
23 changes: 23 additions & 0 deletions charts/agent/tests/secure_enable_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,26 @@ tests:
asserts:
- failedTemplate:
errorMessage: 'Set secure.enabled=true when specifying sysdig.settings.feature.mode is `secure` or `secure_light`'

- it: Test secure.enabled=true when manually specifying security block content
set:
secure:
enabled: true
sysdig:
settings:
security:
goodFeatureEnabled: true
asserts:
- isKind:
of: ConfigMap
- matchRegex:
path: data['dragent.yaml']
pattern: |-
security:
enabled: true
goodFeatureEnabled: true
- notMatchRegex: # Catch the case of duplications due to sysdig.settings.security being specified
path: data['dragent.yaml']
pattern: |-
security:
goodFeatureEnabled: true

0 comments on commit 5762662

Please sign in to comment.