Skip to content

Commit

Permalink
feat(ci): provide demo/preview environments (#1406)
Browse files Browse the repository at this point in the history
## Summary
Updates the celestia-local chart to allow helm-parameter overrides when
creating PR preview environments.

## Background
To show how we can leverage a preview environments for: 
	- testing work in progress PR
	- providing a demo environment  to external users
	- Testing against a live cluster 

## Changes
- Update celestia-local chart to:
  - remove hardcoded values
  - allow specifying ingress params
  - ensuring PVC storage is namespace scoped
- Update sequencer and evm-stack components to support parameterized
imagePullPolicy for ArgoCD
- Include ArgoCD ApplicationSet for PR preview envs (to be applied by
admins)

## Testing
- Rendering locally for manual inspection
- Applied changes to argocd.dev.astria.org to test on live cluster
- Verify components are being deployed successfully 
- Confirm smoke-tests pass when pointing to deployed components

---------

Co-authored-by: ido <[email protected]>
  • Loading branch information
aajimal and quasystaty1 authored Sep 13, 2024
1 parent b401e4f commit d2b9083
Show file tree
Hide file tree
Showing 38 changed files with 548 additions and 82 deletions.
2 changes: 1 addition & 1 deletion charts/celestia-local/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.6.2
version: 0.6.3

# 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
Expand Down
82 changes: 82 additions & 0 deletions charts/celestia-local/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{{/*
Namepsace to deploy elements into.
*/}}
{{- define "celestia.namespace" -}}
{{- default .Release.Namespace .Values.global.namespaceOverride | trunc 63 | trimSuffix "-" -}}
{{- end }}


{{/*
Expand the name of the chart.
*/}}
{{- define "celestia.appName" -}}
{{- default (include "celestia.name" .) | trunc 63 | trimSuffix "-" }}-astria-dev-cluster
{{- end }}

{{/*
Common labels
*/}}
{{- define "celestia.labels" -}}
{{ include "celestia.selectorLabels" . }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "celestia.selectorLabels" -}}
app: {{ include "celestia.appName" . }}
{{- end }}

{{/*
The log level represented as a number
*/}}
{{- define "celestia.logLevelNum" -}}
{{- if eq .Values.config.logLevel "error" }}
1
{{- else if eq .Values.config.logLevel "warn" }}
2
{{- else if eq .Values.config.logLevel "info" }}
3
{{- else if eq .Values.config.logLevel "debug" }}
4
{{- else if eq .Values.config.logLevel "trace" }}
5
{{- end }}
{{- end }}




{{/*
Return if ingress is stable.
*/}}
{{- define "celestia.ingress.isStable" -}}
{{- eq (include "celestia.ingress.apiVersion" .) "networking.k8s.io/v1" }}
{{- end }}

