Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(agent): fix indentation for custom settings #1277

Merged
merged 3 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading