diff --git a/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml index 54565e98b..bc09fe218 100644 --- a/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/alerts/templates/deployment.yaml @@ -71,13 +71,9 @@ spec: value: '{{ .Values.global.postgresql.postgresqlPassword }}' {{- end}} - name: SITE_URL - value: '{{ ternary "https" "http" .Values.global.ORSecureAccess}}://{{ .Values.global.domainName }}:{{ ternary .Values.global.ingress.controller.service.ports.https .Values.global.ingress.controller.service.ports.http .Values.global.ORSecureAccess }}' + value: '{{- include "openreplay.domainURL" . -}}' - name: S3_HOST - {{- if contains "minio" .Values.global.s3.endpoint }} - value: '{{ ternary "https" "http" .Values.global.ORSecureAccess}}://{{ .Values.global.domainName }}:{{ ternary .Values.global.ingress.controller.service.ports.https .Values.global.ingress.controller.service.ports.http .Values.global.ORSecureAccess }}' - {{- else}} - value: '{{ .Values.global.s3.endpoint }}' - {{- end}} + value: '{{- include "openreplay.s3Endpoint" . }}' - name: S3_KEY {{- if .Values.global.s3.existingSecret }} valueFrom: diff --git a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml index c5f4a5e8f..74edafc7f 100644 --- a/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml +++ b/scripts/helmcharts/openreplay/charts/chalice/templates/deployment.yaml @@ -84,13 +84,9 @@ spec: value: '{{ .Values.global.postgresql.postgresqlPassword }}' {{- end}} - name: SITE_URL - value: '{{ ternary "https" "http" .Values.global.ORSecureAccess}}://{{ .Values.global.domainName }}:{{ ternary .Values.global.ingress.controller.service.ports.https .Values.global.ingress.controller.service.ports.http .Values.global.ORSecureAccess }}' + value: '{{- include "openreplay.domainURL" . }}' - name: S3_HOST - {{- if contains "minio" .Values.global.s3.endpoint }} - value: '{{ ternary "https" "http" .Values.global.ORSecureAccess}}://{{ .Values.global.domainName }}:{{ ternary .Values.global.ingress.controller.service.ports.https .Values.global.ingress.controller.service.ports.http .Values.global.ORSecureAccess }}' - {{- else}} - value: '{{ .Values.global.s3.endpoint }}' - {{- end}} + value: '{{- include "openreplay.s3Endpoint" . }}' - name: S3_KEY {{- if .Values.global.s3.existingSecret }} valueFrom: diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml index e05699285..044e2ddd8 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/report-cron.yaml @@ -55,13 +55,9 @@ spec: value: '{{ .Values.global.postgresql.postgresqlPassword }}' {{- end}} - name: SITE_URL - value: '{{ ternary "https" "http" .Values.global.ORSecureAccess}}://{{ .Values.global.domainName }}:{{ ternary .Values.global.ingress.controller.service.ports.https .Values.global.ingress.controller.service.ports.http .Values.global.ORSecureAccess }}' + value: '{{- include "openreplay.domainURL" . }}' - name: S3_HOST - {{- if contains "minio" .Values.global.s3.endpoint }} - value: 'https://{{ .Values.global.domainName }}:{{ .Values.global.ingress.controller.service.ports.https}}' - {{- else}} - value: '{{ .Values.global.s3.endpoint }}' - {{- end}} + value: '{{- include "openreplay.s3Endpoint" . }}' - name: S3_KEY {{- if .Values.global.s3.existingSecret }} valueFrom: diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml index 81cbadbd6..fdacc234c 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/sessions-cleaner-cron.yaml @@ -55,13 +55,9 @@ spec: value: '{{ .Values.global.postgresql.postgresqlPassword }}' {{- end}} - name: SITE_URL - value: '{{ ternary "https" "http" .Values.global.ORSecureAccess}}://{{ .Values.global.domainName }}:{{ ternary .Values.global.ingress.controller.service.ports.https .Values.global.ingress.controller.service.ports.http .Values.global.ORSecureAccess }}' + value: '{{- include "openreplay.domainURL" . }}' - name: S3_HOST - {{- if contains "minio" .Values.global.s3.endpoint }} - value: 'https://{{ .Values.global.domainName }}:{{ .Values.global.ingress.controller.service.ports.https}}' - {{- else}} - value: '{{ .Values.global.s3.endpoint }}' - {{- end}} + value: '{{- include "openreplay.s3Endpoint" . }}' - name: S3_KEY {{- if .Values.global.s3.existingSecret }} valueFrom: diff --git a/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml b/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml index 71975db8b..6a26e2247 100644 --- a/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml +++ b/scripts/helmcharts/openreplay/charts/utilities/templates/telemetry-cron.yaml @@ -55,13 +55,9 @@ spec: value: '{{ .Values.global.postgresql.postgresqlPassword }}' {{- end}} - name: SITE_URL - value: '{{ ternary "https" "http" .Values.global.ORSecureAccess}}://{{ .Values.global.domainName }}:{{ ternary .Values.global.ingress.controller.service.ports.https .Values.global.ingress.controller.service.ports.http .Values.global.ORSecureAccess }}' + value: '{{- include "openreplay.domainURL" . }}' - name: S3_HOST - {{- if contains "minio" .Values.global.s3.endpoint }} - value: 'https://{{ .Values.global.domainName }}:{{ .Values.global.ingress.controller.service.ports.https}}' - {{- else}} - value: '{{ .Values.global.s3.endpoint }}' - {{- end}} + value: '{{- include "openreplay.s3Endpoint" . }}' - name: S3_KEY {{- if .Values.global.s3.existingSecret }} valueFrom: diff --git a/scripts/helmcharts/openreplay/templates/_helpers.tpl b/scripts/helmcharts/openreplay/templates/_helpers.tpl index 09a5be245..4f2a9ca1b 100644 --- a/scripts/helmcharts/openreplay/templates/_helpers.tpl +++ b/scripts/helmcharts/openreplay/templates/_helpers.tpl @@ -5,6 +5,26 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} {{- end }} +{{/* Get domain name with/without port */}} +{{- define "openreplay.domainURL" -}} +{{- $scheme := ternary "https" "http" .Values.global.ORSecureAccess -}} +{{- $port := ternary .Values.global.ingress.controller.service.ports.https .Values.global.ingress.controller.service.ports.http .Values.global.ORSecureAccess -}} +{{- if or (eq (toString $port) "80") (eq (toString $port) "443") -}} +{{- printf "%s://%s" $scheme .Values.global.domainName -}} +{{- else -}} +{{- printf "%s://%s:%d" $scheme .Values.global.domainName $port -}} +{{- end -}} +{{- end -}} + +{{/* Get the S3 endpoint value */}} +{{- define "openreplay.s3Endpoint" -}} +{{- if contains "minio" .Values.global.s3.endpoint -}} +{{- include "openreplay.domainURL" . -}} +{{- else -}} +{{- .Values.global.s3.endpoint -}} +{{- end -}} +{{- end -}} + {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).