Skip to content

Commit

Permalink
feat(charts)!: refactor of evm chart (#995)
Browse files Browse the repository at this point in the history
## Summary
Large refactor of the EVM chart which break out the various components,
and restructures the value file to have the genesis clearly defined. The
evm chart itself becomes only `geth`

* `conductor.` New charts for `composer` & `evm-faucet` are added. A new
`evm-stack` chart is created which allows user to run many of these
components similar to how EVM chart functioned before, it is migrated to
using the blockscout published chart instead of our own chart for
blockscout (to be tested still).

## Background
The EVM chart needed to be split up for a long time, the blockscout and
faucet dependencies mostly useful for local dev. Composer split out
helps at scale.
  • Loading branch information
joroshiba committed Jul 23, 2024
1 parent b8f26d2 commit df1c206
Show file tree
Hide file tree
Showing 46 changed files with 1,372 additions and 990 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ jobs:
with:
python-version: '3.9'
check-latest: true
- name: Setup helm repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add blockscout https://blockscout.github.io/helm-charts
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/reusable-run-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ jobs:
with:
list-files: json
filters: |
charts: &charts
- 'charts/**'
smoke_tests: &smoke_tests
- 'dev/**'
- *charts
release_workflow:
- '.github/workflows/release.yml'
- '.github/workflows/reusable-cargo-version.yml'
Expand All @@ -74,6 +79,7 @@ jobs:
- 'containerfiles/**'
- '.dockerignore'
- 'Cargo.lock'
- *smoke_tests
lint_workflow:
- '.github/workflows/lint.yml'
crates:
Expand All @@ -95,7 +101,5 @@ jobs:
- '**/*.md'
rustfmt:
- 'rustfmt.toml'
charts:
- 'charts/**'
lockfile:
- 'Cargo.lock'
32 changes: 32 additions & 0 deletions charts/composer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: v2
name: composer
description: Astria composer helm chart

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"

maintainers:
- name: wafflesvonmaple
url: astria.org
- name: quasystaty1
url: astria.org
- name: joroshiba
url: astria.org
26 changes: 26 additions & 0 deletions charts/composer/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{/*
Namepsace to deploy elements into.
*/}}
{{- define "composer.namespace" -}}
{{- default .Release.Namespace .Values.global.namespaceOverride | trunc 63 | trimSuffix "-" -}}
{{- end }}

{{/*
Single entry of rollup names
*/}}
{{- define "composer.rollupDefinition" }}
{{ .name }}::{{ .wsRpc }}
{{- end}}

{{/*
Rollup config string
*/}}
{{- define "composer.rollups" }}
{{- range $index, $element := .Values.config.rollups }}
{{- if $index }},{{- end }}{{- tpl (include "composer.rollupDefinition" $element) $ }}
{{- end }}
{{- end }}

