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(cluster-shield): fix type casting for ssl.verify #1988

Merged
merged 1 commit into from
Oct 21, 2024
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/cluster-shield/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: cluster-shield
description: Cluster Shield Helm Chart for Kubernetes
type: application
version: 1.4.1
version: 1.4.2
appVersion: "1.4.0"
maintainers:
- name: AlbertoBarba
Expand Down
3 changes: 2 additions & 1 deletion charts/cluster-shield/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ Adds kubernetes related keys to the configuration.
{{- end -}}
{{- end -}}
{{- if not (hasKey (default .Values.cluster_shield.ssl dict) "verify") -}}
{{- $_ := set $conf "ssl" (dict "verify" .Values.global.sslVerifyCertificate) -}}
{{/* Hackish way to manage boolean values as helm do not provide `toBool` function, see https://github.com/helm/helm/issues/10382 */}}
{{- $_ := set $conf "ssl" (printf "{\"verify\": %s}" (.Values.global.sslVerifyCertificate | toString) | fromJson) -}}
{{- end -}}
{{- if not .Values.cluster_shield.cluster_config.name -}}
{{- if .Values.global.clusterConfig.name -}}
Expand Down
30 changes: 30 additions & 0 deletions charts/cluster-shield/tests/global_settings_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,33 @@ tests:
pattern: |-
sysdig_endpoint:
api_url: https://www.global-example.org

- it: Test genrated type with global ssl (string)
set:
global:
sslVerifyCertificate: "false"
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: sysdig-cluster-shield
- matchRegex:
path: data["cluster-shield.yaml"]
pattern: |-
ssl:
verify: false

- it: Test genrated type with global ssl (bool)
set:
global:
sslVerifyCertificate: false
asserts:
- containsDocument:
kind: ConfigMap
apiVersion: v1
name: sysdig-cluster-shield
- matchRegex:
path: data["cluster-shield.yaml"]
pattern: |-
ssl:
verify: false
12 changes: 12 additions & 0 deletions charts/cluster-shield/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@
]
}
}
},
"sslVerifyCertificate": {
"type": [
"boolean",
"string"
],
"enum": [
"true",
"false",
true,
false
]
}
}
},
Expand Down
Loading