diff --git a/charts/redirect/Chart.yaml b/charts/redirect/Chart.yaml index 1cf52d3..43e4334 100644 --- a/charts/redirect/Chart.yaml +++ b/charts/redirect/Chart.yaml @@ -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 diff --git a/charts/redirect/templates/ingress.yaml b/charts/redirect/templates/ingress.yaml index 35ff6f7..8fcd16c 100644 --- a/charts/redirect/templates/ingress.yaml +++ b/charts/redirect/templates/ingress.yaml @@ -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: @@ -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 }} \ No newline at end of file +{{- end }} diff --git a/charts/redirect/values.yaml b/charts/redirect/values.yaml index 568ffcb..fcd0619 100644 --- a/charts/redirect/values.yaml +++ b/charts/redirect/values.yaml @@ -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