Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sidecar prometheus metrics option #284

Merged
merged 2 commits into from
Aug 29, 2023
Merged
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
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.7
version: 5.2.1
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.7](https://img.shields.io/badge/Version-5.1.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 5.2.1](https://img.shields.io/badge/Version-5.2.1-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
8 changes: 7 additions & 1 deletion charts/node/ci/kind-values.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
node:
chain: dev
role: invalid
dataVolumeSize: 1G
flags:
- "--force-authoring"
- "--alice"
chainData:
storageClass: standard
volumeSize: 1Gi
chainKeystore:
storageClass: standard
podManagementPolicy: Parallel
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
Loading