From 9ef8425c634c78d1b46006588447ae75d3c7ff56 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 | 10 +++++----- charts/cluster-scanner/tests/configmap_test.yaml | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/charts/cluster-scanner/templates/_helpers.tpl b/charts/cluster-scanner/templates/_helpers.tpl index b4d0f68c2..cdcc442e7 100644 --- a/charts/cluster-scanner/templates/_helpers.tpl +++ b/charts/cluster-scanner/templates/_helpers.tpl @@ -207,13 +207,13 @@ 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" )) -}} + {{- $regionsPlatformEnabled := list "us1" "us2" "us3" "au1" "eu1" -}} + {{- if or (has .Values.global.sysdig.region $regionsPlatformEnabled) .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: