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/0xERR0R/blocky
- https://github.com/Mozart409/blocky-frontend - https://github.com/Mozart409/blocky-frontend
- https://hub.docker.com/r/spx01/blocky - https://hub.docker.com/r/spx01/blocky
version: 1.0.6 version: 1.0.7
annotations: annotations:
truecharts.org/catagories: | truecharts.org/catagories: |
- network - network

View File

@ -31,19 +31,6 @@ questions:
schema: schema:
type: string type: string
default: "http://127.0.0.1:4000" 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 - variable: overrideDefaults
group: Container Configuration group: Container Configuration
label: Override Default Upstreams label: Override Default Upstreams
@ -842,6 +829,7 @@ questions:
default: 568 default: 568
# Include{podSecurityContextAdvanced} # Include{podSecurityContextAdvanced}
# Include{resources} # Include{resources}
# Include{metrics}
# Include{advanced} # Include{advanced}
# Include{addons} # Include{addons}
# Include{documentation} # Include{documentation}

View File

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

View File

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

View File

@ -34,7 +34,7 @@ volumeSpec:
{{- $_ := set .Values.podAnnotations "prometheus.io/scrape" "true" -}} {{- $_ := set .Values.podAnnotations "prometheus.io/scrape" "true" -}}
{{- $_ := set .Values.podAnnotations "prometheus.io/path" "/metrics" -}} {{- $_ := 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 -}} {{- if .Values.webUI.enabled -}}
{{- $_ := set .Values.additionalContainers "frontend" (include "blocky.frontend" . | fromYaml) -}} {{- $_ := 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 - name: tls_servername
value: cloudflare-dns.com 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: redis:
enabled: true enabled: true
existingSecret: "rediscreds" existingSecret: "rediscreds"