From 9351fb31eb1ecad77500fa60410c12c76d983d75 Mon Sep 17 00:00:00 2001 From: eiximenis Date: Mon, 9 Jul 2018 14:20:27 +0200 Subject: [PATCH] final updates to helm scripts --- k8s/helm/aks-httpaddon-cfg.yaml | 12 +++++++++++ k8s/helm/apigwmm/templates/_names.tpl | 20 ++++++++++--------- k8s/helm/apigwmm/templates/deployment.yaml | 8 +++----- k8s/helm/apigwms/templates/_names.tpl | 19 ++++++++++-------- k8s/helm/apigwms/templates/deployment.yaml | 8 +++----- k8s/helm/apigwwm/templates/_names.tpl | 19 ++++++++++-------- k8s/helm/apigwwm/templates/deployment.yaml | 8 +++----- k8s/helm/apigwws/templates/_names.tpl | 20 ++++++++++--------- k8s/helm/apigwws/templates/deployment.yaml | 8 +++----- k8s/helm/basket-api/templates/_names.tpl | 19 ++++++++++-------- k8s/helm/basket-api/templates/deployment.yaml | 8 +++----- k8s/helm/catalog-api/templates/_names.tpl | 19 ++++++++++-------- .../catalog-api/templates/deployment.yaml | 8 +++----- k8s/helm/deploy-all.ps1 | 19 ++++++++++++++++-- k8s/helm/identity-api/templates/_names.tpl | 20 ++++++++++--------- .../identity-api/templates/deployment.yaml | 8 +++----- k8s/helm/inf.yaml | 4 +--- k8s/helm/locations-api/templates/_names.tpl | 19 ++++++++++-------- .../locations-api/templates/deployment.yaml | 8 +++----- k8s/helm/marketing-api/templates/_names.tpl | 19 ++++++++++-------- .../marketing-api/templates/deployment.yaml | 8 +++----- .../mobileshoppingagg/templates/_names.tpl | 19 ++++++++++-------- .../templates/deployment.yaml | 8 +++----- k8s/helm/ordering-api/templates/_names.tpl | 20 ++++++++++--------- .../ordering-api/templates/deployment.yaml | 8 +++----- .../templates/_names.tpl | 20 ++++++++++--------- .../templates/deployment.yaml | 8 +++----- .../ordering-signalrhub/templates/_names.tpl | 20 ++++++++++--------- .../templates/deployment.yaml | 9 +++------ k8s/helm/payment-api/templates/_names.tpl | 20 ++++++++++--------- .../payment-api/templates/deployment.yaml | 8 +++----- k8s/helm/webmvc/templates/_names.tpl | 19 ++++++++++-------- k8s/helm/webmvc/templates/deployment.yaml | 8 +++----- k8s/helm/webshoppingagg/templates/_names.tpl | 19 ++++++++++-------- .../webshoppingagg/templates/deployment.yaml | 8 +++----- k8s/helm/webspa/templates/_names.tpl | 19 ++++++++++-------- k8s/helm/webspa/templates/deployment.yaml | 8 +++----- k8s/helm/webstatus/templates/_names.tpl | 19 ++++++++++-------- k8s/helm/webstatus/templates/deployment.yaml | 8 +++----- src/Services/Identity/Identity.API/Startup.cs | 1 + 40 files changed, 283 insertions(+), 247 deletions(-) create mode 100644 k8s/helm/aks-httpaddon-cfg.yaml diff --git a/k8s/helm/aks-httpaddon-cfg.yaml b/k8s/helm/aks-httpaddon-cfg.yaml new file mode 100644 index 000000000..b9576b0b6 --- /dev/null +++ b/k8s/helm/aks-httpaddon-cfg.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: +# addonmanager.kubernetes.io/mode: Reconcile + app: addon-http-application-routing-ingress-nginx + kubernetes.io/cluster-service: "true" + name: addon-http-application-routing-nginx-configuration + namespace: kube-system +data: + proxy-buffer-size: "128k" + proxy-buffers: "4 256k" diff --git a/k8s/helm/apigwmm/templates/_names.tpl b/k8s/helm/apigwmm/templates/_names.tpl index c1111b058..a6eeb9965 100644 --- a/k8s/helm/apigwmm/templates/_names.tpl +++ b/k8s/helm/apigwmm/templates/_names.tpl @@ -25,21 +25,15 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} - -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- $name := first .}} {{- $ctx := last .}} {{- if $ctx.Values.inf.k8s.suffix -}} @@ -48,4 +42,12 @@ {{- else -}} {{- printf "/%s" $name -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/apigwmm/templates/deployment.yaml b/k8s/helm/apigwmm/templates/deployment.yaml index 120cb5889..2e30c78e7 100644 --- a/k8s/helm/apigwmm/templates/deployment.yaml +++ b/k8s/helm/apigwmm/templates/deployment.yaml @@ -23,11 +23,9 @@ spec: app: {{ template "apigwmm.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} volumes: - name: config @@ -38,7 +36,7 @@ spec: path: configuration.json containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: config diff --git a/k8s/helm/apigwms/templates/_names.tpl b/k8s/helm/apigwms/templates/_names.tpl index c1111b058..1e840c56c 100644 --- a/k8s/helm/apigwms/templates/_names.tpl +++ b/k8s/helm/apigwms/templates/_names.tpl @@ -25,21 +25,16 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- $name := first .}} {{- $ctx := last .}} {{- if $ctx.Values.inf.k8s.suffix -}} @@ -48,4 +43,12 @@ {{- else -}} {{- printf "/%s" $name -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/apigwms/templates/deployment.yaml b/k8s/helm/apigwms/templates/deployment.yaml index 24519d777..2c8a43050 100644 --- a/k8s/helm/apigwms/templates/deployment.yaml +++ b/k8s/helm/apigwms/templates/deployment.yaml @@ -23,11 +23,9 @@ spec: app: {{ template "apigwms.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} volumes: - name: config @@ -38,7 +36,7 @@ spec: path: configuration.json containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: config diff --git a/k8s/helm/apigwwm/templates/_names.tpl b/k8s/helm/apigwwm/templates/_names.tpl index c1111b058..1e840c56c 100644 --- a/k8s/helm/apigwwm/templates/_names.tpl +++ b/k8s/helm/apigwwm/templates/_names.tpl @@ -25,21 +25,16 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- $name := first .}} {{- $ctx := last .}} {{- if $ctx.Values.inf.k8s.suffix -}} @@ -48,4 +43,12 @@ {{- else -}} {{- printf "/%s" $name -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/apigwwm/templates/deployment.yaml b/k8s/helm/apigwwm/templates/deployment.yaml index ed28de243..1e0e58888 100644 --- a/k8s/helm/apigwwm/templates/deployment.yaml +++ b/k8s/helm/apigwwm/templates/deployment.yaml @@ -23,11 +23,9 @@ spec: app: {{ template "apigwwm.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} volumes: - name: config @@ -38,7 +36,7 @@ spec: path: configuration.json containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: config diff --git a/k8s/helm/apigwws/templates/_names.tpl b/k8s/helm/apigwws/templates/_names.tpl index c1111b058..a6eeb9965 100644 --- a/k8s/helm/apigwws/templates/_names.tpl +++ b/k8s/helm/apigwws/templates/_names.tpl @@ -25,21 +25,15 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} - -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- $name := first .}} {{- $ctx := last .}} {{- if $ctx.Values.inf.k8s.suffix -}} @@ -48,4 +42,12 @@ {{- else -}} {{- printf "/%s" $name -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/apigwws/templates/deployment.yaml b/k8s/helm/apigwws/templates/deployment.yaml index da7b69a5b..b52e77042 100644 --- a/k8s/helm/apigwws/templates/deployment.yaml +++ b/k8s/helm/apigwws/templates/deployment.yaml @@ -23,11 +23,9 @@ spec: app: {{ template "apigwws.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} volumes: - name: config @@ -38,7 +36,7 @@ spec: path: configuration.json containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: - name: config diff --git a/k8s/helm/basket-api/templates/_names.tpl b/k8s/helm/basket-api/templates/_names.tpl index 7e817f9b7..d44859fea 100644 --- a/k8s/helm/basket-api/templates/_names.tpl +++ b/k8s/helm/basket-api/templates/_names.tpl @@ -25,25 +25,28 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/basket-api/templates/deployment.yaml b/k8s/helm/basket-api/templates/deployment.yaml index 911818231..ee283122c 100644 --- a/k8s/helm/basket-api/templates/deployment.yaml +++ b/k8s/helm/basket-api/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "basket-api.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/catalog-api/templates/_names.tpl b/k8s/helm/catalog-api/templates/_names.tpl index 7e817f9b7..d44859fea 100644 --- a/k8s/helm/catalog-api/templates/_names.tpl +++ b/k8s/helm/catalog-api/templates/_names.tpl @@ -25,25 +25,28 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/catalog-api/templates/deployment.yaml b/k8s/helm/catalog-api/templates/deployment.yaml index d508cd3ae..99e270af9 100644 --- a/k8s/helm/catalog-api/templates/deployment.yaml +++ b/k8s/helm/catalog-api/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "catalog-api.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/deploy-all.ps1 b/k8s/helm/deploy-all.ps1 index 4a90387cd..1239cc7af 100644 --- a/k8s/helm/deploy-all.ps1 +++ b/k8s/helm/deploy-all.ps1 @@ -40,7 +40,15 @@ if ($clean) { Write-Host "Previous releases deleted" -ForegroundColor Green } -$useDockerHub = [string]::IsNullOrEmpty($registry) +$useCustomRegistry=$false + +if (-not [string]::IsNullOrEmpty($registry)) { + $useCustomRegistry=$true + if ([string]::IsNullOrEmpty($dockerUser) -or [string]::IsNullOrEmpty($dockerPassword)) { + Write-Host "Error: Must use -dockerUser AND -dockerPassword if specifying custom registry" -ForegroundColor Red + exit 1 + } +} Write-Host "Begin eShopOnContainers installation using Helm" -ForegroundColor Green @@ -56,7 +64,14 @@ if ($deployInfrastructure) { foreach ($chart in $charts) { Write-Host "Installing: $chart" -ForegroundColor Green - helm install --values app.yaml --values inf.yaml --values ingress_values.yaml --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --name="$appName-$chart" $chart + if ($useCustomRegistry) { + helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values ingress_values.yaml --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart + } + else { + if ($chart -ne "eshop-common") { # eshop-common is ignored when no secret must be deployed + helm install --values app.yaml --values inf.yaml --values ingress_values.yaml --set app.name=$appName --set inf.k8s.dns=$dns --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart + } + } } Write-Host "helm charts installed." -ForegroundColor Green diff --git a/k8s/helm/identity-api/templates/_names.tpl b/k8s/helm/identity-api/templates/_names.tpl index 7e817f9b7..39ee485ef 100644 --- a/k8s/helm/identity-api/templates/_names.tpl +++ b/k8s/helm/identity-api/templates/_names.tpl @@ -25,25 +25,27 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} - -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/identity-api/templates/deployment.yaml b/k8s/helm/identity-api/templates/deployment.yaml index 6cd425afd..753725a9f 100644 --- a/k8s/helm/identity-api/templates/deployment.yaml +++ b/k8s/helm/identity-api/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "identity-api.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/inf.yaml b/k8s/helm/inf.yaml index 073e53dd4..4c0180f45 100644 --- a/k8s/helm/inf.yaml +++ b/k8s/helm/inf.yaml @@ -34,9 +34,7 @@ inf: appinsights: key: "" # App insights to use k8s: # inf.k8s defines Kubernetes cluster global config - dns: "" # k8s external IP or DNS. Value MUST BE PROVIDED using --set (--set inf.k8s.dns=my-cluster-dns) - dnsprefix: false # If 'true' DNS values in ingress are prefixed using values.app.name. Note that this requires "externalDNS" to be running in k8s cluster. If true "inf.k8s.suffix" is ignored. - suffix: false # If 'true' URL values in ingress are suffixed using values.app.name. That do not require anything special in cluster and still allows many apps using same ingress controller. Ignored if inf.k8s.dnsprefix is true + dns: "" # k8s external DNS. This value or ip value MUST BE PROVIDED misc: # inf.misc contains miscellaneous configuration related to infrastructure useLoadTest: false # If running under loading test or not useAzureStorage: false # If catalog api uses azure storage or not diff --git a/k8s/helm/locations-api/templates/_names.tpl b/k8s/helm/locations-api/templates/_names.tpl index 7e817f9b7..d44859fea 100644 --- a/k8s/helm/locations-api/templates/_names.tpl +++ b/k8s/helm/locations-api/templates/_names.tpl @@ -25,25 +25,28 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/locations-api/templates/deployment.yaml b/k8s/helm/locations-api/templates/deployment.yaml index 826dd80a1..c8f3f00cd 100644 --- a/k8s/helm/locations-api/templates/deployment.yaml +++ b/k8s/helm/locations-api/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "locations-api.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/marketing-api/templates/_names.tpl b/k8s/helm/marketing-api/templates/_names.tpl index 7e817f9b7..d44859fea 100644 --- a/k8s/helm/marketing-api/templates/_names.tpl +++ b/k8s/helm/marketing-api/templates/_names.tpl @@ -25,25 +25,28 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/marketing-api/templates/deployment.yaml b/k8s/helm/marketing-api/templates/deployment.yaml index 3aa1927e9..e0cbeb3ce 100644 --- a/k8s/helm/marketing-api/templates/deployment.yaml +++ b/k8s/helm/marketing-api/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "marketing-api.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/mobileshoppingagg/templates/_names.tpl b/k8s/helm/mobileshoppingagg/templates/_names.tpl index 7e817f9b7..d44859fea 100644 --- a/k8s/helm/mobileshoppingagg/templates/_names.tpl +++ b/k8s/helm/mobileshoppingagg/templates/_names.tpl @@ -25,25 +25,28 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/mobileshoppingagg/templates/deployment.yaml b/k8s/helm/mobileshoppingagg/templates/deployment.yaml index 6317c99e3..5e81da7bf 100644 --- a/k8s/helm/mobileshoppingagg/templates/deployment.yaml +++ b/k8s/helm/mobileshoppingagg/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "mobileshoppingagg.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/ordering-api/templates/_names.tpl b/k8s/helm/ordering-api/templates/_names.tpl index 7e817f9b7..39ee485ef 100644 --- a/k8s/helm/ordering-api/templates/_names.tpl +++ b/k8s/helm/ordering-api/templates/_names.tpl @@ -25,25 +25,27 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} - -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/ordering-api/templates/deployment.yaml b/k8s/helm/ordering-api/templates/deployment.yaml index 54ab5a6ed..19845c251 100644 --- a/k8s/helm/ordering-api/templates/deployment.yaml +++ b/k8s/helm/ordering-api/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "ordering-api.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/ordering-backgroundtasks/templates/_names.tpl b/k8s/helm/ordering-backgroundtasks/templates/_names.tpl index 7e817f9b7..39ee485ef 100644 --- a/k8s/helm/ordering-backgroundtasks/templates/_names.tpl +++ b/k8s/helm/ordering-backgroundtasks/templates/_names.tpl @@ -25,25 +25,27 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} - -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/ordering-backgroundtasks/templates/deployment.yaml b/k8s/helm/ordering-backgroundtasks/templates/deployment.yaml index 16dc73400..cb57ca18d 100644 --- a/k8s/helm/ordering-backgroundtasks/templates/deployment.yaml +++ b/k8s/helm/ordering-backgroundtasks/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "ordering-backgroundtasks.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/ordering-signalrhub/templates/_names.tpl b/k8s/helm/ordering-signalrhub/templates/_names.tpl index 7e817f9b7..39ee485ef 100644 --- a/k8s/helm/ordering-signalrhub/templates/_names.tpl +++ b/k8s/helm/ordering-signalrhub/templates/_names.tpl @@ -25,25 +25,27 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} - -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/ordering-signalrhub/templates/deployment.yaml b/k8s/helm/ordering-signalrhub/templates/deployment.yaml index 91d2f80ae..af3867ea5 100644 --- a/k8s/helm/ordering-signalrhub/templates/deployment.yaml +++ b/k8s/helm/ordering-signalrhub/templates/deployment.yaml @@ -5,7 +5,6 @@ kind: Deployment metadata: name: {{ template "ordering-signalrhub.fullname" . }} labels: - ufo: {{ $cfgname}} app: {{ template "ordering-signalrhub.name" . }} chart: {{ template "ordering-signalrhub.chart" . }} release: {{ .Release.Name }} @@ -22,15 +21,13 @@ spec: app: {{ template "ordering-signalrhub.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/payment-api/templates/_names.tpl b/k8s/helm/payment-api/templates/_names.tpl index 7e817f9b7..39ee485ef 100644 --- a/k8s/helm/payment-api/templates/_names.tpl +++ b/k8s/helm/payment-api/templates/_names.tpl @@ -25,25 +25,27 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} - -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/payment-api/templates/deployment.yaml b/k8s/helm/payment-api/templates/deployment.yaml index 8863535ba..8b414145f 100644 --- a/k8s/helm/payment-api/templates/deployment.yaml +++ b/k8s/helm/payment-api/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "payment-api.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/webmvc/templates/_names.tpl b/k8s/helm/webmvc/templates/_names.tpl index 7e817f9b7..d44859fea 100644 --- a/k8s/helm/webmvc/templates/_names.tpl +++ b/k8s/helm/webmvc/templates/_names.tpl @@ -25,25 +25,28 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/webmvc/templates/deployment.yaml b/k8s/helm/webmvc/templates/deployment.yaml index 03db384b8..d972db448 100644 --- a/k8s/helm/webmvc/templates/deployment.yaml +++ b/k8s/helm/webmvc/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "webmvc.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/webshoppingagg/templates/_names.tpl b/k8s/helm/webshoppingagg/templates/_names.tpl index 7e817f9b7..d44859fea 100644 --- a/k8s/helm/webshoppingagg/templates/_names.tpl +++ b/k8s/helm/webshoppingagg/templates/_names.tpl @@ -25,25 +25,28 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/webshoppingagg/templates/deployment.yaml b/k8s/helm/webshoppingagg/templates/deployment.yaml index a0f97df5d..9d557b0e0 100644 --- a/k8s/helm/webshoppingagg/templates/deployment.yaml +++ b/k8s/helm/webshoppingagg/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "webshoppingagg.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/webspa/templates/_names.tpl b/k8s/helm/webspa/templates/_names.tpl index 7e817f9b7..d44859fea 100644 --- a/k8s/helm/webspa/templates/_names.tpl +++ b/k8s/helm/webspa/templates/_names.tpl @@ -25,25 +25,28 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/webspa/templates/deployment.yaml b/k8s/helm/webspa/templates/deployment.yaml index 9b3b88962..62af2d8b1 100644 --- a/k8s/helm/webspa/templates/deployment.yaml +++ b/k8s/helm/webspa/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "webspa.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/k8s/helm/webstatus/templates/_names.tpl b/k8s/helm/webstatus/templates/_names.tpl index 7e817f9b7..d44859fea 100644 --- a/k8s/helm/webstatus/templates/_names.tpl +++ b/k8s/helm/webstatus/templates/_names.tpl @@ -25,25 +25,28 @@ {{- define "url-of" -}} {{- $name := first .}} {{- $ctx := last .}} -{{- $suffix := include "suffix-name" $ctx -}} -{{- if $ctx.Values.inf.k8s.dnsprefix -}} -{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} {{/* Value is ./ */}} -{{- else -}} -{{- if $ctx.Values.inf.k8s.suffix -}} -{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} {{/*Value is /- */}} +{{- if eq $name "" -}} +{{- $ctx.Values.inf.k8s.dns -}} {{- else -}} {{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} {{/*Value is just / */}} {{- end -}} {{- end -}} -{{- end -}} -{{ define "pathBase" -}} +{{- define "pathBase" -}} {{- if .Values.inf.k8s.suffix -}} {{- $suffix := include "suffix-name" . -}} {{- printf "%s-%s" .Values.pathBase $suffix -}} {{- else -}} {{- .Values.pathBase -}} {{- end -}} +{{- end -}} + +{{- define "fqdn-image" -}} +{{- if .Values.inf.registry -}} +{{- printf "%s/%s" .Values.inf.registry.server .Values.image.repository -}} +{{- else -}} +{{- .Values.image.repository -}} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/k8s/helm/webstatus/templates/deployment.yaml b/k8s/helm/webstatus/templates/deployment.yaml index 19eed779b..6f96f81fb 100644 --- a/k8s/helm/webstatus/templates/deployment.yaml +++ b/k8s/helm/webstatus/templates/deployment.yaml @@ -22,15 +22,13 @@ spec: app: {{ template "webstatus.name" . }} release: {{ .Release.Name }} spec: - {{ if .Values.imagePullSecrets -}} + {{ if .Values.inf.registry -}} imagePullSecrets: - {{ range .Values.imagePullSecrets -}} - - name: {{ .name }} - {{- end -}} + - name: {{ .Values.inf.registry.secretName }} {{- end }} containers: - name: {{ .Chart.Name }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + image: "{{ template "fqdn-image" . }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: PATH_BASE diff --git a/src/Services/Identity/Identity.API/Startup.cs b/src/Services/Identity/Identity.API/Startup.cs index f564043ae..255bb82b5 100644 --- a/src/Services/Identity/Identity.API/Startup.cs +++ b/src/Services/Identity/Identity.API/Startup.cs @@ -151,6 +151,7 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API await next(); }); + app.UseForwardedHeaders(); // Adds IdentityServer app.UseIdentityServer();