Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cluster-scanner): Enable platform services only in regions which support them #1413

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/cluster-scanner/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Sysdig Cluster Scanner

type: application

version: 0.7.2
version: 0.8.0

appVersion: "0.1.0"
home: https://www.sysdig.com/
Expand Down
8 changes: 4 additions & 4 deletions charts/cluster-scanner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $ pre-commit run -a
$ helm repo add sysdig https://charts.sysdig.com
$ helm repo update
$ helm upgrade --install sysdig-cluster-scanner sysdig/cluster-scanner \
--create-namespace -n sysdig --version=0.7.2 \
--create-namespace -n sysdig --version=0.8.0 \
--set global.clusterConfig.name=CLUSTER_NAME \
--set global.sysdig.region=SYSDIG_REGION \
--set global.sysdig.accessKey=YOUR-KEY-HERE
Expand Down Expand Up @@ -55,7 +55,7 @@ To install the chart with the release name `cluster-scanner`, run:

```console
$ helm upgrade --install sysdig-cluster-scanner sysdig/cluster-scanner \
--create-namespace -n sysdig --version=0.7.2 \
--create-namespace -n sysdig --version=0.8.0 \
--set global.clusterConfig.name=CLUSTER_NAME \
--set global.sysdig.region=SYSDIG_REGION \
--set global.sysdig.accessKey=YOUR-KEY-HERE
Expand Down Expand Up @@ -161,7 +161,7 @@ Specify each parameter using the **`--set key=value[,key=value]`** argument to `

```console
$ helm upgrade --install sysdig-cluster-scanner sysdig/cluster-scanner \
--create-namespace -n sysdig --version=0.7.2 \
--create-namespace -n sysdig --version=0.8.0 \
--set global.sysdig.region="us1"
```

Expand All @@ -170,7 +170,7 @@ installing the chart. For example:

```console
$ helm upgrade --install sysdig-cluster-scanner sysdig/cluster-scanner \
--create-namespace -n sysdig --version=0.7.2 \
--create-namespace -n sysdig --version=0.8.0 \
--values values.yaml
```

Expand Down
4 changes: 4 additions & 0 deletions charts/cluster-scanner/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,14 @@ 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.
*/}}
{{- 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 -}}
michele-mangili marked this conversation as resolved.
Show resolved Hide resolved
enable_platform_services: "true"
{{- end -}}
{{- end -}}
{{- end -}}

Expand Down
48 changes: 43 additions & 5 deletions charts/cluster-scanner/tests/configmap_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -342,34 +342,73 @@ tests:
path: data.no_proxy
value: "fake-no-proxy"

- it: "has correct platform services value when onPremCompatibilityVersion is NOT provided"
- it: "has correct platform services value when onPremCompatibilityVersion is NOT provided and region does NOT support platform services"
set:
global.sysdig.apiHost: "http://test.com"
global.sysdig.region: ""
asserts:
- isNull:
path: data.enable_platform_services

- it: "has correct platform services value when onPremCompatibilityVersion is NOT provided and region supports platform services"
set:
global.sysdig.apiHost: "http://test.com"
global.sysdig.region: "us1"
asserts:
- equal:
path: data.enable_platform_services
value: "true"

- it: "has correct platform services value when onPremCompatibilityVersion is < 6.6"
- it: "has correct platform services value when onPremCompatibilityVersion is < 6.6 and region does NOT support platform services"
set:
global.sysdig.apiHost: "http://test.com"
onPremCompatibilityVersion: "6.5.99"
global.sysdig.region: ""
asserts:
- isNull:
path: data.enable_platform_services

- it: "has correct platform services value when onPremCompatibilityVersion is < 6.6 and region supports platform services"
set:
global.sysdig.apiHost: "http://test.com"
onPremCompatibilityVersion: "6.5.99"
global.sysdig.region: "us1"
asserts:
- isNull:
path: data.enable_platform_services

- it: "has correct platform services value when onPremCompatibilityVersion is = 6.5 and region does NOT support platform services"
set:
global.sysdig.apiHost: "http://test.com"
onPremCompatibilityVersion: "6.5"
global.sysdig.region: ""
asserts:
- isNull:
path: data.enable_platform_services

- it: "has correct platform services value when onPremCompatibilityVersion is = 6.5"
- it: "has correct platform services value when onPremCompatibilityVersion is = 6.5 and region supports platform services"
set:
global.sysdig.apiHost: "http://test.com"
onPremCompatibilityVersion: "6.5"
global.sysdig.region: "us1"
asserts:
- isNull:
path: data.enable_platform_services

- it: "has correct platform services value when onPremCompatibilityVersion is = 6.6.0 and region does NOT support platform services"
set:
global.sysdig.apiHost: "http://test.com"
onPremCompatibilityVersion: "6.6.0"
global.sysdig.region: ""
asserts:
- isNull:
path: data.enable_platform_services

- it: "has correct platform services value when onPremCompatibilityVersion is = 6.6.0"
- it: "has correct platform services value when onPremCompatibilityVersion is = 6.6.0 and region supports platform services"
set:
global.sysdig.apiHost: "http://test.com"
onPremCompatibilityVersion: "6.6.0"
global.sysdig.region: "us1"
asserts:
- equal:
path: data.enable_platform_services
Expand All @@ -393,7 +432,6 @@ tests:
path: data.enable_platform_services
value: "true"


- it: "fails if onPremCompatibilityVersion is not a valid semver"
set:
global.sysdig.apiHost: "http://test.com"
Expand Down
4 changes: 2 additions & 2 deletions charts/sysdig-deploy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: sysdig-deploy
description: A chart with various Sysdig components for Kubernetes
type: application
version: 1.25.0
version: 1.25.1
maintainers:
- name: AlbertoBarba
email: [email protected]
Expand Down Expand Up @@ -42,7 +42,7 @@ dependencies:
- name: cluster-scanner
# repository: https://charts.sysdig.com
repository: file://../cluster-scanner
version: ~0.7.2
version: ~0.8.0
alias: clusterScanner
condition: clusterScanner.enabled
- name: kspm-collector
Expand Down
Loading