Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions charts/memgraph-high-availability/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{/*
Create the name for mg-exporter resources.
*/}}
{{- define "memgraph.mgExporterName" -}}
{{- printf "%s-mg-exporter" (include "memgraph.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/*
Create the config map name for mg-exporter resources.
*/}}
{{- define "memgraph.mgExporterConfigName" -}}
{{- printf "%s-config" (include "memgraph.mgExporterName" .) | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{- define "container.data.readinessProbe" -}}
{{- $p := .Values.container.data.readinessProbe -}}
readinessProbe:
Expand Down
22 changes: 11 additions & 11 deletions charts/memgraph-high-availability/templates/mg-exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: mg-exporter-config
name: {{ include "memgraph.mgExporterConfigName" $ }}
namespace: {{ $.Values.prometheus.namespace | default $.Release.Namespace }}
data:
ha_config.yaml: |
Expand Down Expand Up @@ -43,23 +43,23 @@ data:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mg-exporter
name: {{ include "memgraph.mgExporterName" $ }}
namespace: {{ $.Values.prometheus.namespace | default $.Release.Namespace }}
labels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" $ }}
spec:
replicas: 1
selector:
matchLabels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" $ }}
template:
metadata:
# Force Deployment rollout when HA exporter inputs change. The exporter
# reads a ConfigMap via subPath, which doesn't refresh in-place.
annotations:
checksum/ha-config: {{ printf "%s-%s-%s" (toJson $.Values.coordinators) (toJson $.Values.data) (toJson $.Values.prometheus.memgraphExporter) | sha256sum }}
labels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" $ }}
spec:
containers:
- name: exporter
Expand All @@ -86,7 +86,7 @@ spec:
volumes:
- name: config-volume
configMap:
name: mg-exporter-config
name: {{ include "memgraph.mgExporterConfigName" $ }}
{{- if and (not $.Values.prometheus.memgraphExporter.tls.skipVerify) $.Values.prometheus.memgraphExporter.tls.caSecretName }}
- name: ca-bundle
secret:
Expand All @@ -99,13 +99,13 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: mg-exporter
name: {{ include "memgraph.mgExporterName" $ }}
namespace: {{ $.Values.prometheus.namespace | default $.Release.Namespace }}
labels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" $ }}
spec:
selector:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" $ }}
ports:
- protocol: TCP
name: tcp-metrics-port
Expand All @@ -116,14 +116,14 @@ spec:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: mg-exporter
name: {{ include "memgraph.mgExporterName" $ }}
namespace: {{ $.Values.prometheus.namespace | default $.Release.Namespace }}
labels:
release: {{ $.Values.prometheus.serviceMonitor.kubePrometheusStackReleaseName }}
spec:
selector:
matchLabels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" $ }}
endpoints:
- port: tcp-metrics-port # must be the same as the service port name
interval: {{ $.Values.prometheus.serviceMonitor.interval }}
Expand Down
14 changes: 14 additions & 0 deletions charts/memgraph/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{/*
Create the name for mg-exporter resources.
*/}}
{{- define "memgraph.mgExporterName" -}}
{{- printf "%s-mg-exporter" (include "memgraph.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/*
Create the config map name for mg-exporter resources.
*/}}
{{- define "memgraph.mgExporterConfigName" -}}
{{- printf "%s-config" (include "memgraph.mgExporterName" .) | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{- define "container.readinessProbe" -}}
readinessProbe:
{{- if .exec }}
Expand Down
22 changes: 11 additions & 11 deletions charts/memgraph/templates/mg-exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: mg-exporter-config
name: {{ include "memgraph.mgExporterConfigName" . }}
namespace: {{ .Values.prometheus.namespace | default .Release.Namespace }}
data:
standalone_config.yaml: |
Expand All @@ -17,19 +17,19 @@ data:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mg-exporter
name: {{ include "memgraph.mgExporterName" . }}
namespace: {{ .Values.prometheus.namespace | default .Release.Namespace }}
labels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" . }}
spec:
replicas: 1
selector:
matchLabels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" . }}
template:
metadata:
labels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" . }}
spec:
containers:
- name: exporter
Expand All @@ -48,18 +48,18 @@ spec:
volumes:
- name: config-volume
configMap:
name: mg-exporter-config
name: {{ include "memgraph.mgExporterConfigName" . }}
---
apiVersion: v1
kind: Service
metadata:
name: mg-exporter
name: {{ include "memgraph.mgExporterName" . }}
namespace: {{ .Values.prometheus.namespace | default .Release.Namespace }}
labels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" . }}
spec:
selector:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" . }}
ports:
- protocol: TCP
name: tcp-metrics-port
Expand All @@ -70,14 +70,14 @@ spec:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: mg-exporter
name: {{ include "memgraph.mgExporterName" . }}
namespace: {{ .Values.prometheus.namespace | default .Release.Namespace }}
labels:
release: {{ .Values.prometheus.serviceMonitor.kubePrometheusStackReleaseName }}
spec:
selector:
matchLabels:
app: mg-exporter
app: {{ include "memgraph.mgExporterName" . }}
endpoints:
- port: tcp-metrics-port # must be the same as the service port name
interval: {{ .Values.prometheus.serviceMonitor.interval }}
Expand Down
Loading