Remove two subfilter URL rewriting rules from grafana nginx config

With the switch from AngularJS to ReactJS, grafana is now using
/absolute/url style hrefs in its templates and its JavaScript assets,
but these URLs are passed directly into React's clientside routing
engine rather than hitting the proxy on the backend. Thus, rewriting
these URLs is inappropriate, confuses the clientside router, and breaks
interlink between several tabs in the UI, and a few dashboards, among
other things.

Attempts to address #2445
pull/2448/head
Nicholas Flynt 2023-02-28 15:06:17 -05:00
parent 154e745ead
commit 0abb957377
4 changed files with 14 additions and 18 deletions

View File

@ -52,7 +52,6 @@ data:
sub_filter_types application/json; sub_filter_types application/json;
sub_filter_once off; sub_filter_once off;
sub_filter '"url":"/d' '"url":"d';
} }
location /api/live/ { location /api/live/ {
@ -76,7 +75,6 @@ data:
sub_filter_once off; sub_filter_once off;
sub_filter '"appSubUrl":""' '"appSubUrl":"/k8s/clusters/{{ .Values.global.cattle.clusterId }}/api/v1/namespaces/{{ template "grafana.namespace" . }}/services/http:{{ template "grafana.fullname" . }}:{{ .Values.service.port }}/proxy"'; sub_filter '"appSubUrl":""' '"appSubUrl":"/k8s/clusters/{{ .Values.global.cattle.clusterId }}/api/v1/namespaces/{{ template "grafana.namespace" . }}/services/http:{{ template "grafana.fullname" . }}:{{ .Values.service.port }}/proxy"';
sub_filter '"url":"/' '"url":"./';
sub_filter ':"/avatar/' ':"avatar/'; sub_filter ':"/avatar/' ':"avatar/';
if ($request_filename ~ .*\.(?:js|css|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$) { if ($request_filename ~ .*\.(?:js|css|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$) {

View File

@ -33,13 +33,10 @@
{{/* vim: set filetype=mustache: */}} {{/* vim: set filetype=mustache: */}}
{{/* {{/*
Expand the name of the chart. Expand the name of the chart.
@@ -125,6 +154,17 @@ @@ -128,6 +157,17 @@
{{- print "rbac.authorization.k8s.io/v1" -}} {{- end -}}
{{- else -}} {{- end -}}
{{- print "rbac.authorization.k8s.io/v1beta1" -}}
+ {{- end -}}
+{{- end -}}
+
+{{/* +{{/*
+Return the appropriate apiVersion for HorizontalPodAutoscaler. +Return the appropriate apiVersion for HorizontalPodAutoscaler.
+*/}} +*/}}
@ -48,6 +45,9 @@
+ {{- print "autoscaling/v2" -}} + {{- print "autoscaling/v2" -}}
+ {{- else if .Capabilities.APIVersions.Has "autoscaling/v1" }} + {{- else if .Capabilities.APIVersions.Has "autoscaling/v1" }}
+ {{- print "autoscaling/v1" -}} + {{- print "autoscaling/v1" -}}
{{- end -}} + {{- end -}}
{{- end -}} +{{- end -}}
+
{{/*
Return the appropriate apiVersion for ingress.
*/}}

View File

@ -23,9 +23,8 @@
spec: spec:
privileged: false privileged: false
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
@@ -47,5 +42,4 @@ @@ -48,4 +43,3 @@
- min: 1
max: 65535 max: 65535
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
-{{- end }}
{{- end }} {{- end }}
-{{- end }}

View File

@ -7,9 +7,8 @@
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodSecurityPolicy kind: PodSecurityPolicy
metadata: metadata:
@@ -27,5 +26,4 @@ @@ -28,4 +27,3 @@
- projected
- csi - csi
- secret - secret
-{{- end }}
{{- end }} {{- end }}
-{{- end }}