Skip to content

Commit 5762662

Browse files
authored
fix(agent): properly render security block content (#1577)
1 parent bcd7f01 commit 5762662

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

charts/agent/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ sources:
3030
- https://app.sysdigcloud.com/#/settings/user
3131
- https://github.com/draios/sysdig
3232
type: application
33-
version: 1.19.2
33+
version: 1.19.3

charts/agent/templates/_helpers.tpl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,8 @@ and set the agent chart parameters accordingly
339339
{{- if and (not .Values.secure.enabled) $secureFeatProvided }}
340340
{{ fail "Set secure.enabled=true when specifying sysdig.settings.feature.mode is `secure` or `secure_light`" }}
341341
{{- end }}
342-
343342
{{ include "agent.monitorFeatures" . }}
344343
{{ include "agent.secureFeatures" . }}
345-
346344
{{- end -}}
347345

348346
{{/*
@@ -431,6 +429,14 @@ agent config to prevent a backend push from enabling them after installation.
431429
{{- $_ := set $secureConfig "drift_control" (dict "enabled" false) }}
432430
{{- $_ := set $secureConfig "drift_killer" (dict "enabled" false) }}
433431
{{- end }}
432+
433+
{{/* Finally, check sysdig.settings for any additional security block confiugration.
434+
If so, merge it with $secureConfig and unset .Values.sysdig.settings.security */}}
435+
{{- if hasKey .Values.sysdig.settings "security" }}
436+
{{- $secureConfig := merge $secureConfig.security .Values.sysdig.settings.security }}
437+
{{- $_ := unset .Values.sysdig.settings "security"}}
438+
{{- end }}
439+
434440
{{ toYaml $secureConfig }}
435441
{{- end }}
436442

charts/agent/tests/secure_enable_test.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,26 @@ tests:
170170
asserts:
171171
- failedTemplate:
172172
errorMessage: 'Set secure.enabled=true when specifying sysdig.settings.feature.mode is `secure` or `secure_light`'
173+
174+
- it: Test secure.enabled=true when manually specifying security block content
175+
set:
176+
secure:
177+
enabled: true
178+
sysdig:
179+
settings:
180+
security:
181+
goodFeatureEnabled: true
182+
asserts:
183+
- isKind:
184+
of: ConfigMap
185+
- matchRegex:
186+
path: data['dragent.yaml']
187+
pattern: |-
188+
security:
189+
enabled: true
190+
goodFeatureEnabled: true
191+
- notMatchRegex: # Catch the case of duplications due to sysdig.settings.security being specified
192+
path: data['dragent.yaml']
193+
pattern: |-
194+
security:
195+
goodFeatureEnabled: true

0 commit comments

Comments
 (0)