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

fix: use pathType ImplementationSpecific for regex #272

Merged
merged 2 commits 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: 21 additions & 36 deletions charts/devlake/templates/ingresses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ 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 @@ -56,31 +53,7 @@ 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 @@ -97,7 +70,6 @@ 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 @@ -108,12 +80,17 @@ apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-ext-grafana
name: {{ $fullName }}-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 @@ -131,19 +108,27 @@ 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 }}
backend: # dummy to config-ui, actual 302 forearding for external grafana
{{- end }}
# dummy in case of external grafana (redirect 308)
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $uiServiceName }}
name: {{ .Values.grafana.ingressServiceName | default ( include "grafana.fullname" (dict "Values" .Values.grafana "Chart" (dict "Name" "grafana") "Release" .Release ) ) }}
port:
number: 4000
number: {{ .Values.grafana.ingressServicePort | default .Values.grafana.service.port }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have the value garafana.service.port in the values.yaml file. Since this is the default, coul you kindly add it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guilhem if you could kindly take a look into this, the rest is looking great and I'm happy to approve it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JorgeGar I replied here #272 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good then :) Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the exact same behavior not to change everything at once :)

Theses values come from grafana chart as dependancy.

{{- else }}
serviceName: {{ $uiServiceName }}
servicePort: 4000
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 }}
{{- end }}
{{- end -}}
Loading