chore(helm/charts): import erpc from morpho-infra-helm#90
Conversation
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension. |
3db6a38 to
631f9ad
Compare
631f9ad to
7cad0d6
Compare
7cad0d6 to
7cadc0e
Compare
Apply the fixes from the per-finding review branches directly: validate-helm-charts.sh: - process_chart now returns instead of exit, so the sequential loop validates every chart and reaches the summary (the parallel path is unaffected). - Use a single `mktemp -d` dir (lint/template files) instead of an unused base temp file; clean up with one `rm -rf`. - Pass the chart path to `helm dependency update` / `helm template` instead of cd-ing into the dir; drop the now-unused INITIAL_DIR. - Split the `helm template | kubeconform` pipeline for readability (keeping the `if !` guard, which is pipefail-safe). test-local.sh: - Redact LABELS_SERVICE_API_KEY when echoing the auth response. - Correct the eth_getLogs decimal block numbers (0x1254048f = 307,496,079, 0x12558b2f = 307,596,079, range = 100,000). The Aikido suggestion to move should_skip_validation before `helm lint` was intentionally not applied: lint is meant to run for all charts; only kubeconform is skipped for database charts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- CODEOWNERS: add @0x666c6f as a mandatory codeowner alongside the teams, on every pattern (incl. /helm/) so he is a required reviewer repo-wide, not only for files matching the default `*` rule. - values.yaml: bump erpc and erpc-validator image tags 0.0.77 -> 0.1.3 to match the latest prd values in morpho-org/morpho-infra-helm. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6553bf2 to
a8d49f2
Compare
|
@0x666c6f do you know why agent-harness is failing ? I ran ./scripts/agent-harness/update-repo-map.sh but the file was already up to date |
|
Fixed in 7dd92d7. Root cause: Fix: force deterministic case-insensitive ordering with ./scripts/agent-harness/update-repo-map.sh
make agent-check |
The import predates the latest bumps in morpho-infra-helm (images 0.1.3, main replicaCount 12); cutting ArgoCD over on the stale copy would roll production back.
Anchor the nine ECR image tags (erpcImageTag for the erpc runtime, erpcValidatorImageTag for the validator job image) so the update-image-tag workflow can bump them all in one place. The upstream ghcr.io digest pins are intentionally left out of the anchors.
Replicate the morpho-api in-repo image bump flow, adapted to erpc: - update-image-tag.yaml: workflow_dispatch with a semver version_tag (validated), prd/morpho-main only (erpc has no dev environment or branch), bumps the erpcImageTag and erpcValidatorImageTag anchors, creates a GitHub-signed commit via createCommitOnBranch with the morpho-infra-deployer app token, opens a PR and — when vars.ERPC_PRD_AUTOMERGE is true — waits for required checks with the workflow token then merges with admin bypass. Auto-merge defaults to off: production PRs require manual approval. - only-values-yaml-guard.yml: same guard as morpho-api targeting morpho-main, scoping the bot's review bypass to values.yaml-only changes.
There was a problem hiding this comment.
Pull request overview
This PR migrates the eRPC Helm chart and the production (prd) environment wrapper into this repository, alongside CI workflows and helper scripts for chart validation and IaC scanning.
Changes:
- Added a new base Helm chart (
helm/charts/erpc) plus a production environment wrapper chart (helm/environments/prd/erpc) with HAProxy/Redis/CNPG Postgres resources and Prometheus rules. - Introduced Helm chart validation tooling locally (
validate-helm-charts.sh) and in CI (.github/workflows/helm-charts-validation.yaml), plus Wiz IaC scanning and governance updates (CODEOWNERS, values-only guard, Slack notifications). - Updated repo-map tooling output determinism and refreshed
review/repo-map.mdaccordingly.
Reviewed changes
Copilot reviewed 39 out of 46 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| validate-helm-charts.sh | Adds a local Helm lint + kubeconform validation script for selected charts. |
| scripts/review-repo-map.sh | Makes repo-map generation deterministic with case-insensitive sorting. |
| review/repo-map.md | Updates generated repo map to reflect newly added top-level paths/files. |
| helm/environments/prd/erpc/values.yaml | Adds production configuration for multiple eRPC instances, HAProxy controllers, Redis HA, and DB settings. |
| helm/environments/prd/erpc/templates/serviceaccount-vault.yaml | Creates a dedicated ServiceAccount for Vault materialization hooks in prd wrapper. |
| helm/environments/prd/erpc/templates/rbac-vault-redis.yaml | Adds RBAC allowing the Vault job to create/update the Redis auth secret. |
| helm/environments/prd/erpc/templates/prometheus-rules.yaml | Adds PrometheusRule recording + alerting rules for eRPC and HAProxy/fallback behavior. |
| helm/environments/prd/erpc/templates/job-vault-redis.yaml | Adds a hook Job to materialize Redis credentials from Vault into a Kubernetes Secret. |
| helm/environments/prd/erpc/templates/_helpers.tpl | Provides naming helpers for the prd wrapper chart templates. |
| helm/environments/prd/erpc/Chart.yaml | Defines the prd wrapper chart and its dependencies (erpc, haproxy, redis-ha, exporter). |
| helm/environments/prd/erpc/Chart.lock | Locks dependency versions/digests for the prd wrapper chart. |
| helm/environments/prd/.gitkeep | Keeps the prd environments directory tracked. |
| helm/charts/erpc/values.yaml | Adds default values for the base eRPC chart, including Vault rendering/validation knobs. |
| helm/charts/erpc/test-local.sh | Adds a local docker-compose based smoke-test script for eRPC. |
| helm/charts/erpc/templates/serviceaccount.yaml | Implements runtime + Vault-creator ServiceAccount behavior (token automount disabled by default). |
| helm/charts/erpc/templates/service.yaml | Adds the main ClusterIP Service for eRPC HTTP. |
| helm/charts/erpc/templates/service-metrics.yaml | Adds a dedicated metrics Service. |
| helm/charts/erpc/templates/service-headless.yaml | Adds an optional headless Service for DNS-based discovery (e.g., HAProxy server-template). |
| helm/charts/erpc/templates/scheduled-backup.yaml | Adds a CNPG ScheduledBackup resource when Postgres is enabled. |
| helm/charts/erpc/templates/rbac-vault.yaml | Adds RBAC for Vault hook jobs to manage secrets. |
| helm/charts/erpc/templates/podmonitor.yaml | Adds a PodMonitor for scraping eRPC metrics. |
| helm/charts/erpc/templates/podmonitor-erpc-db.yaml | Adds a PodMonitor for CNPG metrics when Postgres is enabled. |
| helm/charts/erpc/templates/pg-erpc.yaml | Adds CNPG Cluster manifest with tuning + backup configuration. |
| helm/charts/erpc/templates/pdb.yaml | Adds a PDB for eRPC pods. |
| helm/charts/erpc/templates/monitoring-configmap.yaml | Adds CNPG custom queries ConfigMap for recovery/replication health monitoring. |
| helm/charts/erpc/templates/job-vault-db.yaml | Adds a hook Job to materialize DB credentials from Vault into a Kubernetes Secret. |
| helm/charts/erpc/templates/job-vault-config.yaml | Adds a hook Job that renders config from Vault secrets, validates it, then stores it as a Secret. |
| helm/charts/erpc/templates/image-catalog-pg18.yaml | Adds a CNPG ImageCatalog for Postgres 18 images. |
| helm/charts/erpc/templates/hpa.yaml | Adds an HPA for the eRPC Deployment. |
| helm/charts/erpc/templates/deployment.yaml | Adds the eRPC Deployment, including hardening options and secret-mounted config. |
| helm/charts/erpc/templates/_helpers.tpl | Adds common naming/label helpers and ServiceAccount name logic for the base chart. |
| helm/charts/erpc/README.md | Adds documentation for local dev/testing and Vault placeholder rendering. |
| helm/charts/erpc/docker-compose.yml | Adds a docker-compose file to run eRPC locally with a mounted config. |
| helm/charts/erpc/Chart.yaml | Adds the base eRPC chart definition. |
| helm/charts/erpc/.env.example | Adds an example environment file for local eRPC docker-compose testing. |
| helm/charts/.gitkeep | Keeps the charts directory tracked. |
| .github/workflows/wiz-iac-scan.yml | Adds a Wiz IaC scan workflow gated on helm/** changes. |
| .github/workflows/update-image-tag.yaml | Adds an automation workflow to update production values.yaml image tags via PR. |
| .github/workflows/slack-pr-notification.yaml | Adds Slack notification on merge to morpho-main. |
| .github/workflows/only-values-yaml-guard.yml | Adds a required guard to ensure deployer-bot bypasses reviews only on values.yaml-only PRs. |
| .github/workflows/helm-charts-validation.yaml | Adds CI Helm lint + kubeconform validation for charts under helm/**. |
| .github/CODEOWNERS | Adds/updates CODEOWNERS, including mandatory reviewers for Helm and scripts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Romain Guichard <romain@particule.io>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Romain Guichard <romain@particule.io>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Romain Guichard <romain@particule.io>
Summary
This PR brings the eRPC Helm chart and its production environment configuration into this repository, consolidating application-level deployment config alongside the application code rather than keeping it in a separate infrastructure repository. The migration covers the full production topology: multiple eRPC instances, HAProxy smart load balancers with Prometheus-driven weight and fallback controllers, Redis HA, and a CNPG-managed PostgreSQL cluster.
Two companion fixes are included: security hardening of the validation scripts based on an Aikido review, and bumping the eRPC and erpc-validator image tags to
0.1.3to match the latest production values.Changes
New Helm chart —
helm/charts/erpc/__SECRET_<KEY>__placeholders and generates per-key auth strategies fromAPI_KEY_*entries; an optional dedicated validation init-container (vault.validationImage) runserpc validatebefore the secret is stored in Kubernetes.pg-erpc.yaml) with volume-snapshot or Barman S3 backup, custom autovacuum/checkpoint tuning, and a recovery health monitoring ConfigMap.securityHardening.enabled) implementing the Pod Security Standardsrestrictedprofile (non-root, read-only rootfs, dropped capabilities, seccomp RuntimeDefault).docker-compose.yml,.env.example, andtest-local.sh.Production environment wrapper —
helm/environments/prd/erpc/erpc,erpc-dev,erpc-fallback,erpc-processing,erpc-router), each with independent Vault config paths, resource profiles, and per-instance runtime ServiceAccounts.erpc-haproxy,erpc-processing-haproxy,erpc-router-haproxy), each carrying two sidecar controllers: aweight-controllerthat adjusts per-pod backend weights using goroutine count, P99 latency, request rate, and CPU metrics; and afallback-controllerthat gradually activates the hot-standby fallback pool on sustained degradation and immediately on total outage.PrometheusRulewith recording rules across histogram families, counters, and gauges; latency percentile rules; fallback traffic share rules; and alerting rules for high fallback traffic and actionable failure rates.CI/CD and repo governance
.github/CODEOWNERS: platform-engineers and@0x666c6fas mandatory reviewers on all patterns including/helm/..github/workflows/helm-charts-validation.yaml: three-job pipeline — chart discovery, parallelhelm lint+ kubeconform validation (with database chart skip logic), summary gate..github/workflows/slack-pr-notification.yaml: Slack notification on merge tomorpho-main, skipping bot authors..github/workflows/wiz-iac-scan.yml: Wiz CLI IaC scan triggered on PRs touchinghelm/.validate-helm-charts.sh: local script mirroring CI validation, with GNUparallelsupport and sequential fallback.Aikido security fixes
validate-helm-charts.sh:process_chartusesreturninstead ofexitso the sequential loop always reaches the summary; singlemktemp -dwith unified cleanup viarm -rf; chart path passed directly tohelm dependency update/helm templateinstead ofcd-ing;helm template | kubeconformpipeline split for correct exit-code propagation.test-local.sh:LABELS_SERVICE_API_KEYredacted when echoing the auth response;eth_getLogsblock numbers corrected to a valid 100 000-block range on Arbitrum.Image version bump
values.yaml:erpcanderpc-validatorimage tags updated from0.0.77to0.1.3.Testing
Local validation script
Both the base chart and the prd environment wrapper should report lint and kubeconform passes;
erpc-dband any*postgres*charts are intentionally skipped by kubeconform.CI
Push or open a PR touching
helm/**— theHelm Chart Validationworkflow runs chart discovery, parallel validation, and a summary job that fails the check if any chart fails.Local Docker Compose (eRPC chart)
All seven test cases (health, Ethereum/Arbitrum/Base RPC, auth enforcement,
eth_getLogs, DynamoDB note) should pass.Edge cases to verify
dependencies:inChart.yamlcorrectly triggershelm dependency updatebefore template rendering.process_chartfailures in sequential mode do not abort validation of subsequent charts (thereturnfix).LABELS_SERVICE_API_KEYis configured; the rejection response does not echo the key back in test output.Codex follow-up
agent-harnessrepo-map drift by makingscripts/review-repo-map.shuse deterministic case-insensitive sorting:LC_ALL=C sort -f -u.persist-credentials: falsein Helm validation and Wiz IaC workflows../scripts/agent-harness/update-repo-map.shandmake agent-check.