added repo
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
{{- if .Values.httpProxy.enabled -}}
|
||||
{{- if .Values.createContourGateway -}}
|
||||
{{- if or (eq "contour-internal" .Values.ingress.ingressClassName) (eq "contour-internal-0" .Values.ingress.ingressClassName) (eq "contour-internal-1" .Values.ingress.ingressClassName) }}
|
||||
{{- $servicePortNumber := .Values.ingress.servicePortNumber | default 80 -}}
|
||||
{{- $namespace := .Values.namespace -}}
|
||||
|
||||
{{- /* resolve intra ingress class */ -}}
|
||||
{{- $intraIngressClass := "" -}}
|
||||
{{- if eq .Values.ingress.ingressClassName "contour-internal" -}}
|
||||
{{- $intraIngressClass = "contour-internal-intra" -}}
|
||||
{{- else if eq .Values.ingress.ingressClassName "contour-internal-0" -}}
|
||||
{{- $intraIngressClass = "contour-internal-intra-0" -}}
|
||||
{{- else if eq .Values.ingress.ingressClassName "contour-internal-1" -}}
|
||||
{{- $intraIngressClass = "contour-internal-intra-1" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ $count := 0 | int }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
{{- $hasName := hasKey . "name" -}}
|
||||
{{- $proxyName := ternary .intraName (printf "%s-intra-%d" $namespace $count) (hasKey . "intraName") -}}
|
||||
{{- $childProxyName := printf "%s-intra" $namespace -}}
|
||||
apiVersion: projectcontour.io/v1
|
||||
kind: HTTPProxy
|
||||
metadata:
|
||||
namespace: {{ $namespace }}
|
||||
name: {{ $proxyName }}
|
||||
labels:
|
||||
{{- include "bifrost.labels" $ | nindent 4 }}
|
||||
annotations:
|
||||
projectcontour.io/ingress.class: {{ $intraIngressClass }}
|
||||
spec:
|
||||
ingressClassName: {{ $intraIngressClass }}
|
||||
virtualhost:
|
||||
fqdn: "{{ .host }}"
|
||||
|
||||
routes:
|
||||
{{- range .paths }}
|
||||
{{- if hasKey . "backends" }}
|
||||
- conditions:
|
||||
{{- if or (eq (lower .pathType) "prefix") (eq (lower .pathType) "implementationspecific") }}
|
||||
- prefix: {{ .path }}
|
||||
{{- end }}
|
||||
{{- if eq (lower .pathType) "exact" }}
|
||||
- exact: {{ .path }}
|
||||
{{- end }}
|
||||
{{- if eq (lower .pathType) "regex" }}
|
||||
- regex: {{ .path }}
|
||||
{{- end }}
|
||||
{{- if hasKey . "header" }}
|
||||
- header:
|
||||
name: {{ (split "___" .header)._0 }}
|
||||
{{ (split "___" .header)._1 }}: {{ (split "___" .header)._2 }}
|
||||
{{ end }}
|
||||
services:
|
||||
{{ range .backends }}
|
||||
{{- $svc := .service -}}
|
||||
{{- $hasSlash := contains "/" $svc -}}
|
||||
{{- $svcName := ternary (split "/" $svc)._1 $svc $hasSlash -}}
|
||||
{{- $targetNs := ternary .namespace (ternary (split "/" $svc)._0 $namespace $hasSlash) (hasKey . "namespace") -}}
|
||||
{{- $useAlias := ne $targetNs $namespace -}}
|
||||
{{- $aliasName := printf "%s-xns-%s" $svcName $targetNs | trunc 63 | trimSuffix "-" -}}
|
||||
- name: {{ ternary $aliasName $svcName $useAlias }}
|
||||
port: {{ $servicePortNumber }}
|
||||
{{- if .weight }}
|
||||
weight: {{ .weight }}
|
||||
{{- end }}
|
||||
{{- if $.Values.ingress.slowStart.enabled }}
|
||||
slowStartPolicy:
|
||||
window: {{ $.Values.ingress.slowStart.window }}
|
||||
aggression: {{ $.Values.ingress.slowStart.aggression | float64 | squote }}
|
||||
minWeightPercent: {{ $.Values.ingress.slowStart.minPercent }}
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
includes:
|
||||
{{- range .paths }}
|
||||
{{- if not (hasKey . "backends") }}
|
||||
- conditions:
|
||||
{{- if or (eq (lower .pathType) "prefix") (eq (lower .pathType) "implementationspecific") }}
|
||||
- prefix: {{ .path }}
|
||||
{{- end }}
|
||||
{{- if eq (lower .pathType) "exact" }}
|
||||
- exact: {{ .path }}
|
||||
{{- end }}
|
||||
{{- if eq (lower .pathType) "regex" }}
|
||||
- regex: {{ .path }}
|
||||
{{- end }}
|
||||
{{- if eq (lower .pathType) "header" }}
|
||||
- header:
|
||||
name: {{ (split "___" .path)._0 }}
|
||||
{{ (split "___" .path)._1 }}: {{ (split "___" .path)._2 }}
|
||||
{{- end }}
|
||||
{{- if eq (lower .pathType) "prefixheader" }}
|
||||
- prefix: {{ (split "___" .path)._0 }}
|
||||
- header:
|
||||
name: {{ (split "___" .path)._1 }}
|
||||
{{ (split "___" .path)._2 }}: {{ (split "___" .path)._3 }}
|
||||
{{- end }}
|
||||
{{- if .targetService }}
|
||||
name: {{ .targetService | replace "/" "-" }}-intra
|
||||
namespace: {{ (split "/" .targetService)._0 }}
|
||||
{{- else }}
|
||||
name: {{ $childProxyName }}
|
||||
namespace: {{ $namespace }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if not $hasName }}
|
||||
{{ $count = add1 $count }}
|
||||
{{- /* Child Intra HTTPProxy - routes with services */}}
|
||||
apiVersion: projectcontour.io/v1
|
||||
kind: HTTPProxy
|
||||
metadata:
|
||||
namespace: {{ $namespace }}
|
||||
name: {{ $childProxyName }}
|
||||
labels:
|
||||
{{- include "bifrost.labels" $ | nindent 4 }}
|
||||
annotations:
|
||||
projectcontour.io/ingress.class: {{ $intraIngressClass }}
|
||||
spec:
|
||||
ingressClassName: {{ $intraIngressClass }}
|
||||
routes:
|
||||
- services:
|
||||
- name: {{ $namespace }}
|
||||
port: {{ $servicePortNumber | default "80" }}
|
||||
{{- if $.Values.ingress.slowStart.enabled }}
|
||||
slowStartPolicy:
|
||||
window: {{ $.Values.ingress.slowStart.window }}
|
||||
aggression: {{ $.Values.ingress.slowStart.aggression | float64 | squote }}
|
||||
minWeightPercent: {{ $.Values.ingress.slowStart.minPercent }}
|
||||
{{- end }}
|
||||
{{- if $.Values.ingress.enableWebsocket }}
|
||||
enableWebsockets: true
|
||||
{{- end }}
|
||||
{{- if $.Values.contourResponseTimeout }}
|
||||
timeoutPolicy:
|
||||
response: {{ $.Values.contourResponseTimeout }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- else }}
|
||||
{{ $count = add1 $count }}
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
Reference in New Issue
Block a user