Skip to content

Commit

Permalink
fix(agent): don't duplicate cointerface_enabled field in deployment…
Browse files Browse the repository at this point in the history
… agent configmaps

The value `cointerface_enabled: true` is hardcoded into the deployment agent's configmap
by design, but if the value were overridden in `sysdig.settings` the field would end up
being duplicated when the deployment configmap blindly rendered out that block. This fix
addresses that issue by omitting that key when rendering the set of values from the
`sysdig.settings` block.
  • Loading branch information
aroberts87 committed Aug 16, 2023
1 parent 731fd34 commit 0998d4e
Show file tree
Hide file tree
Showing 3 changed files with 71 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 @@ -5,7 +5,7 @@ description: Sysdig Monitor and Secure agent
type: application

# currently matching sysdig 1.14.32
version: 1.13.5
version: 1.13.6

appVersion: 12.16.0

Expand Down
4 changes: 2 additions & 2 deletions charts/agent/templates/configmap-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ data:
{{- $caFilePath := printf "%s%s" "/etc/ca-certs/" (include "sysdig.custom_ca.keyName" (dict "global" .Values.global.ssl "component" .Values.ssl)) }}
{{- $mergedSettings := mergeOverwrite $baseSettings (dict "http_proxy" (dict "ca_certificate" $caFilePath)) -}}
{{ toYaml $mergedSettings | nindent 4 }}
{{- else if .Values.sysdig.settings }}
{{ toYaml .Values.sysdig.settings | nindent 4 }}
{{- else if (omit .Values.sysdig.settings "cointerface_enabled") }}
{{ toYaml (omit .Values.sysdig.settings "cointerface_enabled") | nindent 4 }}
{{- end }}
{{- end }}
68 changes: 68 additions & 0 deletions charts/agent/tests/delegated_agent_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -561,3 +561,71 @@ tests:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: false'
template: templates/configmap-deployment.yaml

- it: Validate cointerface_enabled keys are not duplicated
set:
delegatedAgentDeployment:
enabled: true
sysdig:
settings:
cointerface_enabled: false
asserts:
- notMatchRegex:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: false'
template: templates/configmap-deployment.yaml
- matchRegex:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: true'
template: templates/configmap-deployment.yaml
- notMatchRegex:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: true'
template: templates/configmap.yaml
- matchRegex:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: false'
template: templates/configmap.yaml

- it: Validate cointerface_enabled keys are not duplicated
set:
delegatedAgentDeployment:
enabled: true
sysdig:
settings:
cointerface_enabled: true
asserts:
- notMatchRegex:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: false'
template: templates/configmap-deployment.yaml
- matchRegex:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: true'
template: templates/configmap-deployment.yaml
- notMatchRegex:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: false'
template: templates/configmap.yaml
- matchRegex:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: true'
template: templates/configmap.yaml

- it: Ensure settings overrides are still provided to deployment configmap
set:
delegatedAgentDeployment:
enabled: true
sysdig:
settings:
logs:
console_priority: debug
cointerface_enabled: false
asserts:
- matchRegex:
path: data['dragent.yaml']
pattern: 'logs:\n console_priority: debug'
- notMatchRegex:
path: data['dragent.yaml']
pattern: 'cointerface_enabled: false'
template: templates/configmap-deployment.yaml

0 comments on commit 0998d4e

Please sign in to comment.