fix(blocky): fix GUI apiurl and prometheus metrics (#3908)

* chore(blocky): bump blocky

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

* Update _webui.tpl

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

* Create servicemonitor.yaml

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

* Update common.yaml

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

* Update _blockyConfig.tpl

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

* Update questions.yaml

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

* Update values.yaml

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

* Create prometheusrules.yaml

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

* Update common.yaml

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

* Update _blockyConfig.tpl

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>

Signed-off-by: Kjeld Schouten-Lebbing <kjeld@schouten-lebbing.nl>
This commit is contained in:
Kjeld Schouten-Lebbing 2022-09-26 13:35:03 +02:00 committed by GitHub
parent 9b5c5ed8cd
commit 61731554e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 73 additions and 18 deletions

View File

@ -26,7 +26,7 @@ sources:
- https://github.com/0xERR0R/blocky
- https://github.com/Mozart409/blocky-frontend
- https://hub.docker.com/r/spx01/blocky
version: 1.0.6
version: 1.0.7
annotations:
truecharts.org/catagories: |
- network

View File

@ -31,19 +31,6 @@ questions:
schema:
type: string
default: "http://127.0.0.1:4000"
- variable: blocky
group: Container Configuration
label: Blocky Configuration
schema:
additional_attrs: true
type: dict
attrs:
- variable: enablePrometheus
label: Enable Prometheus Endpoint
description: Enables Prometheus Endpoint
schema:
type: boolean
default: true
- variable: overrideDefaults
group: Container Configuration
label: Override Default Upstreams
@ -842,6 +829,7 @@ questions:
default: 568
# Include{podSecurityContextAdvanced}
# Include{resources}
# Include{metrics}
# Include{advanced}
# Include{addons}
# Include{documentation}

View File

@ -22,11 +22,9 @@ redis:
required: true
connectionAttempts: 10
connectionCooldown: 3s
{{- if .Values.blocky.enablePrometheus }}
prometheus:
enable: true
path: /metrics
{{- end }}
upstream:
default:
{{- .Values.defaultUpstreams | toYaml | nindent 8 }}

View File

@ -36,12 +36,12 @@ startupProbe:
env:
- name: NODE_ENV
value: "production"
{{- $url := .Values.webUI.apiURL }}
{{- if .Values.ingress.main.enabled }}
{{- with (first .Values.ingress.main.hosts) }}
{{- $url = ( printf "https://%s" .host ) }}
{{- end }}
{{- else }}
{{- $url = .Values.webUI.apiURL }}
{{- end }}
- name: API_URL
value: "{{ $url }}"

View File

@ -34,7 +34,7 @@ volumeSpec:
{{- $_ := set .Values.podAnnotations "prometheus.io/scrape" "true" -}}
{{- $_ := set .Values.podAnnotations "prometheus.io/path" "/metrics" -}}
{{- $_ := set .Values.podAnnotations "prometheus.io/port" (.Values.service.http.ports.http.targetPort | toString) -}}
{{- $_ := set .Values.podAnnotations "prometheus.io/port" (.Values.service.http.ports.http.port | toString) -}}
{{- if .Values.webUI.enabled -}}
{{- $_ := set .Values.additionalContainers "frontend" (include "blocky.frontend" . | fromYaml) -}}

View File

@ -0,0 +1,18 @@
{{- if and .Values.metrics.enabled .Values.metrics.prometheusRule.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ include "tc.common.names.fullname" . }}
labels:
{{- include "tc.common.labels" . | nindent 4 }}
{{- with .Values.metrics.prometheusRule.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
groups:
- name: {{ include "tc.common.names.fullname" . }}
rules:
{{- with .Values.metrics.prometheusRule.rules }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,24 @@
{{- if .Values.metrics.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "tc.common.names.fullname" . }}
labels:
{{- include "tc.common.labels" . | nindent 4 }}
{{- with .Values.metrics.serviceMonitor.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
{{- include "tc.common.labels.selectorLabels" . | nindent 6 }}
endpoints:
- port: {{ .Values.service.http.ports.http.port }}
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
path: /metrics
{{- end }}

View File

@ -347,6 +347,33 @@ k8sgateway:
- name: tls_servername
value: cloudflare-dns.com
metrics:
# -- Enable and configure a Prometheus serviceMonitor for the chart under this key.
# @default -- See values.yaml
enabled: false
serviceMonitor:
interval: 1m
scrapeTimeout: 30s
labels: {}
# -- Enable and configure Prometheus Rules for the chart under this key.
# @default -- See values.yaml
prometheusRule:
enabled: false
labels: {}
# -- Configure additionial rules for the chart under this key.
# @default -- See prometheusrules.yaml
rules:
[]
# - alert: UnifiPollerAbsent
# annotations:
# description: Unifi Poller has disappeared from Prometheus service discovery.
# summary: Unifi Poller is down.
# expr: |
# absent(up{job=~".*unifi-poller.*"} == 1)
# for: 5m
# labels:
# severity: critical
redis:
enabled: true
existingSecret: "rediscreds"