Skip to content

Commit

Permalink
fix(agent): fix indentation for custom settings (#1277)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Roberts <[email protected]>
  • Loading branch information
mavimo and aroberts87 authored Aug 2, 2023
1 parent ae75590 commit 9e8d863
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 5 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.0
version: 1.13.1

appVersion: 12.15.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 @@ -51,8 +51,8 @@ data:
{{- $baseSettings := .Values.sysdig.settings -}}
{{- $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 | indent 4 }}
{{ toYaml $mergedSettings | nindent 4 }}
{{- else if .Values.sysdig.settings }}
{{ toYaml .Values.sysdig.settings | indent 4 }}
{{ toYaml .Values.sysdig.settings | nindent 4 }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions charts/agent/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ data:
{{- $baseSettings := .Values.sysdig.settings -}}
{{- $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 | indent 4 }}
{{ toYaml $mergedSettings | nindent 4 }}
{{- else if .Values.sysdig.settings }}
{{ toYaml .Values.sysdig.settings | indent 4 }}
{{ toYaml .Values.sysdig.settings | nindent 4 }}
{{- end }}
{{- if .Values.leaderelection.enable }}
k8s_delegation_election: true
Expand Down
100 changes: 100 additions & 0 deletions charts/agent/tests/custom_settings_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
suite: Testing pre-generated values and best-known edge cases
templates:
- configmap.yaml
- configmap-deployment.yaml
tests:
- it: Testing custom settings
set:
sysdig:
accessKey: AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE
settings:
first:
value: 1
second: example
asserts:
- matchRegex:
path: data['dragent.yaml']
pattern: |-
.*
first:
value: 1
second: example
.*
template: configmap.yaml

- it: Testing custom settings when custom CA is in place
set:
ssl:
ca:
certs:
- |
-----BEGIN CERTIFICATE-----
my-test-cert
-----END CERTIFICATE-----
keyName: "root_ca.crt"
sysdig:
accessKey: AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE
settings:
first:
value: 1
second: example
asserts:
- matchRegex:
path: data['dragent.yaml']
pattern: |-
.*
first:
value: 1
second: example
.*
template: configmap.yaml

- it: Testing custom settings in deployment
set:
delegatedAgentDeployment:
enabled: true
sysdig:
accessKey: AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE
settings:
first:
value: 1
second: example
asserts:
- matchRegex:
path: data['dragent.yaml']
pattern: |-
.*
first:
value: 1
second: example
.*
template: configmap-deployment.yaml

- it: Testing custom settings in deployment when custom CA is in place
set:
delegatedAgentDeployment:
enabled: true
ssl:
ca:
certs:
- |
-----BEGIN CERTIFICATE-----
my-test-cert
-----END CERTIFICATE-----
keyName: "root_ca.crt"
sysdig:
accessKey: AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE
settings:
first:
value: 1
second: example
asserts:
- matchRegex:
path: data['dragent.yaml']
pattern: |-
.*
first:
value: 1
second: example
.*
template: configmap-deployment.yaml

0 comments on commit 9e8d863

Please sign in to comment.