diff --git a/charts/node-analyzer/templates/_helpers.tpl b/charts/node-analyzer/templates/_helpers.tpl index 6e56f8529..cbdf9f705 100644 --- a/charts/node-analyzer/templates/_helpers.tpl +++ b/charts/node-analyzer/templates/_helpers.tpl @@ -242,7 +242,7 @@ true {{- define "nodeAnalyzer.useHostPID" -}} {{- if (include "nodeAnalyzer.deployBenchmarkRunner" .) }} true -{{ else if and ((hasKey .Values.global.kspm "deploy") .Values.global.kspm.deploy) }} +{{ else if or (not (hasKey .Values.global.kspm "deploy")) .Values.global.kspm.deploy }} true {{- end -}} {{- end -}} diff --git a/charts/node-analyzer/tests/conditional_flag_test.yaml b/charts/node-analyzer/tests/conditional_flag_test.yaml index 1a5962db4..83a0c8edd 100644 --- a/charts/node-analyzer/tests/conditional_flag_test.yaml +++ b/charts/node-analyzer/tests/conditional_flag_test.yaml @@ -20,6 +20,30 @@ tests: apiVersion: v1 template: configmap-kspm-analyzer.yaml + - it: Check hostPID is true if global.kspm.deploy is true + set: + global: + kspm: + deploy: true + clusterName: test-cluster + template: daemonset-node-analyzer.yaml + asserts: + - equal: + path: spec.template.spec.hostPID + value: true + + - it: Check hostPID is true if nodeAnalyzer.benchmarkRunner.deploy is true + set: + nodeAnalyzer: + benchmarkRunner: + deploy: true + clusterName: test-cluster + template: daemonset-node-analyzer.yaml + asserts: + - equal: + path: spec.template.spec.hostPID + value: true + - it: Check global kspm deploy without clusterName set: global: