Skip to content

Commit f395bf3

Browse files
authored
chore(grafana): support ha (#110)
1 parent 9ff2715 commit f395bf3

5 files changed

Lines changed: 31 additions & 2 deletions

File tree

addons/grafana/10/chart/grafana/templates/configmap-ini.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ metadata:
1313
{{- end }}
1414
data:
1515
grafana.ini: |
16+
[unified_alerting]
17+
enabled = true
18+
ha_listen_address = "${POD_IP}:9094"
19+
ha_peers = "{{ include "common.names.fullname" . }}:9094"
20+
ha_advertise_address = "${POD_IP}:9094"
21+
ha_peer_timeout = 15s
22+
ha_reconnect_timeout = 2m
1623
[database]
1724
type = postgres
1825
url = {{ .Values.pg_url | quote }}

addons/grafana/10/chart/grafana/templates/deployment.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ spec:
128128
name: {{ include "common.tplvalues.render" (dict "value" .Values.grafana.extraEnvVarsSecret "context" $) }}
129129
{{- end }}
130130
env:
131+
- name: POD_IP
132+
valueFrom:
133+
fieldRef:
134+
fieldPath: status.podIP
131135
- name: GF_SECURITY_ADMIN_PASSWORD
132136
valueFrom:
133137
secretKeyRef:
@@ -217,6 +221,12 @@ spec:
217221
- name: dashboard
218222
containerPort: {{ .Values.grafana.containerPorts.grafana }}
219223
protocol: TCP
224+
- name: gossip-tcp
225+
containerPort: {{ .Values.grafana.containerPorts.gossipTCP }}
226+
protocol: TCP
227+
- name: gossip-udp
228+
containerPort: {{ .Values.grafana.containerPorts.gossipUDP }}
229+
protocol: UDP
220230
{{- if .Values.grafana.customLivenessProbe }}
221231
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.grafana.customLivenessProbe "context" $) | nindent 12 }}
222232
{{- else if .Values.grafana.livenessProbe.enabled }}

addons/grafana/10/chart/grafana/templates/service.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ spec:
4545
targetPort: dashboard
4646
protocol: TCP
4747
name: http
48+
- port: {{ .Values.service.ports.gossipTCP }}
49+
targetPort: gossip-tcp
50+
protocol: TCP
51+
name: gossip-tcp
52+
- port: {{ .Values.service.ports.gossipUDP }}
53+
targetPort: gossip-udp
54+
protocol: UDP
55+
name: gossip-udp
4856
{{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.grafana)) }}
4957
nodePort: {{ .Values.service.nodePorts.grafana }}
5058
{{- else if eq .Values.service.type "ClusterIP" }}

addons/grafana/10/chart/grafana/values.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ grafana:
318318
##
319319
containerPorts:
320320
grafana: 3000
321+
gossipTCP: 9094
322+
gossipUDP: 9094
321323
## Node affinity preset
322324
## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity
323325
## @param grafana.nodeAffinityPreset.type Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard`
@@ -586,6 +588,8 @@ service:
586588
##
587589
ports:
588590
grafana: 3000
591+
gossipTCP: 9094
592+
gossipUDP: 9094
589593
## @param service.nodePorts.grafana Specify the nodePort value for the LoadBalancer and NodePort service types
590594
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
591595
##
@@ -733,7 +737,7 @@ ingress:
733737
metrics:
734738
## @param metrics.enabled Enable the export of Prometheus metrics
735739
##
736-
enabled: false
740+
enabled: true
737741
## Prometheus Operator ServiceMonitor configuration
738742
## @param metrics.service.annotations [object] Annotations for Prometheus metrics service
739743
##

addons/grafana/10/meta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tags: grafana
1313
bindable: true
1414
instances_retrievable: true
1515
bindings_retrievable: true
16-
plan_updateable: false
16+
plan_updateable: true
1717
allow_parameters:
1818
- name: "networkPolicy.allowNamespaces"
1919
required: false

0 commit comments

Comments
 (0)