berkeley-migration-cronjob

by O(1) Labs

Helm chartv0.1.1App 1.17.0Verified publisher

Creating replayer CronJobs for Mina mainnet migration

About this chart

Berkeley Migration CronJobs

This Helm Chart aims to ease the process of scripting the Mina mainnet migration replayers by isolating the script from the Kubernetes manifests.

The way it works can be summarized in the following items:

  1. A Kubernetes Secret with the contents of .Values.gcloudKeyfileRef is created. It essentially retrieves the secret stored in GCP Secret Manager containing a valid gcloud-keyfile.json. This Secret will be mounted at /gcloud/keyfile.json on all replayers containers.
  2. As many CronJobs are created as entries in the .Values.replayers list.
    1. A Kubernetes Secret called {{ .Values.replayers.[*].script.secretName }} is created with the contents of {{ .Values.replayers.[*].script.scriptName }} and mounted at each replayer container at /scripts/{{ .Values.replayers.[*].scriptName }}
  3. Replayers have the following entrypoint: /bin/bash -c /scripts/{{ .Values.replayers.[*].scriptName }}
  4. These are deployed using gitops-infratructure. But may also be deployed from a user environment using helm-secrets (with vals) and sufficient authz in GCP to read GCP Secret Manager.

Deployment

These CronJobs are deployed using ArgoCD. Refer to GitOps-Infrastructure repository for platform configurations.

(Optional, requires authz) Deploy the CronJobs from your workstation

As manifests secure secrets using GCP Secrets Manager, helm-secrets plugin must be used to either deploy or check the rendered manifests (e.g., via helm template). To achieve this install helm-secrets plugin and either:

a. Check manifests

# at mina/helm/cron_jobs/replayer-cronjobs
helm secrets --evaluate-templates template . -f values.yaml

# decode the evaluated templates by (values are shown in b64, though)
helm secrets --evaluate-templates --evaluate-templates-decode-secrets template . -f values.yaml

b. Deploy Chart

NAME=mainnet-replayer
NAMESPACE=my-namespace
helm secrets --evaluate-templates upgrade --install $NAME . -f values.yaml --namespace $NAMESPACE

You can perform this operation every time you change a value in the Chart or update the scripts under files.

Notes

  • Some values.yaml are considered global (e.g., .Values.image) and are referenced in each replayer using YAML anchors.
  • An Example script test-run.sh is included so a debugging replayer can be launched. It essentially performs the same package installations as e.g., mainnet-migrated.sh but with a sleep 3600 instruction at the end. If you want to try it, simply uncomment the test-run entry under .Values.replayers.

Deploy berkeley-migration-cronjob with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has berkeley-migration-cronjob on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartberkeley-migration-cronjob is pinned at v0.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply