Skip to content

Commit

Permalink
add include_path support (#26)
Browse files Browse the repository at this point in the history
* add include_path support

* add new line
  • Loading branch information
LeoQuote authored Jun 29, 2022
1 parent 061ad80 commit c01c82c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/redirect/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.2.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
10 changes: 9 additions & 1 deletion charts/redirect/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ metadata:
{{- with $.Values.globalConfigs.ingressCommonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if .include_path }}
nginx.ingress.kubernetes.io/rewrite-target: {{ .destination }}/$1
{{- else }}
nginx.ingress.kubernetes.io/configuration-snippet: |
return 302 {{ .destination }};
{{- end }}
spec:
ingressClassName: {{ $.Values.globalConfigs.ingressClassName }}
rules:
Expand All @@ -26,11 +30,15 @@ spec:
name: does-not-exist
port:
number: 80
{{- if .include_path }}
path: "/(.*)$"
{{- else }}
path: /
{{- end }}
pathType: ImplementationSpecific
tls:
- hosts:
- {{ .source }}
secretName: redirect-{{ .source }}-tls-cert

{{- end }}
{{- end }}
8 changes: 7 additions & 1 deletion charts/redirect/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@ globalConfigs:

websites:
- name: test
source: foo.example.douban
source: foo.example.com
destination: https://bar.example.com
# if include_path is enabled , redirect with path in original url
# foo.example.com/123 will be redirect to https://bar.example.com/123
# - name: test
# source: foo.example.com
# destination: https://bar.example.com
# include_path: true

0 comments on commit c01c82c

Please sign in to comment.