From 94913b23865991aca35d998e624c5eb541ebee6f Mon Sep 17 00:00:00 2001 From: Starttoaster Date: Thu, 19 Sep 2024 10:26:09 -0700 Subject: [PATCH 1/5] Add kubernetes annotation --- helm/pub-metrics-grafana/values.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helm/pub-metrics-grafana/values.yaml b/helm/pub-metrics-grafana/values.yaml index 50fde9f..f8b8ad8 100644 --- a/helm/pub-metrics-grafana/values.yaml +++ b/helm/pub-metrics-grafana/values.yaml @@ -53,6 +53,10 @@ ingress: hostname: dashboard.chia.net annotations: ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/server-snippet: | + location ~* /(api|admin) { + return 403; + } servicePort: http tls: enabled: true From 33f1b6ee1368caece1073773b2f643325fd7a705 Mon Sep 17 00:00:00 2001 From: Starttoaster Date: Thu, 19 Sep 2024 15:08:51 -0700 Subject: [PATCH 2/5] Try ingress configuration --- .../templates/ingress.yaml | 40 ++++++++++++++++++- helm/pub-metrics-grafana/values.yaml | 4 -- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/helm/pub-metrics-grafana/templates/ingress.yaml b/helm/pub-metrics-grafana/templates/ingress.yaml index bcbcea2..e0a2aba 100644 --- a/helm/pub-metrics-grafana/templates/ingress.yaml +++ b/helm/pub-metrics-grafana/templates/ingress.yaml @@ -20,10 +20,46 @@ spec: - host: {{ .Values.ingress.hostname | quote }} http: paths: - - pathType: Prefix - path: / + - path: /$ + pathType: Exact backend: service: name: {{ $fullName }} port: name: {{ $servicePort }} + - path: /dashboards + pathType: Prefix + backend: + service: + name: {{ $fullName }} + port: + name: {{ $servicePort }} + - path: /d/.* + pathType: Prefix + backend: + service: + name: {{ $fullName }} + port: + name: {{ $servicePort }} + - path: /playlists + pathType: Prefix + backend: + service: + name: {{ $fullName }} + port: + name: {{ $servicePort }} + # Deny /api and /admin by sending them to a non-existent service or returning 404 + - path: /api + pathType: Prefix + backend: + service: + name: dummy-service # Doesn't exist, returns 404 + port: + number: 80 + - path: /admin + pathType: Prefix + backend: + service: + name: dummy-service # Doesn't exist, returns 404 + port: + number: 80 diff --git a/helm/pub-metrics-grafana/values.yaml b/helm/pub-metrics-grafana/values.yaml index f8b8ad8..50fde9f 100644 --- a/helm/pub-metrics-grafana/values.yaml +++ b/helm/pub-metrics-grafana/values.yaml @@ -53,10 +53,6 @@ ingress: hostname: dashboard.chia.net annotations: ingress.kubernetes.io/ssl-redirect: "true" - nginx.ingress.kubernetes.io/server-snippet: | - location ~* /(api|admin) { - return 403; - } servicePort: http tls: enabled: true From 077a399a2f1b19dbb1c173bf736f3537a557f50a Mon Sep 17 00:00:00 2001 From: Starttoaster Date: Thu, 19 Sep 2024 15:16:47 -0700 Subject: [PATCH 3/5] Add annotation --- helm/pub-metrics-grafana/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/helm/pub-metrics-grafana/values.yaml b/helm/pub-metrics-grafana/values.yaml index 50fde9f..d24b36f 100644 --- a/helm/pub-metrics-grafana/values.yaml +++ b/helm/pub-metrics-grafana/values.yaml @@ -53,6 +53,7 @@ ingress: hostname: dashboard.chia.net annotations: ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/use-regex: "true" servicePort: http tls: enabled: true From 5d5dca9c8e2d0947bedaef2af255cb6cb68ff6b5 Mon Sep 17 00:00:00 2001 From: Starttoaster Date: Thu, 19 Sep 2024 15:22:01 -0700 Subject: [PATCH 4/5] Add route back --- helm/pub-metrics-grafana/templates/ingress.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/pub-metrics-grafana/templates/ingress.yaml b/helm/pub-metrics-grafana/templates/ingress.yaml index e0a2aba..e7c8abc 100644 --- a/helm/pub-metrics-grafana/templates/ingress.yaml +++ b/helm/pub-metrics-grafana/templates/ingress.yaml @@ -53,9 +53,9 @@ spec: pathType: Prefix backend: service: - name: dummy-service # Doesn't exist, returns 404 + name: {{ $fullName }} port: - number: 80 + number: {{ $servicePort }} - path: /admin pathType: Prefix backend: From 53042e2ef21ee5f2f858ab6100a67e884db21540 Mon Sep 17 00:00:00 2001 From: Starttoaster Date: Thu, 19 Sep 2024 15:24:11 -0700 Subject: [PATCH 5/5] Fix port name --- helm/pub-metrics-grafana/templates/ingress.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/pub-metrics-grafana/templates/ingress.yaml b/helm/pub-metrics-grafana/templates/ingress.yaml index e7c8abc..41b134a 100644 --- a/helm/pub-metrics-grafana/templates/ingress.yaml +++ b/helm/pub-metrics-grafana/templates/ingress.yaml @@ -55,7 +55,7 @@ spec: service: name: {{ $fullName }} port: - number: {{ $servicePort }} + name: {{ $servicePort }} - path: /admin pathType: Prefix backend: