ExternalService and Entrypoint-Disable Support (#256)
* Setup externalService processing and enhance Traefik * Simplify Ingress * Simplify External Services * Adjust Service and Portal settings accordingly * Fix some newly introduced bugs * Adapt docs
This commit is contained in:
Binary file not shown.
@@ -1,21 +1,3 @@
|
||||
{{/*
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
`SPDX-License-Identifier: Apache-2.0`
|
||||
|
||||
This file is considered to be modified by the TrueCharts Project.
|
||||
*/}}
|
||||
|
||||
{{/*
|
||||
Renders the Ingress objects required by the chart by returning a concatinated list
|
||||
of the main Ingress and any additionalIngresses.
|
||||
@@ -27,34 +9,35 @@ of the main Ingress and any additionalIngresses.
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- $ingressValues := $ingress -}}
|
||||
|
||||
{{/* set defaults */}}
|
||||
{{- if or (not $ingressValues.nameSuffix) ( ne $name "main" ) -}}
|
||||
{{/* set defaults */}}
|
||||
{{- if and (not $ingressValues.nameSuffix) ( ne $name "main" ) -}}
|
||||
{{- $_ := set $ingressValues "nameSuffix" $name -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
|
||||
{{- if not $ingressValues.type -}}
|
||||
{{- $_ := set $ingressValues "type" "HTTP" -}}
|
||||
{{ end -}}
|
||||
{{- if not $ingressValues.certType -}}
|
||||
{{ end -}}
|
||||
{{- if not $ingressValues.certType -}}
|
||||
{{- $_ := set $ingressValues "certType" "" -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if or ( eq $ingressValues.type "TCP" ) ( eq $ingressValues.type "UDP" ) ( eq $ingressValues.type "HTTP-IR" ) -}}
|
||||
{{- include "common.classes.ingressRoute" $ -}}
|
||||
{{- else -}}
|
||||
{{- include "common.classes.ingress" $ -}}
|
||||
{{ end -}}
|
||||
{{- include "common.classes.ingressRoute" $ -}}
|
||||
{{- else -}}
|
||||
{{- include "common.classes.ingress" $ -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if $ingressValues.authForwardURL -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.classes.ingress.authForward" $ }}
|
||||
{{ end -}}
|
||||
{{- if $ingressValues.authForwardURL -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.classes.ingress.authForward" $ }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if eq $ingressValues.certType "ixcert" -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.resources.cert.secret" $ }}
|
||||
{{ end -}}
|
||||
{{- if eq $ingressValues.certType "ixcert" -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.resources.cert.secret" $ }}
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -65,39 +48,85 @@ of the main Ingress and any additionalIngresses.
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- $ingressValues := $additionalIngress -}}
|
||||
|
||||
{{/* set defaults */}}
|
||||
{{- $name := ( $index | quote ) -}}
|
||||
{{/* set defaults */}}
|
||||
{{- $name := $index -}}
|
||||
{{- if $ingressValues.name -}}
|
||||
{{- $name := $ingressValues.name -}}
|
||||
{{- end }}
|
||||
|
||||
{{- if or (not $ingressValues.nameSuffix) ( ne $name "main" ) -}}
|
||||
{{- if or (not $ingressValues.nameSuffix) ( ne ( $name | quote ) "main" ) -}}
|
||||
{{- $_ := set $ingressValues "nameSuffix" $name -}}
|
||||
{{ end -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
|
||||
{{- if not $ingressValues.type -}}
|
||||
{{- $_ := set $ingressValues "type" "HTTP" -}}
|
||||
{{ end -}}
|
||||
{{- if not $ingressValues.certType -}}
|
||||
{{ end -}}
|
||||
{{- if not $ingressValues.certType -}}
|
||||
{{- $_ := set $ingressValues "certType" "" -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if or ( eq $ingressValues.type "TCP" ) ( eq $ingressValues.type "UDP" ) ( eq $ingressValues.type "HTTP-IR" ) -}}
|
||||
{{- include "common.classes.ingressRoute" $ -}}
|
||||
{{- else -}}
|
||||
{{- include "common.classes.ingress" $ -}}
|
||||
{{ end -}}
|
||||
{{- include "common.classes.ingressRoute" $ -}}
|
||||
{{- else -}}
|
||||
{{- include "common.classes.ingress" $ -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if $ingressValues.authForwardURL -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.classes.ingress.authForward" $ }}
|
||||
{{ end -}}
|
||||
{{- if $ingressValues.authForwardURL -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.classes.ingress.authForward" $ }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if eq $ingressValues.certType "ixcert" -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.resources.cert.secret" $ }}
|
||||
{{ end -}}
|
||||
{{- if eq $ingressValues.certType "ixcert" -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.resources.cert.secret" $ }}
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Generate externalService ingresses as required */ -}}
|
||||
{{- range $index, $externalService := .Values.externalServices }}
|
||||
{{- if $externalService.enabled -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- $ingressValues := $externalService -}}
|
||||
|
||||
{{/* set defaults */}}
|
||||
{{- $name := $index -}}
|
||||
{{- if $ingressValues.name -}}
|
||||
{{- $name := $ingressValues.name -}}
|
||||
{{- end }}
|
||||
{{- $name = printf "%v-%v" "external" $name -}}
|
||||
|
||||
{{- if or (not $ingressValues.nameSuffix) -}}
|
||||
{{- $_ := set $ingressValues "nameSuffix" $name -}}
|
||||
{{ end -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "ingress" $ingressValues) -}}
|
||||
{{- if not $ingressValues.type -}}
|
||||
{{- $_ := set $ingressValues "type" "HTTP" -}}
|
||||
{{ end -}}
|
||||
{{- if not $ingressValues.certType -}}
|
||||
{{- $_ := set $ingressValues "certType" "" -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if or ( eq $ingressValues.type "TCP" ) ( eq $ingressValues.type "UDP" ) ( eq $ingressValues.type "HTTP-IR" ) -}}
|
||||
{{- include "common.classes.ingressRoute" $ -}}
|
||||
{{- else -}}
|
||||
{{- include "common.classes.ingress" $ -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.classes.externalService" $ }}
|
||||
|
||||
{{- if $ingressValues.authForwardURL -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.classes.ingress.authForward" $ }}
|
||||
{{ end -}}
|
||||
|
||||
{{- if eq $ingressValues.certType "ixcert" -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "certHolder" $ingressValues) -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- include "common.resources.cert.secret" $ }}
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
@@ -4,14 +4,15 @@ of the main Service and any additionalServices.
|
||||
*/}}
|
||||
{{- define "common.services" -}}
|
||||
{{- if .Values.services -}}
|
||||
{{- /* Add dict of primary services */ -}}
|
||||
{{- /* Add dict of primary services */ -}}
|
||||
{{- range $name, $service := .Values.services }}
|
||||
{{- if or ( $service.enabled ) ( eq $name "main" ) -}}
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- print ("\n") | nindent 0 -}}
|
||||
{{- $serviceValues := $service -}}
|
||||
{{- /* Dont add name suffix for primary service named "main" */ -}}
|
||||
{{- if or (not $serviceValues.nameSuffix) ( ne $name "main" ) -}}
|
||||
|
||||
{{- /* Dont add name suffix for primary service named "main" */ -}}
|
||||
{{- if and (not $serviceValues.nameSuffix) ( ne $name "main" ) -}}
|
||||
{{- $_ := set $serviceValues "nameSuffix" $name -}}
|
||||
{{ end -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
|
||||
@@ -28,12 +29,13 @@ of the main Service and any additionalServices.
|
||||
{{- print ("---") | nindent 0 -}}
|
||||
{{- $serviceValues := $extraService -}}
|
||||
|
||||
{{- $name := ( $index | quote ) -}}
|
||||
{{- $name := $index -}}
|
||||
{{- if $serviceValues.name -}}
|
||||
{{- $name := $serviceValues.name -}}
|
||||
{{- end }}
|
||||
|
||||
{{- if or (not $serviceValues.nameSuffix) ( ne $name "main" ) -}}
|
||||
{{- /* Dont add name suffix for primary service named "main" */ -}}
|
||||
{{- if and (not $serviceValues.nameSuffix) ( ne ( $name | quote ) "main" ) -}}
|
||||
{{- $_ := set $serviceValues "nameSuffix" $name -}}
|
||||
{{ end -}}
|
||||
{{- $_ := set $ "ObjectValues" (dict "service" $serviceValues) -}}
|
||||
|
||||
@@ -27,11 +27,21 @@ within the common library.
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- $serviceName := include "common.names.fullname" . -}}
|
||||
|
||||
|
||||
{{- if hasKey $values "nameSuffix" -}}
|
||||
{{- $serviceName = printf "%v-%v" $serviceName $values.nameSuffix -}}
|
||||
{{ end -}}
|
||||
{{- $svcType := $values.type | default "" -}}
|
||||
|
||||
{{- $portProtocol := $values.port.type -}}
|
||||
{{- if or ( eq $values.type "HTTP" ) ( eq $values.type "HTTPS" ) ( eq $values.type "TCP" ) -}}
|
||||
{{- $portProtocol = "TCP" -}}
|
||||
{{- else if eq $values.type "UDP" }}
|
||||
{{- $portProtocol = "UDP" -}}
|
||||
{{- end }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
@@ -41,8 +51,11 @@ metadata:
|
||||
{{- if $values.labels }}
|
||||
{{ toYaml $values.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with $values.annotations }}
|
||||
annotations:
|
||||
{{- if eq $svcType "HTTPS" }}
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
{{- end }}
|
||||
{{- with $values.annotations }}
|
||||
{{ toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
|
||||
@@ -29,9 +29,15 @@ Render all the ports and additionalPorts for a Service object.
|
||||
{{- if $ports -}}
|
||||
ports:
|
||||
{{- range $_ := $ports }}
|
||||
{{- $protocol := "" -}}
|
||||
{{- if or ( eq .protocol "HTTP" ) ( eq .protocol "HTTPS" ) }}
|
||||
{{- $protocol = "TCP" -}}
|
||||
{{- else }}
|
||||
{{- $protocol = .protocol | default "TCP" -}}
|
||||
{{- end }}
|
||||
- port: {{ .port }}
|
||||
targetPort: {{ .targetPort | default .name | default "http" }}
|
||||
protocol: {{ .protocol | default "TCP" }}
|
||||
protocol: {{ $protocol | default "TCP" }}
|
||||
name: {{ .name | default "http" }}
|
||||
{{- if (and (eq $.svcType "NodePort") (not (empty .nodePort))) }}
|
||||
nodePort: {{ .nodePort }}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
{{- define "common.classes.externalService" -}}
|
||||
{{- $serviceName := include "common.names.fullname" . -}}
|
||||
{{- $values := .Values -}}
|
||||
{{- $svcPort := 80 }}
|
||||
{{- $ingressService := $.Values }}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.ingress -}}
|
||||
{{- $values = . -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- if hasKey $values "nameSuffix" -}}
|
||||
{{- $serviceName = printf "%v-%v" $serviceName $values.nameSuffix -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- $svcName := $values.serviceName | default $serviceName -}}
|
||||
|
||||
{{- if $values.servicePort }}
|
||||
{{- $svcPort = $values.servicePort -}}
|
||||
{{- end }}
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $svcName }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- if eq ( $values.serviceType | default "" ) "HTTPS" }}
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
{{- end }}
|
||||
{{- with $values.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ports:
|
||||
{{- if eq $values.type "UDP"}}
|
||||
- protocol: UDP
|
||||
port: {{ $values.servicePort }}
|
||||
targetPort: {{ $values.servicePort }}
|
||||
{{- else }}
|
||||
- protocol: TCP
|
||||
port: {{ $values.servicePort }}
|
||||
targetPort: {{ $values.servicePort }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Endpoints
|
||||
metadata:
|
||||
name: {{ $svcName }}
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- with $values.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
subsets:
|
||||
- addresses:
|
||||
- ip: {{ $values.serviceTarget }}
|
||||
ports:
|
||||
- port: {{ $values.servicePort }}
|
||||
|
||||
{{- end }}
|
||||
@@ -5,8 +5,9 @@ within the common library.
|
||||
{{- define "common.classes.ingress" -}}
|
||||
{{- $ingressName := include "common.names.fullname" . -}}
|
||||
{{- $values := .Values -}}
|
||||
{{- $svcPort := 80 }}
|
||||
{{- $ingressService := $.Values }}
|
||||
{{- $svcPort := 80 -}}
|
||||
{{- $portProtocol := "" -}}
|
||||
{{- $ingressService := $.Values -}}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.ingress -}}
|
||||
{{- $values = . -}}
|
||||
@@ -16,11 +17,13 @@ within the common library.
|
||||
{{- if hasKey $values "nameSuffix" -}}
|
||||
{{- $ingressName = printf "%v-%v" $ingressName $values.nameSuffix -}}
|
||||
{{- if and ( $.Values.services ) ( not $values.servicePort ) }}
|
||||
{{- $ingressService := index $.Values.services $values.nameSuffix }}
|
||||
{{- $svcPort = $ingressService.port.port }}
|
||||
{{- $ingressService := index $.Values.services ( $values.nameSuffix | quote ) }}
|
||||
{{- $svcPort = $ingressService.port.port -}}
|
||||
{{- $portProtocol = $ingressService.port.protocol | default "" }}
|
||||
{{ end -}}
|
||||
{{- else if and ( $.Values.services ) ( not $values.servicePort ) }}
|
||||
{{- $svcPort = $.Values.services.main.port.port }}
|
||||
{{- $svcPort = $.Values.services.main.port.port -}}
|
||||
{{- $portProtocol = $.Values.services.main.port.protocol | default "" -}}
|
||||
{{ end -}}
|
||||
|
||||
{{- $svcName := $values.serviceName | default $ingressName -}}
|
||||
@@ -29,6 +32,10 @@ within the common library.
|
||||
{{- $svcPort = $values.servicePort -}}
|
||||
{{- end }}
|
||||
|
||||
{{- if $values.serviceType }}
|
||||
{{- $portProtocol = $values.serviceType -}}
|
||||
{{- end }}
|
||||
|
||||
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
@@ -36,6 +43,9 @@ metadata:
|
||||
labels:
|
||||
{{- include "common.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- if eq $portProtocol "HTTPS" }}
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
||||
{{- end }}
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: {{ $values.entrypoint }}
|
||||
traefik.ingress.kubernetes.io/router.middlewares: traefik-middlewares-chain-public@kubernetescrd{{ if $values.authForwardURL }},{{ $ingressName }}-auth-forward{{ end }}
|
||||
{{- with $values.annotations }}
|
||||
@@ -47,51 +57,45 @@ spec:
|
||||
ingressClassName: {{ $values.ingressClassName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if or ( eq $values.certType "selfsigned") (eq $values.certType "ixcert") ( $values.tls ) }}
|
||||
{{- if or ( eq $values.certType "selfsigned") (eq $values.certType "ixcert") }}
|
||||
tls:
|
||||
{{- if $values.tls }}
|
||||
{{- range $values.tls }}
|
||||
- hosts:
|
||||
{{- if and ( not .hosts ) ( not .hostsTpl ) }}
|
||||
{{- if $values.host}}
|
||||
- {{ $values.host | quote }}
|
||||
{{- else }}
|
||||
{{- range $values.hosts }}
|
||||
- {{ .host | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- range .hostsTpl }}
|
||||
- {{ tpl . $ | quote }}
|
||||
{{- end }}
|
||||
{{- if .secretNameTpl }}
|
||||
secretName: {{ tpl .secretNameTpl $ | quote}}
|
||||
{{- else if eq $values.certType "ixcert" }}
|
||||
secretName: {{ $ingressName }}
|
||||
{{- else if .secretName }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- if eq $values.certType "ixcert" }}
|
||||
secretName: {{ $ingressName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
- hosts:
|
||||
{{- range $values.hosts }}
|
||||
- {{ .host | quote }}
|
||||
{{- end }}
|
||||
{{- if eq $values.certType "ixcert" }}
|
||||
secretName: {{ $ingressName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range $values.hosts }}
|
||||
{{- if .hostTpl }}
|
||||
- host: {{ tpl .hostTpl $ | quote }}
|
||||
{{- else }}
|
||||
- host: {{ .host | quote }}
|
||||
{{- end }}
|
||||
{{- if $values.host }}
|
||||
- host: {{ $values.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
- path: {{ $values.path | default "/" }}
|
||||
{{- if eq (include "common.capabilities.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
||||
pathType: Prefix
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if eq (include "common.capabilities.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
||||
service:
|
||||
name: {{ $svcName }}
|
||||
port:
|
||||
number: {{ $svcPort }}
|
||||
{{- else }}
|
||||
serviceName: {{ $svcName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $values.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ .path | default "/" }}
|
||||
{{- if eq (include "common.capabilities.ingress.apiVersion" $) "networking.k8s.io/v1" }}
|
||||
pathType: Prefix
|
||||
{{- end }}
|
||||
@@ -105,6 +109,5 @@ spec:
|
||||
serviceName: {{ $svcName }}
|
||||
servicePort: {{ $svcPort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -6,6 +6,7 @@ within the common library.
|
||||
{{- $ingressName := include "common.names.fullname" . -}}
|
||||
{{- $values := .Values -}}
|
||||
{{- $svcPort := 80 }}
|
||||
{{- $portProtocol := "" }}
|
||||
{{- $ingressService := $.Values }}
|
||||
{{- if hasKey . "ObjectValues" -}}
|
||||
{{- with .ObjectValues.ingress -}}
|
||||
@@ -16,17 +17,23 @@ within the common library.
|
||||
{{- if hasKey $values "nameSuffix" -}}
|
||||
{{- $ingressName = printf "%v-%v" $ingressName $values.nameSuffix -}}
|
||||
{{- if and ( $.Values.services ) ( not $values.servicePort ) }}
|
||||
{{- $ingressService := index $.Values.services $values.nameSuffix }}
|
||||
{{- $ingressService := index $.Values.services ( $values.nameSuffix | quote) }}
|
||||
{{- $svcPort = $ingressService.port.port }}
|
||||
{{- $portProtocol = $ingressService.port.protocol | default "" }}
|
||||
{{ end -}}
|
||||
{{- else if and ( $.Values.services ) ( not $values.servicePort ) }}
|
||||
{{- $svcPort = $.Values.services.main.port.port }}
|
||||
{{- $portProtocol = $.Values.services.main.port.protocol | default "" }}
|
||||
{{ end -}}
|
||||
|
||||
{{- $svcName := $values.serviceName | default $ingressName -}}
|
||||
|
||||
{{- if $values.servicePort }}
|
||||
{{- $svcPort = $values.servicePort -}}
|
||||
{{- $svcPort = $values.servicePort }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $values.serviceType }}
|
||||
{{- $portProtocol = $values.serviceType }}
|
||||
{{- end }}
|
||||
|
||||
apiVersion: traefik.containo.us/v1alpha1
|
||||
@@ -63,7 +70,7 @@ spec:
|
||||
terminationDelay: 400
|
||||
{{- else }}
|
||||
- kind: Rule
|
||||
match: Host(`{{ (index $values.hosts 0).host }}`)
|
||||
match: Host(`{{ (index $values.hosts 0).host }}`) && PathPrefix(`{{ (index $values.hosts 0).path | default "/" }}`)
|
||||
services:
|
||||
- name: {{ $svcName }}
|
||||
{{- if $values.serviceKind }}
|
||||
@@ -87,35 +94,8 @@ spec:
|
||||
{{- range $values.hosts }}
|
||||
- {{ .host | quote }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $values.tls }}
|
||||
{{- range $values.tls }}
|
||||
|
||||
{{- if .hosts }}
|
||||
- main: {{ index .hosts 0 }}
|
||||
{{- range .hosts }}
|
||||
sans:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .hosts }}
|
||||
- main: {{ index .hostsTpl 0 }}
|
||||
{{- range .hosts }}
|
||||
sans:
|
||||
{{- range .hostsTpl }}
|
||||
- {{ tpl . $ | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if eq $values.certType "ixcert" }}
|
||||
secretName: {{ $ingressName }}
|
||||
{{- if eq $values.certType "ixcert" }}
|
||||
secretName: {{ $ingressName }}
|
||||
{{- end }}
|
||||
passthrough: false
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ Ports included by the controller.
|
||||
{{/* append the ports for each appAdditionalService - TrueCharts */}}
|
||||
{{- if $.Values.services -}}
|
||||
{{- range $name, $_ := $.Values.services }}
|
||||
{{- if or ( .enabled ) ( eq $name "main" ) -}}
|
||||
{{- if eq $name "main" -}}
|
||||
{{- $_ := set .port "name" (default "http" .port.name) -}}
|
||||
{{- if or ( .enabled ) ( eq $name "main" ) -}}
|
||||
{{- if eq $name "main" -}}
|
||||
{{- $_ := set .port "name" (default "http" .port.name) -}}
|
||||
{{- else if kindIs "string" $name -}}
|
||||
{{- $_ := set .port "name" (default .port.name | default $name) -}}
|
||||
{{- else -}}
|
||||
@@ -59,12 +59,18 @@ Ports included by the controller.
|
||||
{{- if $ports -}}
|
||||
ports:
|
||||
{{- range $_ := $ports }}
|
||||
{{- $protocol := "" -}}
|
||||
{{- if or ( eq .protocol "HTTP" ) ( eq .protocol "HTTPS" ) }}
|
||||
{{- $protocol = "TCP" -}}
|
||||
{{- else }}
|
||||
{{- $protocol = .protocol | default "TCP" -}}
|
||||
{{- end }}
|
||||
- name: {{ required "The port's 'name' is not defined" .name }}
|
||||
{{- if and .targetPort (kindIs "string" .targetPort) }}
|
||||
{{- fail (printf "Our charts do not support named ports for targetPort. (port name %s, targetPort %s)" .name .targetPort) }}
|
||||
{{- end }}
|
||||
containerPort: {{ .targetPort | default .port }}
|
||||
protocol: {{ .protocol | default "TCP" }}
|
||||
protocol: {{ $protocol | default "TCP" }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -5,16 +5,17 @@
|
||||
{{- $host := "$node_ip" }}
|
||||
{{- $port := 443 }}
|
||||
{{- $protocol := "https" }}
|
||||
{{- $portProtocol := "" }}
|
||||
|
||||
{{- if hasKey .Values "ingress" }}
|
||||
{{- if hasKey .Values.ingress "main" -}}
|
||||
{{- if .Values.ingress.main.host }}
|
||||
{{- $host = .Values.ingress.main.host }}
|
||||
{{- else }}
|
||||
{{- range .Values.ingress.main.hosts }}
|
||||
{{- if .hostTpl }}
|
||||
{{- $host = ( tpl .hostTpl $ | quote ) }}
|
||||
{{- else }}
|
||||
{{- $host = ( .host | quote ) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -24,12 +25,15 @@
|
||||
{{- if hasKey .Values.services "main" }}
|
||||
{{- if and (hasKey .Values.services.main.port "nodePort" ) ( eq .Values.services.main.type "NodePort" ) }}
|
||||
{{- $port = .Values.services.main.port.nodePort }}
|
||||
{{- if or ( eq .Values.services.main.port.protocol "HTTP" ) ( eq .Values.services.main.port.protocol "HTTPS" ) }}
|
||||
{{- $portProtocol = .Values.services.main.port.protocol }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and (.Values.portal.nodePortProtocol ) ( eq $host "$node_ip" ) }}
|
||||
{{- $protocol = .Values.portal.nodePortProtocol }}
|
||||
{{- if and ( $portProtocol ) ( eq $host "$node_ip" ) }}
|
||||
{{- $protocol = $portProtocol }}
|
||||
{{- else if and ( ne $host "$node_ip" ) }}
|
||||
{{- if .Values.ingress.main.certType }}
|
||||
{{- if eq .Values.ingress.main.certType "" }}
|
||||
|
||||
@@ -193,21 +193,7 @@ additionalServices: []
|
||||
# labels: {}
|
||||
# hosts:
|
||||
# - host: chart-example.local
|
||||
# ## Or a tpl that is evaluated
|
||||
# # hostTpl: '{{ include "common.names.fullname" . }}.{{ .Release.Namespace }}.{{ .Values.ingress.domainname }}'
|
||||
# paths:
|
||||
# - path: /
|
||||
# # Ignored if not kubeVersion >= 1.14-0
|
||||
# pathType: Prefix
|
||||
# tls: []
|
||||
# # - secretName: chart-example-tls
|
||||
# ## Or if you need a dynamic secretname
|
||||
# # - secretNameTpl: '{{ include "common.names.fullname" . }}-ingress'
|
||||
# # hosts:
|
||||
# # - chart-example.local
|
||||
# ## Or a tpl that is evaluated
|
||||
# # hostsTpl:
|
||||
# # - '{{ include "common.names.fullname" . }}.{{ .Release.Namespace }}.{{ .Values.ingress.domainname }}'
|
||||
# path: /
|
||||
# additionalIngresses: []
|
||||
# - enabled: false
|
||||
# nameSuffix: "api"
|
||||
|
||||
Reference in New Issue
Block a user