File tree Expand file tree Collapse file tree 4 files changed +59
-4
lines changed
Expand file tree Collapse file tree 4 files changed +59
-4
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ type: application
1515# This is the chart version. This version number should be incremented each time you make changes
1616# to the chart and its templates, including the app version.
1717# Versions are expected to follow Semantic Versioning (https://semver.org/)
18- version : 0.2 .0
18+ version : 1.0 .0
1919
2020# This is the version number of the application being deployed. This version number should be
2121# incremented each time you make changes to the application. Versions are not expected to
Original file line number Diff line number Diff line change 1+ {{- $root := . }}
2+ {{- if $root.Values.globalConfigs.routeEnabled }}
3+ {{- range .Values.websites }}
4+ ---
5+ apiVersion : gateway.networking.k8s.io/v1
6+ kind : HTTPRoute
7+ metadata :
8+ name : {{ include "redirect.fullname" $root }}-{{ .name }}
9+ labels :
10+ {{- with $root.Values.globalConfigs.routeCommonLabels }}
11+ {{- toYaml . | nindent 4 }}
12+ {{- end}}
13+ {{- include "redirect.labels" $root | nindent 4 }}
14+ {{- with $root.Values.globalConfigs.routeCommonAnnotations }}
15+ annotations :
16+ {{- toYaml . | nindent 4 }}
17+ {{- end }}
18+ spec :
19+ {{- with $root.Values.globalConfigs.routeParentRefs }}
20+ parentRefs :
21+ {{- toYaml . | nindent 4 }}
22+ {{- end }}
23+ hostnames :
24+ - {{ .source | quote }}
25+ rules :
26+ - filters :
27+ - type : RequestRedirect
28+ requestRedirect :
29+ scheme : {{ .scheme | default "https" }}
30+ statusCode : {{ .statusCode | default 301 }}
31+ hostname : {{ .destination | quote }}
32+ {{- if not .include_path }}
33+ path :
34+ type : ReplaceFullPath
35+ replaceFullPath : {{ .path | default "/" | quote }}
36+ {{- end }}
37+ {{- end }}
38+ {{- end }}
Original file line number Diff line number Diff line change 1+ {{- $root := . -}}
2+ {{- if $root.Values.globalConfigs.ingressEnabled }}
13{{- range .Values.websites }}
4+ {{- $fullDestination := .destination }}
5+ {{- $scheme := .scheme | default "https" }}
6+ {{- $path := .path | default "" }}
7+ {{- $fullDestination = printf "%s://%s%s" $scheme .destination $path }}
28---
39apiVersion : networking.k8s.io/v1
410kind : Ingress
@@ -14,10 +20,10 @@ metadata:
1420 {{- toYaml . | nindent 4 }}
1521 {{- end }}
1622{{- if .include_path }}
17- nginx.ingress.kubernetes.io/rewrite-target : {{ .destination }}/$1
23+ nginx.ingress.kubernetes.io/rewrite-target : {{ $fullDestination }}/$1
1824{{- else }}
1925 nginx.ingress.kubernetes.io/configuration-snippet : |
20- return 302 {{ .destination }};
26+ return 302 {{ $fullDestination }};
2127{{- end }}
2228spec :
2329 ingressClassName : {{ $.Values.globalConfigs.ingressClassName }}
4248 secretName : redirect-{{ .source }}-tls-cert
4349
4450{{- end }}
51+ {{- end }}
Original file line number Diff line number Diff line change @@ -6,15 +6,25 @@ nameOverride: ""
66fullnameOverride : " "
77
88globalConfigs :
9+ ingressEnabled : true
910 ingressClassName : " nginx"
1011 ingressCommonLabels : {}
1112 ingressCommonAnnotations : {}
1213 # cert-manager.io/cluster-issuer: your-issuer
14+ routeEnabled : false
15+ routeCommonLabels : {}
16+ routeCommonAnnotations : {}
17+ routeParentRefs :
18+ - name : your-gateway
19+ namespace : your-gateway-namespace
1320
1421websites :
1522- name : test
1623 source : foo.example.com
17- destination : https://bar.example.com
24+ destination : bar.example.com
25+ scheme : https
26+ statusCode : 301
27+ path : /test
1828# if include_path is enabled , redirect with path in original url
1929# foo.example.com/123 will be redirect to https://bar.example.com/123
2030# - name: test
You can’t perform that action at this time.
0 commit comments