{{- define "composer.image" -}}
{{ .Values.images.composer.repo }}:{{ if .Values.global.dev }}{{ .Values.images.composer.devTag }}{{ else }}{{ .Values.images.composer.tag }}{{ end }}
{{- end }}
46 changes: 46 additions & 0 deletions charts/composer/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: composer-env
namespace: {{ include "composer.namespace" . }}
data:
ASTRIA_COMPOSER_LOG: "astria_composer={{ .Values.config.logLevel }}"
ASTRIA_COMPOSER_API_LISTEN_ADDR: "0.0.0.0:{{ .Values.ports.healthApi }}"
ASTRIA_COMPOSER_GRPC_ADDR: "0.0.0.0:{{ .Values.ports.grpc }}"
ASTRIA_COMPOSER_SEQUENCER_CHAIN_ID: "{{ tpl .Values.config.sequencerChainId . }}"
ASTRIA_COMPOSER_SEQUENCER_URL: "{{ tpl .Values.config.sequencerRpc . }}"
ASTRIA_COMPOSER_ROLLUPS: "{{ include "composer.rollups" . }}"
ASTRIA_COMPOSER_PRIVATE_KEY_FILE: "/var/secrets/{{ .Values.config.privateKey.secret.filename }}"
ASTRIA_COMPOSER_MAX_BYTES_PER_BUNDLE: "{{ .Values.config.maxBytesPerBundle }}"
ASTRIA_COMPOSER_BUNDLE_QUEUE_CAPACITY: "{{ .Values.config.bundleQueueCapacity }}"
ASTRIA_COMPOSER_MAX_SUBMIT_INTERVAL_MS: "{{ .Values.config.maxSubmitInterval }}"
ASTRIA_COMPOSER_SEQUENCER_ADDRESS_PREFIX: "{{ .Values.config.sequencerAddressPrefix}}"
ASTRIA_COMPOSER_FEE_ASSET: "{{ .Values.config.sequencerNativeAssetBaseDenomination }}"
ASTRIA_COMPOSER_NO_METRICS: "{{ not .Values.metrics.enabled }}"
ASTRIA_COMPOSER_METRICS_HTTP_LISTENER_ADDR: "0.0.0.0:{{ .Values.ports.metrics }}"
ASTRIA_COMPOSER_FORCE_STDOUT: "{{ .Values.global.useTTY }}"
ASTRIA_COMPOSER_PRETTY_PRINT: "{{ .Values.global.useTTY }}"
NO_COLOR: "{{ .Values.global.useTTY }}"
ASTRIA_COMPOSER_NO_OTEL: "{{ not .Values.otel.enabled }}"
OTEL_EXPORTER_OTLP_ENDPOINT: "{{ tpl .Values.otel.endpoint . }}"
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: "{{ tpl .Values.otel.tracesEndpoint . }}"
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: "{{ tpl .Values.otel.tracesTimeout . }}"
OTEL_EXPORTER_OTLP_TRACES_COMPRESSION: "{{ tpl .Values.otel.tracesCompression . }}"
OTEL_EXPORTER_OTLP_HEADERS: "{{ tpl .Values.otel.otlpHeaders . }}"
OTEL_EXPORTER_OTLP_TRACE_HEADERS: "{{ tpl .Values.otel.traceHeaders . }}"
OTEL_SERVICE_NAME: "{{ tpl .Values.otel.serviceName . }}"
{{- if not .Values.global.dev }}
{{- else }}
{{- end }}
---
{{- if not .Values.secretProvider.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ include "composer.namespace" . }}
name: sequencer-private-key
data:
{{ .Values.config.privateKey.secret.filename }}: |
{{ .Values.config.privateKey.devContent }}
---
{{- end }}
60 changes: 60 additions & 0 deletions charts/composer/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: composer
namespace: {{ include "composer.namespace" . }}
labels:
app: composer
spec:
replicas: {{ .Values.global.replicaCount }}
selector:
matchLabels:
app: composer
template:
metadata:
labels:
app: composer
spec:
containers:
- name: composer
image: {{ include "composer.image" . }}
command: ["/usr/local/bin/astria-composer"]
stdin: {{ .Values.global.useTTY }}
tty: {{ .Values.global.useTTY }}
envFrom:
- configMapRef:
name: composer-env
volumeMounts:
- mountPath: "/var/secrets"
name: sequencer-private-key
startupProbe:
httpGet:
path: /readyz
port: {{ .Values.ports.healthApi }}
readinessProbe:
httpGet:
path: /readyz
port: {{ .Values.ports.healthApi }}
ports:
{{- if .Values.metrics.enabled }}
- containerPort: {{ .Values.ports.metrics }}
name: metrics
{{- end }}
- containerPort: {{ .Values.ports.healthApi }}
name: health-api
- containerPort: {{ .Values.ports.grpc }}
name: grpc
resources:
{{- toYaml .Values.resources | trim | nindent 12 }}
volumes:
- name: sequencer-private-key
{{- if .Values.secretProvider.enabled }}
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: sequencer-private-key
{{- else }}
configMap:
name: sequencer-private-key
{{- end }}
13 changes: 13 additions & 0 deletions charts/composer/templates/secretproviderclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
{{- if .Values.secretProvider.enabled }}
apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
name: sequencer-private-key
spec:
provider: {{ .Values.secretProvider.provider }}
parameters:
{{- $_ := set $ "key" .Values.config.privateKey.secret }}
{{- tpl $.Values.secretProvider.parametersTemplate $ | nindent 4 }}
---
{{- end }}
29 changes: 29 additions & 0 deletions charts/composer/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
kind: Service
apiVersion: v1
metadata:
name: composer-service
namespace: {{ include "composer.namespace" . }}
spec:
selector:
app: composer
ports:
- name: grpc
port: {{ .Values.ports.grpc }}
targetPort: grpc
---
{{- if .Values.metrics.enabled }}
kind: Service
apiVersion: v1
metadata:
name: metrics
namespace: {{ include "composer.namespace" . }}
labels:
app: composer
spec:
selector:
app: composer
ports:
- name: metrics
port: {{ .Values.ports.metrics }}
targetPort: geth-metr
{{- end }}
27 changes: 27 additions & 0 deletions charts/composer/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: composer-metrics
labels:
{{- with .Values.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
jobLabel: composer-metrics
namespaceSelector:
matchNames:
- {{ include "composer.namespace" . }}
selector:
matchLabels:
app: composer
endpoints:
- port: metrics
path: /
{{- with .Values.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- end }}
75 changes: 75 additions & 0 deletions charts/composer/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
global:
namespaceOverride: ""
replicaCount: 1
# Whether to use tty readable logging for astria services, when false use json.
useTTY: false
dev: false

images:
composer:
repo: ghcr.io/astriaorg/composer
tag: "0.8.0"
devTag: latest

config:
logLevel: "debug"
maxBytesPerBundle: 200000
bundleQueueCapacity: 40000
maxSubmitInterval: 2000
sequencerAddressPrefix: astria
sequencerNativeAssetBaseDenomination: "nria"
sequencerRpc: ""
sequencerChainId: ""
privateKey:
devContent: ""
secret:
filename: "key.hex"
resourceName: "projects/$PROJECT_ID/secrets/sequencerPrivateKey/versions/latest"
rollups:
- name: "astria"
wsRpc: "ws://"

otel:
enabled: false
serviceName: "composer"
endpoint: ""
tracesEndpoint: ""
tracesCompression: "gzip"
tracesTimeout: "10"
otlpHeaders: ""
traceHeaders: ""

metrics:
enabled: false

serviceMonitor:
# set to enable port svc and service monitor
enabled: false
port: 6060
additionalLabels:
release: kube-prometheus-stack

# When deploying in a production environment should use a secret provider
# This is configured for use with GCP, need to set own resource names
# and keys
secretProvider:
enabled: false
provider: gcp
parametersTemplate: |-
secrets: |
- resourceName: {{ .key.resourceName }}
fileName: "{{ .key.filename }}"
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 1000m
memory: 1Gi

# Default service ports
ports:
grpc: 50052
healthApi: 2450
metrics: 6060
Loading

0 comments on commit df1c206

Please sign in to comment.