Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix: use pathType ImplementationSpecific for regex" #279

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 36 additions & 21 deletions charts/devlake/templates/ingresses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ metadata:
labels:
{{- include "devlake.labels" . | nindent 4 }}
annotations:
{{- if .Values.ingress.useDefaultNginx }}
nginx.ingress.kubernetes.io/rewrite-target: /$2
{{- end}}
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand All @@ -53,7 +56,31 @@ spec:
- host: {{ .Values.ingress.hostname | quote }}
http:
paths:
{{- if .Values.grafana.enabled }}
{{- if .Values.ingress.useDefaultNginx }}
- path: /{{ include "devlake.grafanaEndpointPrefix" . }}(/|$)(.*)
{{- else }}
- path: /{{ include "devlake.grafanaEndpointPrefix" . }}
{{- end }}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ .Values.grafana.ingressServiceName | default ( include "grafana.fullname" (dict "Values" .Values.grafana "Chart" (dict "Name" "grafana") "Release" .Release ) ) }}
port:
number: {{ .Values.grafana.ingressServicePort | default .Values.grafana.service.port }}
{{- else }}
serviceName: {{ .Values.grafana.ingressServiceName | default ( include "grafana.fullname" (dict "Values" .Values.grafana "Chart" (dict "Name" "grafana") "Release" .Release ) ) }}
servicePort: {{ .Values.grafana.ingressServicePort | default .Values.grafana.service.port }}
{{- end }}
{{- end }}
{{- if .Values.ingress.useDefaultNginx }}
- path: /{{ include "devlake.uiEndpointPrefix" . }}(/?|$)(.*)
{{- else }}
- path: /{{ include "devlake.uiEndpointPrefix" . }}
{{- end}}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
pathType: Prefix
{{- end }}
Expand All @@ -70,6 +97,7 @@ spec:
{{- if .Values.ingress.extraPaths }}
{{- toYaml .Values.ingress.extraPaths | nindent 10 }}
{{- end }}
{{- if and .Values.ingress.useDefaultNginx (not .Values.grafana.enabled) }}
---
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
Expand All @@ -80,17 +108,12 @@ apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-grafana
name: {{ $fullName }}-ext-grafana
labels:
{{- include "devlake.labels" . | nindent 4 }}
annotations:
{{- if .Values.ingress.useDefaultNginx }}
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$2
{{- end}}
{{- if not .Values.ingress.enabled }}
nginx.ingress.kubernetes.io/permanent-redirect: {{ .Values.grafana.external.url }}
{{- end }}
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand All @@ -108,27 +131,19 @@ spec:
- host: {{ .Values.ingress.hostname | quote }}
http:
paths:
{{- if .Values.ingress.useDefaultNginx }}
- path: /{{ include "devlake.grafanaEndpointPrefix" . }}(/|$)(.*)
{{- else }}
- path: /{{ include "devlake.grafanaEndpointPrefix" . }}
{{- end }}
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
{{- if .Values.ingress.useDefaultNginx }}
pathType: ImplementationSpecific
{{- else }}
pathType: Prefix
{{- end }}
{{- end }}
# dummy in case of external grafana (redirect 308)
backend:
backend: # dummy to config-ui, actual 302 forearding for external grafana
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ .Values.grafana.ingressServiceName | default ( include "grafana.fullname" (dict "Values" .Values.grafana "Chart" (dict "Name" "grafana") "Release" .Release ) ) }}
name: {{ $uiServiceName }}
port:
number: {{ .Values.grafana.ingressServicePort | default .Values.grafana.service.port }}
number: 4000
{{- else }}
serviceName: {{ .Values.grafana.ingressServiceName | default ( include "grafana.fullname" (dict "Values" .Values.grafana "Chart" (dict "Name" "grafana") "Release" .Release ) ) }}
servicePort: {{ .Values.grafana.ingressServicePort | default .Values.grafana.service.port }}
serviceName: {{ $uiServiceName }}
servicePort: 4000
{{- end }}
{{- end -}}
{{- end }}
{{- end }}
Loading