diff --git a/helm-chart/templates/04-hub-deployment.yaml b/helm-chart/templates/04-hub-deployment.yaml index 29a13b8cb..8cf8ea39c 100644 --- a/helm-chart/templates/04-hub-deployment.yaml +++ b/helm-chart/templates/04-hub-deployment.yaml @@ -44,7 +44,7 @@ spec: fieldRef: fieldPath: metadata.namespace - name: SENTRY_ENABLED - value: '{{ .Values.tap.sentry.enabled }}' + value: '{{ (include "sentry.enabled" .) }}' - name: SENTRY_ENVIRONMENT value: '{{ .Values.tap.sentry.environment }}' - name: KUBESHARK_CLOUD_API_URL diff --git a/helm-chart/templates/06-front-deployment.yaml b/helm-chart/templates/06-front-deployment.yaml index 5e1c66302..6536a9024 100644 --- a/helm-chart/templates/06-front-deployment.yaml +++ b/helm-chart/templates/06-front-deployment.yaml @@ -63,7 +63,7 @@ spec: - name: REACT_APP_DISSECTORS_UPDATING_ENABLED value: '{{ .Values.dissectorsUpdatingEnabled | ternary "true" "false" }}' - name: REACT_APP_SENTRY_ENABLED - value: '{{ .Values.tap.sentry.enabled }}' + value: '{{ (include "sentry.enabled" .) }}' - name: REACT_APP_SENTRY_ENVIRONMENT value: '{{ .Values.tap.sentry.environment }}' {{- if .Values.tap.docker.overrideTag.front }} diff --git a/helm-chart/templates/09-worker-daemon-set.yaml b/helm-chart/templates/09-worker-daemon-set.yaml index 385459a63..f1db6ae4c 100644 --- a/helm-chart/templates/09-worker-daemon-set.yaml +++ b/helm-chart/templates/09-worker-daemon-set.yaml @@ -110,6 +110,10 @@ spec: value: 'https://api.kubeshark.co' - name: PROFILING_ENABLED value: '{{ .Values.tap.pprof.enabled }}' + - name: SENTRY_ENABLED + value: '{{ (include "sentry.enabled" .) }}' + - name: SENTRY_ENVIRONMENT + value: '{{ .Values.tap.sentry.environment }}' resources: limits: cpu: {{ .Values.tap.resources.sniffer.limits.cpu }} @@ -210,7 +214,7 @@ spec: - name: PROFILING_ENABLED value: '{{ .Values.tap.pprof.enabled }}' - name: SENTRY_ENABLED - value: '{{ .Values.tap.sentry.enabled }}' + value: '{{ (include "sentry.enabled" .) }}' - name: SENTRY_ENVIRONMENT value: '{{ .Values.tap.sentry.environment }}' resources: diff --git a/helm-chart/templates/_helpers.tpl b/helm-chart/templates/_helpers.tpl index 048e3c150..887a6cc7c 100644 --- a/helm-chart/templates/_helpers.tpl +++ b/helm-chart/templates/_helpers.tpl @@ -73,3 +73,16 @@ Create docker tag default version {{- end }} {{- $defaultVersion }} {{- end -}} + +{{/* +Set sentry based on internet connectivity and telemetry +*/}} +{{- define "sentry.enabled" -}} + {{- $sentryEnabledVal := .Values.tap.sentry.enabled -}} + {{- if not .Values.internetConnectivity -}} + {{- $sentryEnabledVal = false -}} + {{- else if not .Values.tap.telemetry.enabled -}} + {{- $sentryEnabledVal = false -}} + {{- end -}} + {{- $sentryEnabledVal -}} +{{- end -}}