alchemy-docker-k3s 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -33,6 +33,12 @@ interface K3sDefinition {
33
33
  addons?: {
34
34
  traefik?: boolean;
35
35
  metricsServer?: boolean;
36
+ /**
37
+ * Additional Helm values for K3s' bundled Traefik chart, merged into its HelmChartConfig,
38
+ * e.g. `{ ports: { websecure: { transport: { respondingTimeouts: { readTimeout: "30m" } } } } }`.
39
+ * The Hetzner load-balancer annotation the package sets always wins. Requires `traefik`.
40
+ */
41
+ traefikValues?: Record<string, unknown>;
36
42
  };
37
43
  /** K3s' built-in Flannel data plane. @default "vxlan" */
38
44
  flannelBackend?: "vxlan" | "wireguard-native";
@@ -46,6 +52,7 @@ interface NormalizedK3sDefinition {
46
52
  addons: {
47
53
  traefik: boolean;
48
54
  metricsServer: boolean;
55
+ traefikValues: Record<string, unknown>;
49
56
  };
50
57
  flannelBackend: "vxlan" | "wireguard-native";
51
58
  }
package/dist/index.mjs CHANGED
@@ -60,11 +60,16 @@ const normalizeK3sDefinition = (definition) => {
60
60
  clusterDns: definition.clusterDns ?? "10.43.0.10",
61
61
  addons: {
62
62
  traefik: definition.addons?.traefik ?? true,
63
- metricsServer: definition.addons?.metricsServer ?? true
63
+ metricsServer: definition.addons?.metricsServer ?? true,
64
+ traefikValues: definition.addons?.traefikValues ?? {}
64
65
  },
65
66
  flannelBackend: definition.flannelBackend ?? "vxlan"
66
67
  };
67
68
  if (normalized.flannelBackend !== "vxlan" && normalized.flannelBackend !== "wireguard-native") throw new Error(`flannelBackend must be "vxlan" or "wireguard-native"; received ${JSON.stringify(normalized.flannelBackend)}`);
69
+ const traefikValues = normalized.addons.traefikValues;
70
+ const isJson = (value) => value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value) || Array.isArray(value) && value.every(isJson) || typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype && Object.values(value).every(isJson);
71
+ if (typeof traefikValues !== "object" || traefikValues === null || Array.isArray(traefikValues) || !isJson(traefikValues)) throw new Error("addons.traefikValues must be a plain JSON object of Helm values");
72
+ if (!normalized.addons.traefik && Object.keys(traefikValues).length > 0) throw new Error("addons.traefikValues requires addons.traefik");
68
73
  const ranges = [["clusterCidr", normalized.clusterCidr], ["serviceCidr", normalized.serviceCidr]];
69
74
  for (const [name, cidr] of ranges) if (ipv4CidrRange(cidr) === void 0) throw new Error(`${name} must be an IPv4 CIDR; received ${JSON.stringify(cidr)}`);
70
75
  const clusterRange = ipv4CidrRange(normalized.clusterCidr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alchemy-docker-k3s",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Persistent local k3d clusters for Alchemy",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",