Ingress: support arbitary hostnames.
This PS allows arbitary hostnames to be used for public endpoints, provided the resolve externally to the ingress controllers. Change-Id: I44411687f756968d00178d487af66c2393e6bde0
This commit is contained in:
parent
58c297b336
commit
6971143048
@ -149,8 +149,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
|
@ -62,8 +62,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
port: 8777
|
port: 8777
|
||||||
node_port:
|
node_port:
|
||||||
|
@ -246,8 +246,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
|
@ -54,8 +54,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
node_port:
|
node_port:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
@ -286,8 +286,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
nginx.ingress.kubernetes.io/proxy-body-size: "1024M"
|
nginx.ingress.kubernetes.io/proxy-body-size: "1024M"
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
@ -297,8 +299,10 @@ network:
|
|||||||
registry:
|
registry:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
|
@ -40,8 +40,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
|
@ -250,8 +250,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
@ -260,8 +262,10 @@ network:
|
|||||||
cfn:
|
cfn:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
node_port:
|
node_port:
|
||||||
enabled: false
|
enabled: false
|
||||||
@ -269,8 +273,10 @@ network:
|
|||||||
cloudwatch:
|
cloudwatch:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
node_port:
|
node_port:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
@ -19,6 +19,19 @@ limitations under the License.
|
|||||||
# {- $ingressOpts := dict "envAll" . "backendServiceType" "key-manager" -}
|
# {- $ingressOpts := dict "envAll" . "backendServiceType" "key-manager" -}
|
||||||
# { $ingressOpts | include "helm-toolkit.manifests.ingress" }
|
# { $ingressOpts | include "helm-toolkit.manifests.ingress" }
|
||||||
|
|
||||||
|
{{- define "helm-toolkit.manifests.ingress._host_rules" -}}
|
||||||
|
{{- $vHost := index . "vHost" -}}
|
||||||
|
{{- $backendName := index . "backendName" -}}
|
||||||
|
{{- $backendPort := index . "backendPort" -}}
|
||||||
|
- host: {{ $vHost }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
backend:
|
||||||
|
serviceName: {{ $backendName }}
|
||||||
|
servicePort: {{ $backendPort }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
{{- define "helm-toolkit.manifests.ingress" -}}
|
{{- define "helm-toolkit.manifests.ingress" -}}
|
||||||
{{- $envAll := index . "envAll" -}}
|
{{- $envAll := index . "envAll" -}}
|
||||||
{{- $backendService := index . "backendService" | default "api" -}}
|
{{- $backendService := index . "backendService" | default "api" -}}
|
||||||
@ -27,7 +40,6 @@ limitations under the License.
|
|||||||
{{- $ingressName := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
{{- $ingressName := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
||||||
{{- $backendName := tuple $backendServiceType "internal" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
{{- $backendName := tuple $backendServiceType "internal" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
||||||
{{- $hostName := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
{{- $hostName := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
||||||
{{- $hostNameNamespaced := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}
|
|
||||||
{{- $hostNameFull := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" }}
|
{{- $hostNameFull := tuple $backendServiceType "public" $envAll | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" }}
|
||||||
---
|
---
|
||||||
apiVersion: extensions/v1beta1
|
apiVersion: extensions/v1beta1
|
||||||
@ -35,29 +47,27 @@ kind: Ingress
|
|||||||
metadata:
|
metadata:
|
||||||
name: {{ $ingressName }}
|
name: {{ $ingressName }}
|
||||||
annotations:
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: {{ index $envAll.Values.network $backendService "ingress" "classes" "namespace" | quote }}
|
||||||
{{ toYaml (index $envAll.Values.network $backendService "ingress" "annotations") | indent 4 }}
|
{{ toYaml (index $envAll.Values.network $backendService "ingress" "annotations") | indent 4 }}
|
||||||
spec:
|
spec:
|
||||||
rules:
|
rules:
|
||||||
{{ if ne $hostNameNamespaced $hostNameFull }}
|
{{- range $key1, $vHost := tuple $hostName (printf "%s.%s" $hostName $envAll.Release.Namespace) (printf "%s.%s.svc.%s" $hostName $envAll.Release.Namespace $envAll.Values.endpoints.cluster_domain_suffix)}}
|
||||||
{{- range $key1, $vHost := tuple $hostName $hostNameNamespaced $hostNameFull }}
|
{{- $hostRules := dict "vHost" $vHost "backendName" $backendName "backendPort" $backendPort }}
|
||||||
- host: {{ $vHost }}
|
{{ $hostRules | include "helm-toolkit.manifests.ingress._host_rules" | indent 4}}
|
||||||
http:
|
|
||||||
paths:
|
|
||||||
- path: /
|
|
||||||
backend:
|
|
||||||
serviceName: {{ $backendName }}
|
|
||||||
servicePort: {{ $backendPort }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- else }}
|
{{- if not ( hasSuffix ( printf ".%s.svc.%s" $envAll.Release.Namespace $envAll.Values.endpoints.cluster_domain_suffix) $hostNameFull) }}
|
||||||
{{- range $key1, $vHost := tuple $hostName $hostNameNamespaced }}
|
{{- $hostNameFullRules := dict "vHost" $hostNameFull "backendName" $backendName "backendPort" $backendPort }}
|
||||||
- host: {{ $vHost }}
|
{{ $hostNameFullRules | include "helm-toolkit.manifests.ingress._host_rules" | indent 4}}
|
||||||
http:
|
---
|
||||||
paths:
|
apiVersion: extensions/v1beta1
|
||||||
- path: /
|
kind: Ingress
|
||||||
backend:
|
metadata:
|
||||||
serviceName: {{ $backendName }}
|
name: {{ $ingressName }}
|
||||||
servicePort: {{ $backendPort }}
|
annotations:
|
||||||
|
kubernetes.io/ingress.class: {{ index $envAll.Values.network $backendService "ingress" "classes" "cluster" | quote }}
|
||||||
|
{{ toYaml (index $envAll.Values.network $backendService "ingress" "annotations") | indent 4 }}
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
{{ $hostNameFullRules | include "helm-toolkit.manifests.ingress._host_rules" | indent 4}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- end }}
|
|
||||||
|
@ -40,8 +40,10 @@ network:
|
|||||||
dashboard:
|
dashboard:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
|
@ -111,6 +111,11 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
|
annotations:
|
||||||
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
node_port:
|
node_port:
|
||||||
enabled: false
|
enabled: false
|
||||||
port: 30511
|
port: 30511
|
||||||
|
@ -60,8 +60,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
|
@ -125,8 +125,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
|
@ -57,8 +57,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
node_port:
|
node_port:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
@ -109,8 +109,10 @@ network:
|
|||||||
server:
|
server:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
|
@ -133,8 +133,10 @@ network:
|
|||||||
port: 8774
|
port: 8774
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
@ -144,8 +146,10 @@ network:
|
|||||||
port: 8775
|
port: 8775
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
external_policy_local: false
|
external_policy_local: false
|
||||||
node_port:
|
node_port:
|
||||||
@ -155,8 +159,10 @@ network:
|
|||||||
port: 8778
|
port: 8778
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
node_port:
|
node_port:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
@ -138,8 +138,10 @@ network:
|
|||||||
api:
|
api:
|
||||||
ingress:
|
ingress:
|
||||||
public: true
|
public: true
|
||||||
|
classes:
|
||||||
|
namespace: "nginx"
|
||||||
|
cluster: "nginx-cluster"
|
||||||
annotations:
|
annotations:
|
||||||
kubernetes.io/ingress.class: "nginx"
|
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /
|
nginx.ingress.kubernetes.io/rewrite-target: /
|
||||||
node_port:
|
node_port:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
Loading…
Reference in New Issue
Block a user