From 37998434fa89fda2c54deb0404ed90c5bcd9c782 Mon Sep 17 00:00:00 2001 From: Zohar Arad Date: Thu, 27 Jul 2023 15:48:45 +0300 Subject: [PATCH] SSPROD-27133: fix failing node-analyzer chart tests and add tests to ensure hostPID is set correctly --- charts/node-analyzer/templates/_helpers.tpl | 2 +- .../tests/conditional_flag_test.yaml | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) 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: