Skip to content

Commit

Permalink
Feature: add substrate api sidecar configuration options MGX-769 (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenequm authored Nov 2, 2023
1 parent bf8d303 commit a2f3fb0
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 0 deletions.
15 changes: 15 additions & 0 deletions charts/node/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,23 @@ spec:
name: {{ include "node.name" . }}
port:
number: 9944
{{- if .Values.substrateApiSidecar.enabled }}
- host: {{ include "node.name" . }}-api-{{ .Values.environment }}.{{ .Values.domainZone }}
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: {{ include "node.name" . }}
port:
number: 8080
{{- end }}
tls:
- hosts:
- {{ include "node.name" . }}-ws-{{ .Values.environment }}.{{ .Values.domainZone }}
{{- if .Values.substrateApiSidecar.enabled }}
- {{ include "node.name" . }}-api-{{ .Values.environment }}.{{ .Values.domainZone }}
{{- end }}
secretName: {{ include "node.name" . }}-tls
{{- end }}
7 changes: 7 additions & 0 deletions charts/node/templates/service-monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,11 @@ spec:
path: /metrics
interval: 30s
{{- end }}
{{- if and .Values.substrateApiSidecar.enabled .Values.substrateApiSidecar.metrics.enabled }}
- targetPort: prom-sidecar
honorLabels: true
path: /metrics
interval: 30s
{{- end }}

{{- end }}
10 changes: 10 additions & 0 deletions charts/node/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ spec:
name: http-ws-health
targetPort: http-ws-health
{{- end }}
{{- if .Values.substrateApiSidecar.enabled }}
- port: 8080
name: api-sidecar
targetPort: api-sidecar
{{- if .Values.substrateApiSidecar.metrics.enabled }}
- port: {{ .Values.substrateApiSidecar.metrics.port | int }}
name: prom-sidecar
targetPort: prom-sidecar
{{- end }}
{{- end }}
selector:
{{- include "node.selectorLabels" . | nindent 4 }}
service: {{ include "node.name" . }}
65 changes: 65 additions & 0 deletions charts/node/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ spec:
- --rpc-methods=unsafe
{{- end }}
- --rpc-cors=all
{{- if .Values.jaegerAgent.enabled }}
--jaeger-agent=127.0.0.1:{{ .Values.jaegerAgent.ports.compactPort }} \
{{- end }}
{{- range .Values.extraArgs }}
- {{ . }}
{{- end }}
Expand Down Expand Up @@ -356,6 +359,68 @@ spec:
periodSeconds: 60
{{- end }}
{{- end }}
{{- if .Values.substrateApiSidecar.enabled }}
- name: substrate-api-sidecar
image: {{ .Values.substrateApiSidecar.image.repository }}:{{ .Values.substrateApiSidecar.image.tag }}
env:
{{- range $key, $val := .Values.substrateApiSidecar.env }}
- 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.jaegerAgent.enabled }}
- name: jaeger-agent-sidecar
image: {{ .Values.jaegerAgent.image.repository }}:{{ .Values.jaegerAgent.image.tag }}
args:
- --reporter.grpc.host-port={{ .Values.jaegerAgent.collector.url }}:{{ .Values.jaegerAgent.collector.port }}
env:
{{- range $key, $val := .Values.jaegerAgent.env }}
- name: {{ $key }}
value: {{ $val | squote }}
{{- end }}
resources:
{{- toYaml .Values.jaegerAgent.resources | nindent 12 }}
ports:
- name: jaeger-compact
containerPort: {{ .Values.jaegerAgent.ports.compactPort }}
protocol: UDP
- name: jaeger-binary
containerPort: {{ .Values.jaegerAgent.ports.binaryPort }}
protocol: UDP
- name: http
containerPort: {{ .Values.jaegerAgent.ports.samplingPort }}
protocol: TCP
- name: admin
containerPort: 14271
protocol: TCP
livenessProbe:
httpGet:
path: /
port: admin
readinessProbe:
httpGet:
path: /
port: admin
{{- end}}
{{- with .Values.extraContainers }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
54 changes: 54 additions & 0 deletions charts/node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,60 @@ wsHealthExporter:
# -- Enable Node liveness probe through `paritytech/ws-health-exporter` running as a sidecar container
enableSidecarLivenessProbe: false

# -- Configuration of Substrate API sidecar container
# ref: https://github.com/paritytech/substrate-api-sidecar
substrateApiSidecar:
# -- Enable Substrate API sidecar container
enabled: false
image:
# -- Image repository
repository: parity/substrate-api-sidecar
# -- Image tag
tag: v17.3.1
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
resources:
requests:
cpu: 200m
memory: 4Gi
limits:
cpu: 1000m
memory: 4Gi

# -- Configuration of Jaeger agent
# https://github.com/jaegertracing/jaeger
jaegerAgent:
enabled: false
image:
# -- Image repository
repository: jaegertracing/jaeger-agent
# -- Image tag
tag: latest
ports:
# -- Accept jaeger.thrift over compact thrift protocol
compactPort: 6831
# -- Accept jaeger.thrift over binary thrift protocol
binaryPort: 6832
# -- (HTTP) serve configs, sampling strategies
samplingPort: 5778
# -- Collector config
collector:
url: null
# Jaeger Default GRPC port is 14250
port: 14250
# -- Environment variables to set on the Jaeger sidecar
env: {}
# -- Resource limits & requests
resources: {}

# -- Additional containers to run in the pod
extraContainers: []

Expand Down

0 comments on commit a2f3fb0

Please sign in to comment.