{{/*
Return if ingress supports ingressClassName.
*/}}
{{- define "celestia.ingress.supportsIngressClassName" -}}
{{- or (eq (include "celestia.ingress.isStable" .) "true") (and (eq (include "celestia.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
{{- end }}

{{/*
Return if ingress supports pathType.
*/}}
{{- define "celestia.ingress.supportsPathType" -}}
{{- or (eq (include "celestia.ingress.isStable" .) "true") (and (eq (include "celestia.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) }}
{{- end }}

{{/*
Return the appropriate apiVersion for ingress.
*/}}
{{- define "celestia.ingress.apiVersion" -}}
{{- if and ($.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version) }}
{{- print "networking.k8s.io/v1" }}
{{- else if $.Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" }}
{{- print "networking.k8s.io/v1beta1" }}
{{- else }}
{{- print "extensions/v1beta1" }}
{{- end }}
{{- end }}
76 changes: 25 additions & 51 deletions charts/celestia-local/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,36 @@ metadata:
namespace: {{ $.Values.global.namespace }}
labels:
app: celestia-local-network
{{- with $.Values.ingress.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
nginx.ingress.kubernetes.io/enable-cors: "true"
# allow requests from bridge web app
nginx.ingress.kubernetes.io/cors-allow-origin: "http://localhost:3000"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
{{- range $key, $value := $.Values.ingress.annotations }}
{{ $key }}: {{ tpl $value $ | quote }}
{{- end }}
spec:
ingressClassName: nginx
ingressClassName: {{ $.Values.ingress.className }}
rules:
- host: rpc.node.celestia.localdev.me
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: celestia-service
port:
name: bridge-jsonrpc
- host: rest.node.celestia.localdev.me
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: celestia-service
port:
name: bridge-rest
- host: token.node.celestia.localdev.me
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: celestia-service
port:
name: token-svc
- host: rpc.app.celestia.localdev.me
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: celestia-app-service
port:
name: app-rpc
- host: rest.app.celestia.localdev.me
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: celestia-app-service
port:
name: app-rest
{{- range $service, $ingress := $.Values.ingress.services }}
{{- with $ingress.hosts }}
{{- range $host := . }}
- host: {{ tpl $host $ }}
http:
paths:
- path: {{ $ingress.path }}
pathType: {{ $ingress.pathType }}
backend:
service:
{{- with $ingress.service }}
name: {{ .name }}
port:
name: {{ .port.name }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/celestia-local/templates/volumes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ $value.persistentVolumeName }}-pvc
namespace: astria-dev-cluster
namespace: {{ $.Values.global.namespace }}
labels:
"app.kubernetes.io/name": "{{ $.Chart.Name }}"
"app.kubernetes.io/managed-by": {{ $.Release.Service | quote }}
Expand Down
52 changes: 52 additions & 0 deletions charts/celestia-local/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,55 @@ ports:
celestiaAppRestPort: 1317
bridgeRPC: 26658
bridgeHTTP: 26659

ingress:
labels: {}
annotations: {}
hostname: localdev.me
className: nginx
services:
bridgeRpc:
hosts:
- 'rpc.node.celestia.{{ .Values.ingress.hostname }}'
path: /
pathType: Prefix
service:
name: celestia-service
port:
name: bridge-jsonrpc
bridgeRest:
hosts:
- rest.node.celestia.{{ .Values.ingress.hostname }}
path: /
pathType: Prefix
service:
name: celestia-service
port:
name: bridge-rest
token:
hosts:
- token.node.celestia.{{ .Values.ingress.hostname }}
path: /
pathType: Prefix
service:
name: celestia-service
port:
name: token-svc
appRpc:
hosts:
- 'rpc.app.celestia.{{ .Values.ingress.hostname }}'
path: /
pathType: Prefix
service:
name: celestia-app-service
port:
name: app-rpc
appRest:
hosts:
- rest.app.celestia.{{ .Values.ingress.hostname }}
path: /
pathType: Prefix
service:
name: celestia-app-service
port:
name: app-rest
2 changes: 1 addition & 1 deletion charts/composer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.2
version: 0.1.3

# 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
Expand Down
1 change: 1 addition & 0 deletions charts/composer/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
containers:
- name: composer
image: {{ include "composer.image" . }}
imagePullPolicy: {{ .Values.images.composer.pullPolicy }}
command: ["/usr/local/bin/astria-composer"]
stdin: {{ .Values.global.useTTY }}
tty: {{ .Values.global.useTTY }}
Expand Down
1 change: 1 addition & 0 deletions charts/composer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ global:
images:
composer:
repo: ghcr.io/astriaorg/composer
pullPolicy: IfNotPresent
tag: "0.8.2"
devTag: latest

Expand Down
2 changes: 1 addition & 1 deletion charts/evm-bridge-withdrawer/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.2.0
version: 0.2.1

# 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
Expand Down
1 change: 1 addition & 0 deletions charts/evm-bridge-withdrawer/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
containers:
- name: evm-bridge-withdrawer
image: {{ include "evm-bridge-withdrawer.image" . }}
imagePullPolicy: {{ .Values.images.evmBridgeWithdrawer.pullPolicy }}
command: [ "/usr/local/bin/astria-bridge-withdrawer" ]
stdin: {{ .Values.global.useTTY }}
tty: {{ .Values.global.useTTY }}
Expand Down
1 change: 1 addition & 0 deletions charts/evm-bridge-withdrawer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ global:
images:
evmBridgeWithdrawer:
repo: ghcr.io/astriaorg/evm-bridge-withdrawer
pullPolicy: IfNotPresent
tag: "0.2.1"
devTag: latest

Expand Down
2 changes: 1 addition & 1 deletion charts/evm-faucet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type: application
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)

version: 0.1.1
version: 0.1.2

# 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
Expand Down
1 change: 1 addition & 0 deletions charts/evm-faucet/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
- -faucet.amount=$(ETH_FAUCET_AMOUNT)
- -proxycount=$(ETH_FAUCET_PROXYCOUNT)
image: {{ .Values.images.faucet.repo }}:{{ .Values.images.faucet.tag }}
imagePullPolicy: {{ .Values.images.faucet.pullPolicy }}
envFrom:
- configMapRef:
name: {{tpl .Values.config.rollupName . }}-evm-faucet-env
Expand Down
1 change: 1 addition & 0 deletions charts/evm-faucet/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ global:
images:
faucet:
repo: "ghcr.io/astriaorg/ria-faucet"
pullPolicy: IfNotPresent
tag: "0.0.1"

config:
Expand Down
2 changes: 1 addition & 1 deletion charts/evm-rollup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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.27.1
version: 0.27.2

# 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
Expand Down
3 changes: 0 additions & 3 deletions charts/evm-rollup/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ Full image paths for Astria built images
{{- define "conductor.image" -}}
{{ .Values.images.conductor.repo }}:{{ if .Values.global.dev }}{{ .Values.images.conductor.devTag }}{{ else }}{{ .Values.images.conductor.tag }}{{ end }}
{{- end }}
{{- define "composer.image" -}}
{{ .Values.images.composer.repo }}:{{ if .Values.global.dev }}{{ .Values.images.composer.devTag }}{{ else }}{{ .Values.images.composer.tag }}{{ end }}
{{- end }}


{{/*
Expand Down
4 changes: 4 additions & 0 deletions charts/evm-rollup/templates/statefulsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ spec:
{{- if .Values.config.geth.purgeMempool }}
- name: purge-mempool
image: {{ include "rollup.image" . }}
imagePullPolicy: {{ .Values.images.geth.pullPolicy }}
command: [ "sh", "-c", "rm" ]
args:
- -f
Expand All @@ -32,6 +33,7 @@ spec:
- name: init-geth
command: [ "/scripts/init-geth.sh" ]
image: {{ include "rollup.image" . }}
imagePullPolicy: {{ .Values.images.geth.pullPolicy }}
envFrom:
- configMapRef:
name: {{ include "rollup.name" . }}-geth-env
Expand All @@ -51,6 +53,7 @@ spec:
{{- end }}
{{- end }}
image: {{ include "rollup.image" . }}
imagePullPolicy: {{ .Values.images.geth.pullPolicy }}
volumeMounts:
- mountPath: /scripts/
name: {{ include "rollup.name" . }}-executor-scripts-volume
Expand All @@ -73,6 +76,7 @@ spec:
{{- toYaml .Values.resources.geth | trim | nindent 12 }}
- name: conductor
image: {{ include "conductor.image" . }}
imagePullPolicy: {{ .Values.images.conductor.pullPolicy }}
command: [ "/usr/local/bin/astria-conductor" ]
stdin: {{ .Values.global.useTTY }}
tty: {{ .Values.global.useTTY }}
Expand Down
2 changes: 2 additions & 0 deletions charts/evm-rollup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ global:
images:
geth:
repo: ghcr.io/astriaorg/astria-geth
pullPolicy: IfNotPresent
tag: 0.14.0
devTag: latest
overrideTag: ""
conductor:
repo: ghcr.io/astriaorg/conductor
pullPolicy: IfNotPresent
tag: "0.20.0"
devTag: latest

Expand Down
Loading

0 comments on commit d2b9083

Please sign in to comment.