diff --git a/charts/shield/templates/common/_regions.tpl b/charts/shield/templates/common/_regions.tpl index 4117648e2..9a213199c 100644 --- a/charts/shield/templates/common/_regions.tpl +++ b/charts/shield/templates/common/_regions.tpl @@ -179,11 +179,21 @@ {{- end }} {{- define "common.collector_endpoint" }} - {{- $regions := fromYaml (include "common.regions" .) }} - {{- if ne "custom" .Values.sysdig_endpoint.region }} - {{- get (get $regions .Values.sysdig_endpoint.region) "collector_endpoint" }} - {{- else }} + {{- if .Values.sysdig_endpoint.collector.host }} {{- .Values.sysdig_endpoint.collector.host }} + {{- else }} + {{- if ne "custom" .Values.sysdig_endpoint.region }} + {{- $regions := fromYaml (include "common.regions" .) }} + {{- get (get $regions .Values.sysdig_endpoint.region) "collector_endpoint" }} + {{- end }} + {{- end }} +{{- end }} + +{{- define "common.collector_port" }} + {{- if .Values.sysdig_endpoint.collector.port }} + {{- .Values.sysdig_endpoint.collector.port }} + {{- else }} + 6443 {{- end }} {{- end }} diff --git a/charts/shield/tests/common/regions_test.yaml b/charts/shield/tests/common/regions_test.yaml index 67e878274..227ba6d03 100644 --- a/charts/shield/tests/common/regions_test.yaml +++ b/charts/shield/tests/common/regions_test.yaml @@ -4,23 +4,26 @@ templates: release: name: release-name namespace: shield-namespace -values: - - ../values/base.yaml tests: - it: Sanity check for regions set: + cluster_config: + name: test-cluster sysdig_endpoint: + access_key: 12345678-1234-1234-1234-123456789012 region: "eu1" asserts: - matchRegex: path: data["dragent.yaml"] pattern: | collector: ingest-eu1.app.sysdig.com - collector_port: 6443 - it: API endpoint validation set: + cluster_config: + name: test-cluster sysdig_endpoint: + access_key: 12345678-1234-1234-1234-123456789012 region: "us1" asserts: - matchRegex: diff --git a/charts/shield/tests/host/configmap-dragent-yaml_test.yaml b/charts/shield/tests/host/configmap-dragent-yaml_test.yaml index febb8ecc6..899375493 100644 --- a/charts/shield/tests/host/configmap-dragent-yaml_test.yaml +++ b/charts/shield/tests/host/configmap-dragent-yaml_test.yaml @@ -1107,6 +1107,18 @@ tests: pattern: | collector_port: 1234 + - it: Validate collector endpoing can be overridden for region if provided + set: + sysdig_endpoint: + region: us1 + collector: + host: ingest-alt-us1.app.sysdig.com + asserts: + - matchRegex: + path: data['dragent.yaml'] + pattern: | + collector: ingest-alt-us1.app.sysdig.com + - it: Check prometheus.yaml key is created when needed set: features: