diff --git a/charts/agent/Chart.yaml b/charts/agent/Chart.yaml index 35995c523..12e53972e 100644 --- a/charts/agent/Chart.yaml +++ b/charts/agent/Chart.yaml @@ -5,7 +5,7 @@ description: Sysdig Monitor and Secure agent type: application # currently matching sysdig 1.14.32 -version: 1.13.8 +version: 1.13.9 appVersion: 12.16.0 @@ -36,4 +36,4 @@ dependencies: - name: common # repository: https://charts.sysdig.com repository: file://../common - version: ~1.2.0 + version: ~1.2.1 diff --git a/charts/agent/templates/configmap.yaml b/charts/agent/templates/configmap.yaml index 0da0ff4e7..b3bef1692 100644 --- a/charts/agent/templates/configmap.yaml +++ b/charts/agent/templates/configmap.yaml @@ -45,9 +45,6 @@ data: enforce_leader_election: true namespace: {{ include "agent.namespace" . }} {{- end }} -{{- if .Values.global.sysdig.tags }} - tags: {{ include "agent.tags" . }} -{{- end }} {{- if .Values.prometheus.file }} prometheus.yaml: | {{ toYaml .Values.prometheus.yaml | indent 4 }} diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index c66f3c8e9..29ae74a4a 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -16,7 +16,7 @@ type: library # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.2.0 +version: 1.2.1 maintainers: - name: AlbertoBarba diff --git a/charts/common/templates/_agent_tags.tpl b/charts/common/templates/_agent_tags.tpl index abc5d064b..0e13ea17e 100644 --- a/charts/common/templates/_agent_tags.tpl +++ b/charts/common/templates/_agent_tags.tpl @@ -1,14 +1,30 @@ {{/* -Use global sysdig tags for agent +Flatten tags dict recursively */}} -{{- define "agent.tags" -}} - {{- if .Values.global.sysdig.tags -}} - {{- with .Values.global.sysdig.tags -}} - {{- $fields := list -}} - {{- range $k, $v := . -}} - {{- $fields = (printf "%s:%s" $k $v) | append $fields -}} - {{- end -}} - {{- join "," $fields -}} +{{- define "dict.flatten" -}} + {{- $map := first . -}} + {{- $label := last . -}} + {{- $fields := list -}} + {{- range $key, $val := $map -}} + {{- $sublabel := list $label $key | join "." -}} + {{- if $label | eq "" -}} + {{ $sublabel = $key }} + {{- end -}} + {{- if kindOf $val | eq "map" -}} + {{- $fields = (list $val $sublabel | include "dict.flatten") | append $fields }} + {{- else -}} + {{- $fields = (printf "%s:%s" $sublabel $val) | append $fields -}} {{- end -}} {{- end -}} + {{- join "," $fields -}} +{{- end -}} + +{{/* +Use global sysdig tags for agent +*/}} +{{- define "agent.tags" -}} +{{- if .Values.global.sysdig.tags -}} + {{- $args := list .Values.global.sysdig.tags ""}} + {{- include "dict.flatten" $args }} +{{- end -}} {{- end -}} diff --git a/charts/kspm-collector/Chart.yaml b/charts/kspm-collector/Chart.yaml index 092d5a53c..6db0b6f4a 100644 --- a/charts/kspm-collector/Chart.yaml +++ b/charts/kspm-collector/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: kspm-collector description: Sysdig KSPM collector -version: 0.8.0 +version: 0.8.1 appVersion: 1.30.0 keywords: @@ -24,4 +24,4 @@ dependencies: - name: common # repository: https://charts.sysdig.com repository: file://../common - version: ~1.2.0 + version: ~1.2.1 diff --git a/charts/kspm-collector/tests/agent_tags_test.yaml b/charts/kspm-collector/tests/agent_tags_test.yaml index 6d375c604..d8d7a9149 100644 --- a/charts/kspm-collector/tests/agent_tags_test.yaml +++ b/charts/kspm-collector/tests/agent_tags_test.yaml @@ -2,7 +2,7 @@ suite: Test kspm-collector Agent Tags templates: - deployment.yaml tests: - - it: Check agent tags are set from global.settings.tags + - it: Check agent tags are set from global.sysdig.tags set: clusterName: "test-k8s" sysdig: @@ -12,12 +12,24 @@ tests: sysdig: tags: tag: value + - it: Check nested agent tags are set from global.sysdig.tags + set: + clusterName: "test-k8s" + sysdig: + accessKey: standard-key + secureAPIToken: standard-token + global: + sysdig: + tags: + nested: + value: + level: two asserts: - contains: path: spec.template.spec.containers[0].env content: name: TAGS - value: tag:value + value: nested.value.level:two template: deployment.yaml - it: Check agent tags are not set set: diff --git a/charts/node-analyzer/Chart.yaml b/charts/node-analyzer/Chart.yaml index 874611c75..6b96eefbd 100644 --- a/charts/node-analyzer/Chart.yaml +++ b/charts/node-analyzer/Chart.yaml @@ -3,7 +3,7 @@ name: node-analyzer description: Sysdig Node Analyzer # currently matching Sysdig's appVersion 1.14.34 -version: 1.17.0 +version: 1.17.1 appVersion: 12.8.0 keywords: - monitoring @@ -26,4 +26,4 @@ dependencies: - name: common # repository: https://charts.sysdig.com repository: file://../common - version: ~1.2.0 + version: ~1.2.1 diff --git a/charts/node-analyzer/templates/configmap-host-scanner.yaml b/charts/node-analyzer/templates/configmap-host-scanner.yaml index bc0bc7f28..cd3bb171a 100644 --- a/charts/node-analyzer/templates/configmap-host-scanner.yaml +++ b/charts/node-analyzer/templates/configmap-host-scanner.yaml @@ -10,12 +10,7 @@ data: api_endpoint: https://{{ include "nodeAnalyzer.apiEndpoint" . }} cluster_name: {{ required "A valid clusterName is required" (include "nodeAnalyzer.clusterName" . ) }} {{- if hasKey .Values.global.sysdig "tags" }} - {{- $customTags := list -}} - {{ range $key, $val := .Values.global.sysdig.tags }} - {{- $entry := list $key $val | join ":" -}} - {{- $customTags = append $customTags $entry -}} - {{ end }} - custom_tags: {{ join "," $customTags | quote }} + custom_tags: {{ include "agent.tags" . }} {{- end }} {{- if hasKey .Values.nodeAnalyzer.hostScanner "scanOnStart" }} scan_on_start: "{{ .Values.nodeAnalyzer.hostScanner.scanOnStart }}" diff --git a/charts/sysdig-deploy/Chart.yaml b/charts/sysdig-deploy/Chart.yaml index 5e322a641..a87055867 100644 --- a/charts/sysdig-deploy/Chart.yaml +++ b/charts/sysdig-deploy/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: sysdig-deploy description: A chart with various Sysdig components for Kubernetes type: application -version: 1.22.4 +version: 1.22.5 maintainers: - name: AlbertoBarba email: alberto.barba@sysdig.com @@ -26,7 +26,7 @@ dependencies: - name: agent # repository: https://charts.sysdig.com repository: file://../agent - version: ~1.13.8 + version: ~1.13.9 alias: agent condition: agent.enabled - name: common @@ -36,7 +36,7 @@ dependencies: - name: node-analyzer # repository: https://charts.sysdig.com repository: file://../node-analyzer - version: ~1.17.0 + version: ~1.17.1 alias: nodeAnalyzer condition: nodeAnalyzer.enabled - name: cluster-scanner @@ -48,7 +48,7 @@ dependencies: - name: kspm-collector # repository: https://charts.sysdig.com repository: file://../kspm-collector - version: ~0.8.0 + version: ~0.8.1 alias: kspmCollector condition: global.kspm.deploy - name: rapid-response