diff --git a/charts/polkadot-watcher/templates/_helpers.tpl b/charts/polkadot-watcher/templates/_helpers.tpl new file mode 100644 index 0000000..c0f364f --- /dev/null +++ b/charts/polkadot-watcher/templates/_helpers.tpl @@ -0,0 +1,4 @@ +{{/* Returns the app name */}} +{{- define "app.name" -}} +{{- default .Release.Name .Values.nameOverride -}} +{{- end }} \ No newline at end of file diff --git a/charts/polkadot-watcher/templates/alertrules.yaml b/charts/polkadot-watcher/templates/alertrules.yaml index 6ec29fb..f7203e7 100644 --- a/charts/polkadot-watcher/templates/alertrules.yaml +++ b/charts/polkadot-watcher/templates/alertrules.yaml @@ -11,10 +11,10 @@ kind: PrometheusRule metadata: labels: {{ toYaml .Values.prometheusRules.labels | indent 4 }} - name: {{ .Release.Name }} + name: {{ include "app.name" . }} spec: groups: - - name: {{ .Release.Name }}.rules + - name: {{ include "app.name" . }}-{{ .Values.config.environment }}.rules rules: - alert: ValidatorOutOfActiveSet annotations: diff --git a/charts/polkadot-watcher/templates/configmap.yaml b/charts/polkadot-watcher/templates/configmap.yaml index d45de9a..89d77b7 100644 --- a/charts/polkadot-watcher/templates/configmap.yaml +++ b/charts/polkadot-watcher/templates/configmap.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }} + name: {{ include "app.name" . }} data: main.yaml: |- {{ toYaml .Values.config | indent 4 }} diff --git a/charts/polkadot-watcher/templates/deployment.yaml b/charts/polkadot-watcher/templates/deployment.yaml index 12f358a..e477cdb 100644 --- a/charts/polkadot-watcher/templates/deployment.yaml +++ b/charts/polkadot-watcher/templates/deployment.yaml @@ -1,9 +1,9 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: {{ .Release.Name }} + name: {{ include "app.name" . }} labels: - app: {{ .Release.Name }} + app: {{ include "app.name" . }} spec: replicas: 1 revisionHistoryLimit: 3 @@ -11,16 +11,16 @@ spec: type: RollingUpdate selector: matchLabels: - app: {{ .Release.Name }} + app: {{ include "app.name" . }} template: metadata: labels: - app: {{ .Release.Name }} + app: {{ include "app.name" . }} annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} spec: containers: - - name: {{ .Release.Name }} + - name: {{ include "app.name" . }} image: {{ .Values.image.repo }}:{{ .Values.image.tag | default .Chart.AppVersion }} imagePullPolicy: {{ .Values.image.pullPolicy | default "Always" }} args: @@ -45,4 +45,4 @@ spec: volumes: - name: config configMap: - name: {{ .Release.Name }} + name: {{ include "app.name" . }} diff --git a/charts/polkadot-watcher/templates/service.yaml b/charts/polkadot-watcher/templates/service.yaml index aff320e..5354b66 100644 --- a/charts/polkadot-watcher/templates/service.yaml +++ b/charts/polkadot-watcher/templates/service.yaml @@ -1,12 +1,12 @@ apiVersion: v1 kind: Service metadata: - name: {{ .Release.Name }} + name: {{ include "app.name" . }} labels: - app: {{ .Release.Name }} + app: {{ include "app.name" . }} spec: ports: - name: metrics port: {{ .Values.config.port }} selector: - app: {{ .Release.Name }} + app: {{ include "app.name" . }} diff --git a/charts/polkadot-watcher/templates/servicemonitor.yaml b/charts/polkadot-watcher/templates/servicemonitor.yaml index 719fdf5..286e27e 100644 --- a/charts/polkadot-watcher/templates/servicemonitor.yaml +++ b/charts/polkadot-watcher/templates/servicemonitor.yaml @@ -2,13 +2,13 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ .Release.Name }} + name: {{ include "app.name" . }} labels: {{ toYaml .Values.serviceMonitor.labels | indent 4 }} spec: selector: matchLabels: - app: {{ .Release.Name }} + app: {{ include "app.name" . }} endpoints: - port: metrics {{ end }}