Browse Source

Updating ingress templates to use .values.inf.k8s.dns value instead of values.ingress.hosts

Updating names template to allow generation of external url values using dns prefix
pull/867/head
eiximenis 6 years ago
parent
commit
519ecc5897
12 changed files with 52 additions and 51 deletions
  1. +0
    -1
      k8s/helm/app.yaml
  2. +8
    -4
      k8s/helm/basket-api/templates/_names.tpl
  3. +2
    -6
      k8s/helm/basket-api/templates/ingress.yaml
  4. +8
    -4
      k8s/helm/catalog-api/templates/_names.tpl
  5. +2
    -6
      k8s/helm/catalog-api/templates/ingress.yaml
  6. +8
    -4
      k8s/helm/identity-api/templates/_names.tpl
  7. +2
    -6
      k8s/helm/identity-api/templates/ingress.yaml
  8. +2
    -0
      k8s/helm/inf.yaml
  9. +8
    -4
      k8s/helm/ordering-api/templates/_names.tpl
  10. +2
    -6
      k8s/helm/ordering-api/templates/ingress.yaml
  11. +8
    -4
      k8s/helm/ordering-backgroundtasks/templates/_names.tpl
  12. +2
    -6
      k8s/helm/ordering-backgroundtasks/templates/ingress.yaml

+ 0
- 1
k8s/helm/app.yaml View File

@ -5,7 +5,6 @@
app: # app global settings
name: "my-eshop" # Override for custom app name
ingress: # ingress related settings
suffix: false # if true ingress endpoints are suffixed with .Values.appName value (or .Release.Name if the 1st do not exist)
entries:
basket: basket-api # ingress entry for basket api
catalog: catalog-api # ingress entry for catalog api


+ 8
- 4
k8s/helm/basket-api/templates/_names.tpl View File

@ -17,18 +17,22 @@
{{- define "url-of" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if $ctx.Values.app.ingress.suffix -}}
{{- $suffix := include "suffix-name" $ctx -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}}
{{- if $ctx.Values.inf.k8s.dnsprefix -}}
{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} # Value is <prefix>.<dns>/<name>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}}
{{- if $ctx.Values.inf.k8s.suffix -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} # Value is <dns>/<name>-<sufix>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} # Value is just <dns>/<name>
{{- end -}}
{{- end -}}
{{- end -}}
{{ define "pathBase" -}}
{{- if .Values.app.ingress.suffix -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}


+ 2
- 6
k8s/helm/basket-api/templates/ingress.yaml View File

@ -19,20 +19,16 @@ spec:
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
- host: {{ .Values.inf.k8s.dns }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}

+ 8
- 4
k8s/helm/catalog-api/templates/_names.tpl View File

@ -17,18 +17,22 @@
{{- define "url-of" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if $ctx.Values.app.ingress.suffix -}}
{{- $suffix := include "suffix-name" $ctx -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}}
{{- if $ctx.Values.inf.k8s.dnsprefix -}}
{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} # Value is <prefix>.<dns>/<name>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}}
{{- if $ctx.Values.inf.k8s.suffix -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} # Value is <dns>/<name>-<sufix>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} # Value is just <dns>/<name>
{{- end -}}
{{- end -}}
{{- end -}}
{{ define "pathBase" -}}
{{- if .Values.app.ingress.suffix -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}


+ 2
- 6
k8s/helm/catalog-api/templates/ingress.yaml View File

@ -19,20 +19,16 @@ spec:
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
- host: {{ .Values.inf.k8s.dns }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}

+ 8
- 4
k8s/helm/identity-api/templates/_names.tpl View File

@ -17,18 +17,22 @@
{{- define "url-of" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if $ctx.Values.app.ingress.suffix -}}
{{- $suffix := include "suffix-name" $ctx -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}}
{{- if $ctx.Values.inf.k8s.dnsprefix -}}
{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} # Value is <prefix>.<dns>/<name>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}}
{{- if $ctx.Values.inf.k8s.suffix -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} # Value is <dns>/<name>-<sufix>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} # Value is just <dns>/<name>
{{- end -}}
{{- end -}}
{{- end -}}
{{ define "pathBase" -}}
{{- if .Values.app.ingress.suffix -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}


+ 2
- 6
k8s/helm/identity-api/templates/ingress.yaml View File

@ -19,20 +19,16 @@ spec:
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
- host: {{ .Values.inf.k8s.dns }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}

+ 2
- 0
k8s/helm/inf.yaml View File

@ -28,6 +28,8 @@ inf:
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: true # 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
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

+ 8
- 4
k8s/helm/ordering-api/templates/_names.tpl View File

@ -17,18 +17,22 @@
{{- define "url-of" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if $ctx.Values.app.ingress.suffix -}}
{{- $suffix := include "suffix-name" $ctx -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}}
{{- if $ctx.Values.inf.k8s.dnsprefix -}}
{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} # Value is <prefix>.<dns>/<name>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}}
{{- if $ctx.Values.inf.k8s.suffix -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} # Value is <dns>/<name>-<sufix>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} # Value is just <dns>/<name>
{{- end -}}
{{- end -}}
{{- end -}}
{{ define "pathBase" -}}
{{- if .Values.app.ingress.suffix -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}


+ 2
- 6
k8s/helm/ordering-api/templates/ingress.yaml View File

@ -19,20 +19,16 @@ spec:
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
- host: {{ .Values.inf.k8s.dns }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}

+ 8
- 4
k8s/helm/ordering-backgroundtasks/templates/_names.tpl View File

@ -17,18 +17,22 @@
{{- define "url-of" -}}
{{- $name := first .}}
{{- $ctx := last .}}
{{- if $ctx.Values.app.ingress.suffix -}}
{{- $suffix := include "suffix-name" $ctx -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}}
{{- if $ctx.Values.inf.k8s.dnsprefix -}}
{{- printf "%s.%s/%s" $suffix $ctx.Values.inf.k8s.dns $name -}} # Value is <prefix>.<dns>/<name>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}}
{{- if $ctx.Values.inf.k8s.suffix -}}
{{- printf "%s/%s-%s" $ctx.Values.inf.k8s.dns $name $suffix -}} # Value is <dns>/<name>-<sufix>
{{- else -}}
{{- printf "%s/%s" $ctx.Values.inf.k8s.dns $name -}} # Value is just <dns>/<name>
{{- end -}}
{{- end -}}
{{- end -}}
{{ define "pathBase" -}}
{{- if .Values.app.ingress.suffix -}}
{{- if .Values.inf.k8s.suffix -}}
{{- $suffix := include "suffix-name" . -}}
{{- printf "%s-%s" .Values.pathBase $suffix -}}
{{- else -}}


+ 2
- 6
k8s/helm/ordering-backgroundtasks/templates/ingress.yaml View File

@ -19,20 +19,16 @@ spec:
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . }}
{{- end }}
- {{ .Values.inf.k8s.dns }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
- host: {{ .Values.inf.k8s.dns }}
http:
paths:
- path: {{ $ingressPath }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}

Loading…
Cancel
Save