diff --git a/charts/node/Chart.yaml b/charts/node/Chart.yaml index 92ed01b2..fe635c12 100644 --- a/charts/node/Chart.yaml +++ b/charts/node/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: node description: A Helm chart to deploy Substrate/Polkadot nodes type: application -version: 0.8.0 +version: 0.9.0 appVersion: "0.0.1" diff --git a/charts/node/templates/_helpers.tpl b/charts/node/templates/_helpers.tpl index 7ba5edc2..8a107382 100644 --- a/charts/node/templates/_helpers.tpl +++ b/charts/node/templates/_helpers.tpl @@ -50,6 +50,14 @@ app.kubernetes.io/name: {{ include "chart.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} +{{/* +Service labels +*/}} +{{- define "chart.serviceLabels" -}} +chain: {{ .Values.node.chain }} +release: {{ .Release.Name }} +{{- end }} + {{/* Create the name of the service account to use */}} diff --git a/charts/node/templates/service.yaml b/charts/node/templates/service.yaml index d15cd534..3ca2220c 100644 --- a/charts/node/templates/service.yaml +++ b/charts/node/templates/service.yaml @@ -1,5 +1,6 @@ {{ $fullname := include "chart.fullname" . }} {{ $selectorLabels := include "chart.selectorLabels" . }} +{{ $serviceLabels := include "chart.serviceLabels" . }} apiVersion: v1 kind: Service metadata: @@ -27,6 +28,9 @@ apiVersion: v1 kind: Service metadata: name: {{ $fullname }}-{{ $i }} + labels: + {{- $serviceLabels | nindent 4 }} + instance: {{ $fullname }}-{{ $i }} spec: type: ClusterIP clusterIP: None diff --git a/charts/node/templates/serviceMonitor.yaml b/charts/node/templates/serviceMonitor.yaml index 9e0d35c5..37e1dbce 100644 --- a/charts/node/templates/serviceMonitor.yaml +++ b/charts/node/templates/serviceMonitor.yaml @@ -1,12 +1,11 @@ {{- if .Values.node.serviceMonitor.enabled }} {{ $fullname := include "chart.fullname" . }} {{ $metadataLabels := include "chart.labels" . }} -{{ $selectorLabels := include "chart.selectorLabels" . }} -{{range $i := until (.Values.node.replicas | int) }} +{{ $serviceLabels := include "chart.serviceLabels" . }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: - name: {{ $fullname }}-{{ $i }} + name: {{ $fullname }} {{- if $.Values.node.serviceMonitor.namespace }} namespace: {{ $.Values.node.serviceMonitor.namespace }} {{- else }} @@ -16,8 +15,7 @@ metadata: spec: selector: matchLabels: - {{- $selectorLabels | nindent 6 }} - statefulset.kubernetes.io/pod-name: {{ $fullname }}-{{ $i }} + {{- $serviceLabels | nindent 6 }} endpoints: - port: prometheus path: /metrics @@ -30,6 +28,8 @@ spec: namespaceSelector: matchNames: - {{ $.Release.Namespace }} - {{- end }} ---- -{{ end }} + targetLabels: + - chain + - release + - instance +{{- end }} \ No newline at end of file diff --git a/charts/node/templates/statefulset.yaml b/charts/node/templates/statefulset.yaml index 686101fb..9549e35e 100644 --- a/charts/node/templates/statefulset.yaml +++ b/charts/node/templates/statefulset.yaml @@ -1,6 +1,7 @@ {{ $fullname := include "chart.fullname" . }} {{ $metadataLabels := include "chart.labels" . }} {{ $selectorLabels := include "chart.selectorLabels" . }} +{{ $serviceLabels := include "chart.serviceLabels" . }} {{ $serviceAccountName := include "chart.serviceAccountName" . }} apiVersion: apps/v1 kind: StatefulSet @@ -8,6 +9,7 @@ metadata: name: {{ $fullname }} labels: {{- $metadataLabels | nindent 4 }} + {{- $serviceLabels | nindent 4 }} spec: selector: matchLabels: @@ -22,7 +24,8 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} labels: - {{- $selectorLabels | nindent 8 }} + {{- $selectorLabels | nindent 8 }} + {{- $serviceLabels | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: