From 9bf52e48bda3183a1bd5156814abc7d03ec14f4b Mon Sep 17 00:00:00 2001 From: Federico Feresini Date: Wed, 18 Oct 2023 15:16:25 +0200 Subject: [PATCH] check only when onPremCompatibilityVersion is not provided --- charts/cluster-scanner/templates/_helpers.tpl | 9 ++++----- charts/cluster-scanner/tests/configmap_test.yaml | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/charts/cluster-scanner/templates/_helpers.tpl b/charts/cluster-scanner/templates/_helpers.tpl index b4d0f68c2..745c7606f 100644 --- a/charts/cluster-scanner/templates/_helpers.tpl +++ b/charts/cluster-scanner/templates/_helpers.tpl @@ -207,13 +207,12 @@ Define the proper imageRegistry to use for imageSbomExtractor {{/* Generates configmap data to enable platform services if onPremCompatibility version is not set, or it is greater than 6.6.0 -It also makes sure that the plarform services are enabled in regions which support them. +It also makes sure that the plarform services are enabled in regions which support them when onPremCompatibility is not defined. */}} {{- define "cluster-scanner.enablePlatformServicesConfig" -}} -{{- if ( semverCompare ">= 6.6.0" (.Values.onPremCompatibilityVersion | default "6.6.0" )) -}} - {{- $regionsPlatformEnabled := dict "us1" "" "us2" "" "us3" "" "au1" "" "eu1" -}} - {{- if hasKey $regionsPlatformEnabled .Values.global.sysdig.region -}} -enable_platform_services: "true" +{{- if and ( semverCompare ">= 6.6.0" (.Values.onPremCompatibilityVersion | default "6.6.0" )) -}} + {{- if or (hasKey (dict "us1" "" "us2" "" "us3" "" "au1" "" "eu1") .Values.global.sysdig.region) .Values.onPremCompatibilityVersion -}} + enable_platform_services: "true" {{- end -}} {{- end -}} {{- end -}} diff --git a/charts/cluster-scanner/tests/configmap_test.yaml b/charts/cluster-scanner/tests/configmap_test.yaml index e4ecc0348..865da59ef 100644 --- a/charts/cluster-scanner/tests/configmap_test.yaml +++ b/charts/cluster-scanner/tests/configmap_test.yaml @@ -401,8 +401,9 @@ tests: onPremCompatibilityVersion: "6.6.0" global.sysdig.region: "" asserts: - - isNull: + - equal: path: data.enable_platform_services + value: "true" - it: "has correct platform services value when onPremCompatibilityVersion is = 6.6.0 and region supports platform services" set: