Merge "Update toolkit to support ingress TLS"
This commit is contained in:
commit
469fe37c3e
@ -32,7 +32,12 @@ limitations under the License.
|
||||
{{- $endpointScheme := .scheme }}
|
||||
{{- $endpointHost := index .hosts $endpoint | default .hosts.default }}
|
||||
{{- $endpointClusterHostname := printf "%s.%s.%s" $endpointHost $namespace $clusterSuffix }}
|
||||
{{- if kindIs "map" (index .host_fqdn_override $endpoint) }}
|
||||
{{- $endpointHostname := index .host_fqdn_override $endpoint "host" | default .host_fqdn_override.default | default $endpointClusterHostname }}
|
||||
{{- printf "%s" $endpointHostname -}}
|
||||
{{- else }}
|
||||
{{- $endpointHostname := index .host_fqdn_override $endpoint | default .host_fqdn_override.default | default $endpointClusterHostname }}
|
||||
{{- printf "%s" $endpointHostname -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
@ -38,8 +38,13 @@ limitations under the License.
|
||||
{{- if regexMatch "[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+" $endpointHost }}
|
||||
{{- printf "%s://%s:%1.f%s" $endpointScheme $endpointHost $endpointPort $endpointPath -}}
|
||||
{{- else -}}
|
||||
{{- if kindIs "map" (index .host_fqdn_override $endpoint) }}
|
||||
{{- $endpointFqdnHostname := index .host_fqdn_override $endpoint "host" | default .host_fqdn_override.default | default $endpointClusterHostname }}
|
||||
{{- printf "%s://%s:%1.f%s" $endpointScheme $endpointFqdnHostname $endpointPort $endpointPath -}}
|
||||
{{- else }}
|
||||
{{- $endpointFqdnHostname := index .host_fqdn_override $endpoint | default .host_fqdn_override.default | default $endpointClusterHostname }}
|
||||
{{- printf "%s://%s:%1.f%s" $endpointScheme $endpointFqdnHostname $endpointPort $endpointPath -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
@ -56,18 +56,30 @@ spec:
|
||||
{{ $hostRules | include "helm-toolkit.manifests.ingress._host_rules" | indent 4}}
|
||||
{{- end }}
|
||||
{{- if not ( hasSuffix ( printf ".%s.svc.%s" $envAll.Release.Namespace $envAll.Values.endpoints.cluster_domain_suffix) $hostNameFull) }}
|
||||
{{- range $key2, $ingressController := tuple "namespace" "cluster" }}
|
||||
{{- $hostNameFullRules := dict "vHost" $hostNameFull "backendName" $backendName "backendPort" $backendPort }}
|
||||
{{ $hostNameFullRules | include "helm-toolkit.manifests.ingress._host_rules" | indent 4}}
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ printf "%s-%s" $ingressName "fqdn" }}
|
||||
name: {{ printf "%s-%s-%s" $ingressName $ingressController "fqdn" }}
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: {{ index $envAll.Values.network $backendService "ingress" "classes" "cluster" | quote }}
|
||||
kubernetes.io/ingress.class: {{ index $envAll.Values.network $backendService "ingress" "classes" $ingressController | quote }}
|
||||
{{ toYaml (index $envAll.Values.network $backendService "ingress" "annotations") | indent 4 }}
|
||||
spec:
|
||||
{{- $host := index $envAll.Values.endpoints $backendServiceType "host_fqdn_override" }}
|
||||
{{- if $host.public }}
|
||||
{{- if $host.public.tls }}
|
||||
{{- if and $host.public.tls.key $host.public.tls.crt }}
|
||||
tls:
|
||||
- secretName: {{ index $envAll.Values.secrets "tls" $backendServiceType $backendService "public" }}
|
||||
hosts:
|
||||
- {{ index $hostNameFullRules "vHost" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{ $hostNameFullRules | include "helm-toolkit.manifests.ingress._host_rules" | indent 4}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
41
helm-toolkit/templates/manifests/_secret-tls.yaml.tpl
Normal file
41
helm-toolkit/templates/manifests/_secret-tls.yaml.tpl
Normal file
@ -0,0 +1,41 @@
|
||||
{{/*
|
||||
Copyright 2018 The Openstack-Helm Authors.
|
||||
|
||||
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.
|
||||
*/}}
|
||||
|
||||
{{- define "helm-toolkit.manifests.secret_ingress_tls" }}
|
||||
{{- $envAll := index . "envAll" }}
|
||||
{{- $endpoint := index . "endpoint" | default "public" }}
|
||||
{{- $backendServiceType := index . "backendServiceType" }}
|
||||
{{- $backendService := index . "backendService" | default "api" }}
|
||||
{{- $host := index $envAll.Values.endpoints $backendServiceType "host_fqdn_override" }}
|
||||
{{- if $host.public }}
|
||||
{{- if $host.public.tls }}
|
||||
{{- if and $host.public.tls.key $host.public.tls.crt }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ index $envAll.Values.secrets.tls $backendServiceType $backendService $endpoint }}
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{ $host.public.tls.crt | b64enc }}
|
||||
tls.key: {{ $host.public.tls.key | b64enc }}
|
||||
{{- if $host.public.tls.ca }}
|
||||
tls.ca: {{ $host.public.tls.ca | b64enc }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@ -31,6 +31,8 @@ spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
- name: https
|
||||
port: 443
|
||||
selector:
|
||||
app: ingress-api
|
||||
{{- if index $envAll.Values.endpoints $backendServiceType }}
|
||||
|
Loading…
Reference in New Issue
Block a user