Skip to content

Commit

Permalink
add sidecar prom metrics option fix #275
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreBesson committed Aug 10, 2023
1 parent 9d9531c commit 110c33f
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: node
description: A Helm chart to deploy Substrate/Polkadot nodes
type: application
version: 5.1.5
version: 5.2.0
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
Expand Down
5 changes: 3 additions & 2 deletions charts/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is intended behaviour. Make sure to run `git add -A` once again to stage ch

# Substrate/Polkadot node helm chart

![Version: 5.1.5](https://img.shields.io/badge/Version-5.1.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 5.2.0](https://img.shields.io/badge/Version-5.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

## Maintainers

Expand Down Expand Up @@ -465,7 +465,8 @@ If you're running a collator node:
| serviceAccount.create | bool | `true` | Enable creation of a Service Account for the main container |
| serviceAccount.createRoleBinding | bool | `true` | Creates RoleBinding |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| substrateApiSidecar | object | `{"env":{},"image":{"repository":"parity/substrate-api-sidecar","tag":"latest"},"resources":{}}` | Configuration of Substrate API ref: https://github.com/paritytech/substrate-api-sidecar |
| substrateApiSidecar | object | `{"args":["node","build/src/main.js"],"env":{},"image":{"repository":"parity/substrate-api-sidecar","tag":"latest"},"metrics":{"enabled":false,"port":9100},"resources":{}}` | Configuration of Substrate API ref: https://github.com/paritytech/substrate-api-sidecar |
| substrateApiSidecar.args | list | `["node","build/src/main.js"]` | Arguments to set on the API sidecar |
| substrateApiSidecar.env | object | `{}` | Environment variables to set on the API sidecar |
| substrateApiSidecar.image.repository | string | `"parity/substrate-api-sidecar"` | Image repository |
| substrateApiSidecar.image.tag | string | `"latest"` | Image tag |
Expand Down
9 changes: 8 additions & 1 deletion charts/node/ci/kind-values.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
node:
chain: dev
role: invalid
dataVolumeSize: 1G
chainData:
volumeSize: 1Gi
flags:
- "--force-authoring"
- "--alice"
Expand All @@ -13,10 +14,16 @@ node:
persistentVolumeClaimRetentionPolicy:
whenDeleted: Delete
whenScaled: Delete
substrateApiSidecar:
enabled: true
image:
tag: v0.9.43
autoscaling:
enabled: true
targetCPU: 80
targetMemory: 80
maxReplicas: 2

substrateApiSidecar:
metrics:
enabled: true
19 changes: 19 additions & 0 deletions charts/node/templates/serviceMonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.substrateApiSidecar.metrics.enabled }}
- port: prom-sidecar
path: /metrics
{{- if $.Values.node.serviceMonitor.interval }}
interval: {{ $.Values.node.serviceMonitor.interval }}
{{- end }}
{{- if $.Values.node.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ $.Values.node.serviceMonitor.scrapeTimeout }}
honorLabels: true
{{- end }}
{{- with .Values.node.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.node.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
namespaceSelector:
matchNames:
- {{ $.Release.Namespace }}
Expand Down
13 changes: 13 additions & 0 deletions charts/node/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -733,12 +733,25 @@ spec:
- name: {{ $key }}
value: {{ $val | squote }}
{{- end }}
args:
{{- range .Values.substrateApiSidecar.args }}
- "{{ . }}"
{{- end }}
{{- if .Values.substrateApiSidecar.metrics.enabled }}
- "--prometheus"
- "--prometheus-port={{ .Values.substrateApiSidecar.metrics.port }}"
{{- end }}
resources:
{{- toYaml .Values.substrateApiSidecar.resources | nindent 12 }}
ports:
- containerPort: 8080
name: api-sidecar
protocol: TCP
{{- if .Values.substrateApiSidecar.metrics.enabled }}
- containerPort: {{ .Values.substrateApiSidecar.metrics.port }}
name: prom-sidecar
protocol: TCP
{{- end }}
{{- end }}
{{- if .Values.node.tracing.enabled }}
- name: jaeger-agent-sidecar
Expand Down
7 changes: 7 additions & 0 deletions charts/node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,13 @@ substrateApiSidecar:
repository: parity/substrate-api-sidecar
# -- Image tag
tag: latest
metrics:
enabled: false
port: 9100
# -- Arguments to set on the API sidecar
args:
- "node"
- "build/src/main.js"
# -- Environment variables to set on the API sidecar
env: {}
# -- Resource limits & requests
Expand Down

0 comments on commit 110c33f

Please sign in to comment.