@kumulo/core 0.1.1 → 0.2.0

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.
Files changed (53) hide show
  1. package/dist/cdn-noop/index.d.ts +16 -0
  2. package/dist/config/decode.d.ts +4 -4
  3. package/dist/config/index.d.ts +4 -3
  4. package/dist/config/rule.d.ts +9 -0
  5. package/dist/config/schema.d.ts +326 -293
  6. package/dist/config/yaml.d.ts +3 -3
  7. package/dist/dist-Jz1Fp2MY.mjs +1612 -0
  8. package/dist/dns/index.d.ts +2 -0
  9. package/dist/dns/ownership.d.ts +0 -1
  10. package/dist/dns/reconcile.d.ts +41 -0
  11. package/dist/domain/types.d.ts +94 -22
  12. package/dist/http/client.d.ts +24 -0
  13. package/dist/http/errors.d.ts +31 -0
  14. package/dist/http/index.d.ts +5 -0
  15. package/dist/http/retry-after.d.ts +11 -0
  16. package/dist/index.d.ts +26 -18
  17. package/dist/index.mjs +805 -324
  18. package/dist/k8s/addon.d.ts +14 -0
  19. package/dist/k8s/client.d.ts +11 -4
  20. package/dist/k8s/index.d.ts +6 -3
  21. package/dist/k8s/kubeconfig.d.ts +2 -2
  22. package/dist/k8s/node-ops.d.ts +2 -2
  23. package/dist/k8s/readiness.d.ts +0 -1
  24. package/dist/k8s/resource-ref.d.ts +3 -0
  25. package/dist/outputs/file.d.ts +41 -0
  26. package/dist/outputs/index.d.ts +2 -0
  27. package/dist/paginate.d.ts +43 -0
  28. package/dist/plan/diff.d.ts +0 -5
  29. package/dist/plan/hash.d.ts +3 -1
  30. package/dist/plan/index.d.ts +4 -2
  31. package/dist/plan/rows.d.ts +10 -0
  32. package/dist/plan/types.d.ts +24 -4
  33. package/dist/ports/cdn-provider.d.ts +21 -0
  34. package/dist/ports/cloud-provider.d.ts +3 -1
  35. package/dist/ports/distro.d.ts +2 -29
  36. package/dist/ports/provider-profile.d.ts +2 -18
  37. package/dist/ports/validation.d.ts +3 -3
  38. package/dist/present/decide.d.ts +12 -5
  39. package/dist/present/index.d.ts +1 -3
  40. package/dist/profiles/generic.d.ts +3 -17
  41. package/dist/reconcile/index.d.ts +0 -1
  42. package/dist/reconcile/poll.d.ts +14 -3
  43. package/dist/storage/diff.d.ts +24 -0
  44. package/dist/testing/contract.d.ts +18 -0
  45. package/dist/testing/index.d.ts +2 -0
  46. package/dist/testing/index.mjs +16691 -0
  47. package/package.json +13 -8
  48. package/dist/errors/retryable.d.ts +0 -2
  49. package/dist/ports/addon.d.ts +0 -13
  50. package/dist/present/render.d.ts +0 -2
  51. package/dist/reconcile/apply.d.ts +0 -8
  52. package/dist/reconcile/phases.d.ts +0 -5
  53. package/dist/reconcile/pipeline.d.ts +0 -9
package/dist/index.mjs CHANGED
@@ -1,7 +1,11 @@
1
- import { Context, Data, Effect, Layer, Option, Ref, Schedule, Schema, SchemaIssue } from "effect";
1
+ import { Context, Data, Duration, Effect, Equal, Exit, Layer, Option, Predicate, Random, Redacted, Ref, Result, Schedule, Schema, SchemaIssue, Semaphore } from "effect";
2
2
  import { parse, stringify } from "yaml";
3
- import { HttpClientRequest } from "effect/unstable/http";
4
- //#region src/errors/tagged.ts
3
+ import { FileSystem } from "effect/FileSystem";
4
+ import { HttpClient, HttpClientRequest } from "effect/http";
5
+ import * as HttpClient$1 from "effect/http/HttpClient";
6
+ import * as HttpClientError from "effect/http/HttpClientError";
7
+ import * as HttpClientRequest$1 from "effect/http/HttpClientRequest";
8
+ // src/errors/tagged.ts
5
9
  var HttpTransportError = class extends Data.TaggedError("HttpTransportError") {};
6
10
  var ResponseDecodeError = class extends Data.TaggedError("ResponseDecodeError") {};
7
11
  var AuthenticationFailed = class extends Data.TaggedError("AuthenticationFailed") {};
@@ -18,90 +22,98 @@ var BootstrapFailed = class extends Data.TaggedError("BootstrapFailed") {};
18
22
  var AddonInstallFailed = class extends Data.TaggedError("AddonInstallFailed") {};
19
23
  var BucketNotEmpty = class extends Data.TaggedError("BucketNotEmpty") {};
20
24
  var SinkUnavailable = class extends Data.TaggedError("SinkUnavailable") {};
21
- //#endregion
22
- //#region src/errors/retryable.ts
23
- const retryableByTag = {
24
- HttpTransportError: true,
25
- ResponseDecodeError: false,
26
- AuthenticationFailed: false,
27
- QuotaExceeded: false,
28
- RateLimited: true,
29
- ProviderApiError: true,
30
- ResourceNotFound: false,
31
- ResourceConflict: true,
32
- CapabilityMissing: false,
33
- ProvisioningTimeout: true,
34
- ConfigInvalid: false,
35
- PlanRejected: false,
36
- BootstrapFailed: false,
37
- AddonInstallFailed: false,
38
- BucketNotEmpty: false,
39
- SinkUnavailable: false
40
- };
41
- const isRetryable = (error) => retryableByTag[error._tag];
42
- //#endregion
43
- //#region src/errors/renderer.ts
25
+ // src/errors/renderer.ts
44
26
  const renderError = (args) => args.registry[args.error._tag](args.error);
45
- //#endregion
46
- //#region src/config/schema.ts
27
+ // src/config/rule.ts
28
+ const crossFieldRule = (options) => ({
29
+ filter: Schema.makeFilter(options.check),
30
+ jsonSchema: options.jsonSchema
31
+ });
32
+ // src/config/decode.ts
33
+ const formatIssue = SchemaIssue.makeFormatterStandardSchemaV1();
34
+ const _toPropertyKey = (segment) => Predicate.isObject(segment) ? segment.key : segment;
35
+ const _toConfigInvalid = (error) => new ConfigInvalid({ issues: formatIssue(error.issue).issues.map((issue) => ({
36
+ path: (issue.path ?? []).map(_toPropertyKey),
37
+ message: issue.message
38
+ })) });
39
+ const decodeConfigWith = (schema) => {
40
+ const decode = Schema.decodeUnknownEffect(schema);
41
+ return (input) => decode(input, { errors: "all" }).pipe(Effect.mapError(_toConfigInvalid));
42
+ };
43
+ const encodeConfigWith = (schema) => (config) => Schema.encodeEffect(schema)(config).pipe(Effect.mapError(_toConfigInvalid));
44
+ // src/config/schema.ts
47
45
  const octet = "(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)";
48
46
  const isCidr = Schema.isPattern(new RegExp(`^${octet}\\.${octet}\\.${octet}\\.${octet}/(3[0-2]|[12]?\\d)$`), { message: "must be a CIDR in a.b.c.d/n form with valid octets (0-255) and prefix (0-32)" });
49
47
  const Cidr = Schema.String.check(isCidr);
50
- const isOddCount = Schema.makeFilter((count) => count >= 1 && count % 2 === 1 ? void 0 : "must be 1 or an odd number (embedded etcd quorum)");
48
+ const _ipv4Literal = new RegExp(`^${octet}\\.${octet}\\.${octet}\\.${octet}$`);
49
+ const _ipv6Literal = /^(?!.*:::)(?=(?:[^:]*:){2})(?:[0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/;
50
+ const isIpLiteral = (target) => _ipv4Literal.test(target) || _ipv6Literal.test(target);
51
+ const cidrRange = (cidr) => {
52
+ const [address = "", bits = "0"] = cidr.split("/");
53
+ const size = 2 ** (32 - Number(bits));
54
+ const first = Math.floor(address.split(".").reduce((acc, part) => acc * 256 + Number(part), 0) / size) * size;
55
+ return [first, first + size - 1];
56
+ };
51
57
  const PositiveInt = Schema.Number.check(Schema.isInt(), Schema.isGreaterThan(0));
52
58
  const NonNegativeInt = Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0));
53
59
  const Provider = Schema.Literals([
54
60
  "ovh",
55
61
  "generic",
56
- "hetzner"
62
+ "hetzner",
63
+ "upcloud"
57
64
  ]);
58
- const PublicAccess = Schema.Literals(["bastionless", "nat"]);
59
65
  const AuthMethod = Schema.Literals([
60
66
  "application_credential",
61
67
  "clouds_yaml",
62
68
  "env",
63
69
  "api_token"
64
70
  ]);
65
- const Cni = Schema.Literals(["flannel", "cilium"]);
66
71
  const AccessMode = Schema.Literals([
67
72
  "ReadWriteOnce",
68
73
  "ReadWriteMany",
69
74
  "ReadOnlyMany"
70
75
  ]);
71
- const K3sVersion = Schema.String.check(Schema.isPattern(/^v\d+\.\d+\.\d+\+k3s\d+$/, { message: "must be a k3s version like v1.31.4+k3s1" }));
72
- const PlainK8sVersion = Schema.String.check(Schema.isPattern(/^v?\d+\.\d+\.\d+$/, { message: "must be a Kubernetes version like v1.31.4" }));
73
- const isSecretsRequiredForObjectStorage = Schema.makeFilter((config) => config.object_storage.module === "ovh" && config.secrets.sink === "none" ? "secrets.sink must not be none when object_storage.module is ovh" : void 0);
74
- const isAuthMethodConsistentWithProvider = Schema.makeFilter((config) => config.provider === "hetzner" !== (config.auth.method === "api_token") ? "auth.method must be api_token if and only if provider is hetzner" : void 0);
75
- const isVolumesModuleConsistentWithProvider = Schema.makeFilter((config) => {
76
- if (config.volumes.module === "hcloud" && config.provider !== "hetzner") return "volumes.module hcloud requires provider hetzner";
77
- if (config.volumes.module === "cinder" && config.provider === "hetzner") return "volumes.module cinder is not available on provider hetzner";
78
- });
79
- const isAddonsConsistentWithProvider = Schema.makeFilter((config) => {
80
- if (config.addons === void 0) return void 0;
81
- if (config.addons.hcloud_csi.enabled && config.provider !== "hetzner") return "addons.hcloud_csi can only be enabled when provider is hetzner";
82
- if (config.addons.cinder_csi.enabled && config.provider === "hetzner") return "addons.cinder_csi cannot be enabled when provider is hetzner";
76
+ const authMethodsByProvider = {
77
+ hetzner: ["api_token"],
78
+ upcloud: ["api_token"],
79
+ ovh: [
80
+ "application_credential",
81
+ "clouds_yaml",
82
+ "env"
83
+ ],
84
+ generic: [
85
+ "application_credential",
86
+ "clouds_yaml",
87
+ "env"
88
+ ]
89
+ };
90
+ const secretsRequiredForObjectStorage = crossFieldRule({
91
+ check: (config) => config.object_storage.module !== "none" && config.secrets.sink === "none" ? `secrets.sink must not be none when object_storage.module is ${config.object_storage.module}` : void 0,
92
+ jsonSchema: [{
93
+ if: {
94
+ properties: { object_storage: {
95
+ properties: { module: { not: { const: "none" } } },
96
+ required: ["module"]
97
+ } },
98
+ required: ["object_storage"]
99
+ },
100
+ then: { properties: { secrets: { properties: { sink: { not: { const: "none" } } } } } }
101
+ }]
102
+ });
103
+ const authMethodConsistentWithProvider = crossFieldRule({
104
+ check: (config) => authMethodsByProvider[config.provider].includes(config.auth.method) ? void 0 : `auth.method must be one of ${authMethodsByProvider[config.provider].join(", ")} for provider ${config.provider}`,
105
+ jsonSchema: Object.entries(authMethodsByProvider).map(([provider, methods]) => ({
106
+ if: {
107
+ properties: { provider: { const: provider } },
108
+ required: ["provider"]
109
+ },
110
+ then: { properties: { auth: { properties: { method: { enum: [...methods] } } } } }
111
+ }))
83
112
  });
84
113
  const Auth = Schema.Struct({
85
114
  method: AuthMethod,
86
115
  region: Schema.NonEmptyString
87
116
  });
88
- const Network = Schema.Struct({
89
- cidr: Cidr,
90
- public_access: PublicAccess
91
- });
92
- const ApiServer = Schema.Struct({
93
- high_availability: Schema.Boolean,
94
- allowed_cidrs: Schema.Array(Cidr)
95
- });
96
- const Ssh = Schema.Struct({
97
- public_key_path: Schema.NonEmptyString,
98
- allowed_cidrs: Schema.Array(Cidr)
99
- });
100
- const Masters = Schema.Struct({
101
- flavor: Schema.NonEmptyString,
102
- count: Schema.Number.check(Schema.isInt()).check(isOddCount),
103
- image: Schema.NonEmptyString
104
- });
105
117
  const Autoscaling = Schema.Struct({
106
118
  enabled: Schema.Boolean,
107
119
  min: NonNegativeInt,
@@ -120,7 +132,12 @@ const DnsRecord = Schema.Struct({
120
132
  target: Schema.NonEmptyString
121
133
  });
122
134
  const Dns = Schema.Union([Schema.Struct({ module: Schema.Literal("none") }), Schema.Struct({
123
- module: Schema.Literals(["ovh", "hetzner"]),
135
+ module: Schema.Literals([
136
+ "ovh",
137
+ "hetzner",
138
+ "bunny",
139
+ "godaddy"
140
+ ]),
124
141
  zone: Schema.NonEmptyString,
125
142
  ttl: PositiveInt,
126
143
  records: Schema.Array(DnsRecord)
@@ -160,10 +177,122 @@ const Bucket = Schema.Struct({
160
177
  encryption: Schema.Boolean,
161
178
  retain: Schema.Boolean
162
179
  });
163
- const ObjectStorage = Schema.Union([Schema.Struct({ module: Schema.Literal("none") }), Schema.Struct({
164
- module: Schema.Literal("ovh"),
165
- buckets: Schema.Array(Bucket)
166
- })]);
180
+ const BunnyStorageRegion = Schema.Literals([
181
+ "DE",
182
+ "NY",
183
+ "SG",
184
+ "UK",
185
+ "SE",
186
+ "LA",
187
+ "JH",
188
+ "SYD"
189
+ ]);
190
+ const isBunnyBucketName = Schema.isPattern(/^[A-Za-z0-9-]{4,}$/, { message: "must be at least 4 characters: letters, digits and dashes" });
191
+ const BunnyBucketName = Schema.String.check(isBunnyBucketName);
192
+ const BunnyBucket = Schema.Struct({
193
+ name: BunnyBucketName,
194
+ region: BunnyStorageRegion,
195
+ tier: Schema.optionalKey(Schema.Literals(["standard", "edge"])),
196
+ retain: Schema.Boolean
197
+ });
198
+ const BunnyObjectStorage = Schema.Struct({
199
+ module: Schema.Literal("bunny"),
200
+ buckets: Schema.Array(BunnyBucket)
201
+ });
202
+ const ObjectStorage = Schema.Union([
203
+ Schema.Struct({ module: Schema.Literal("none") }),
204
+ Schema.Struct({
205
+ module: Schema.Literal("ovh"),
206
+ buckets: Schema.Array(Bucket)
207
+ }),
208
+ BunnyObjectStorage
209
+ ]);
210
+ const isHostname = Schema.isPattern(/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/, { message: "must be a lowercase DNS hostname such as app.example.com" });
211
+ const CdnHostname = Schema.String.check(isHostname);
212
+ const isCdnName = Schema.isPattern(/^[A-Za-z0-9]+$/, { message: "must contain letters and digits only" });
213
+ const ShieldPlan = Schema.Literals([
214
+ "basic",
215
+ "advanced",
216
+ "business",
217
+ "enterprise"
218
+ ]);
219
+ const ShieldMode = Schema.Literals(["log", "block"]);
220
+ const RateLimit = Schema.Struct({
221
+ name: Schema.NonEmptyString,
222
+ path_prefix: Schema.NonEmptyString,
223
+ requests: PositiveInt,
224
+ window: PositiveInt,
225
+ block_for: PositiveInt,
226
+ key: Schema.Literals(["ip"])
227
+ });
228
+ const AccessList = Schema.Struct({
229
+ name: Schema.NonEmptyString,
230
+ type: Schema.Literals([
231
+ "cidr",
232
+ "ip",
233
+ "asn",
234
+ "country"
235
+ ]),
236
+ action: Schema.Literals([
237
+ "allow",
238
+ "block",
239
+ "challenge",
240
+ "log"
241
+ ]),
242
+ entries: Schema.Array(Schema.NonEmptyString).check(Schema.isMinLength(1))
243
+ });
244
+ const _isUniqueNames = (label) => Schema.makeFilter((items) => new Set(items.map((item) => item.name)).size === items.length ? void 0 : `${label} names must be unique`);
245
+ const Shield = Schema.Struct({
246
+ plan: ShieldPlan,
247
+ waf: Schema.Struct({
248
+ enabled: Schema.Boolean,
249
+ mode: ShieldMode
250
+ }),
251
+ ddos: Schema.Struct({ sensitivity: Schema.Literals([
252
+ "off",
253
+ "low",
254
+ "medium",
255
+ "high",
256
+ "challenge"
257
+ ]) }),
258
+ bot_detection: Schema.Struct({
259
+ mode: ShieldMode,
260
+ sensitivity: Schema.Literals([
261
+ "low",
262
+ "medium",
263
+ "high"
264
+ ])
265
+ }),
266
+ rate_limits: Schema.Array(RateLimit).check(_isUniqueNames("shield rate_limits")),
267
+ access_lists: Schema.Array(AccessList).check(_isUniqueNames("shield access_lists"))
268
+ });
269
+ const CdnOrigin = Schema.Union([Schema.Literal("ingress"), Schema.Struct({ url: Schema.NonEmptyString })]);
270
+ const BunnyCdn = Schema.Struct({
271
+ module: Schema.Literal("bunny"),
272
+ name: Schema.String.check(isCdnName),
273
+ tier: Schema.Literals(["standard", "volume"]).pipe(Schema.withDecodingDefaultKey(Effect.succeed("standard"))),
274
+ origin: CdnOrigin,
275
+ verify_origin_tls: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(false))),
276
+ websockets: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(true))),
277
+ cache: Schema.Literals(["smart", "origin"]).pipe(Schema.withDecodingDefaultKey(Effect.succeed("smart"))),
278
+ hostnames: Schema.Array(CdnHostname).check(Schema.isMinLength(1), Schema.isMaxLength(10), Schema.isUnique()),
279
+ force_ssl: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(true))),
280
+ shield: Schema.optionalKey(Shield)
281
+ });
282
+ const Cdn = Schema.Union([Schema.Struct({ module: Schema.Literal("none") }), BunnyCdn]);
283
+ const cdnOriginUrlRequired = crossFieldRule({
284
+ check: (config) => config.cdn?.origin === "ingress" ? "cdn.origin ingress is only valid for distro ovh-mks with an ingress block" : void 0,
285
+ jsonSchema: [{
286
+ if: {
287
+ properties: { cdn: {
288
+ properties: { origin: { const: "ingress" } },
289
+ required: ["origin"]
290
+ } },
291
+ required: ["cdn"]
292
+ },
293
+ then: { properties: { distro: { const: "ovh-mks" } } }
294
+ }]
295
+ });
167
296
  const isAgeRecipient = Schema.isPattern(/^age1/, { message: "must be an age recipient key starting with age1" });
168
297
  const Sops = Schema.Struct({ age_recipient: Schema.String.check(isAgeRecipient) });
169
298
  const Secrets = Schema.Union([Schema.Struct({ sink: Schema.Literal("none") }), Schema.Struct({
@@ -171,98 +300,40 @@ const Secrets = Schema.Union([Schema.Struct({ sink: Schema.Literal("none") }), S
171
300
  dir: Schema.NonEmptyString,
172
301
  sops: Sops
173
302
  })]);
174
- const CinderCsi = Schema.Struct({
175
- enabled: Schema.Boolean,
176
- default_volume_type: Schema.NonEmptyString
177
- });
178
- const HcloudCsi = Schema.Struct({ enabled: Schema.Boolean });
179
- const Addons = Schema.Struct({
180
- cloud_controller_manager: Schema.Boolean,
181
- cinder_csi: CinderCsi,
182
- hcloud_csi: HcloudCsi,
183
- system_upgrade_controller: Schema.Boolean,
184
- cni: Cni
185
- });
186
- const K3sPassthrough = Schema.Struct({
187
- extra_server_args: Schema.Array(Schema.String),
188
- extra_agent_args: Schema.Array(Schema.String)
189
- });
190
303
  const OutputsFormat = Schema.Literals(["yaml", "json"]);
191
304
  const Outputs = Schema.Struct({ format: OutputsFormat });
192
- const _commonFields = {
193
- name: Schema.NonEmptyString,
305
+ const isClusterName = Schema.isPattern(/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/, { message: "must be a DNS label: 1-63 lowercase letters, digits or '-', starting and ending alphanumeric" });
306
+ const ClusterName = Schema.String.check(isClusterName);
307
+ const commonClusterFields = {
308
+ name: ClusterName,
194
309
  outputs: Schema.optionalKey(Outputs),
195
310
  auth: Auth,
196
311
  worker_pools: Schema.Array(WorkerPool),
197
312
  volumes: Volumes,
198
313
  object_storage: ObjectStorage,
199
- secrets: Secrets
314
+ secrets: Secrets,
315
+ cdn: Schema.optionalKey(Cdn)
200
316
  };
201
- const K3sClusterConfig = Schema.Struct({
202
- ..._commonFields,
203
- provider: Provider,
204
- distro: Schema.Literal("k3s"),
205
- version: K3sVersion,
206
- dns: Dns,
207
- network: Network,
208
- api_server: ApiServer,
209
- ssh: Ssh,
210
- masters: Masters,
211
- addons: Addons,
212
- k3s: K3sPassthrough
213
- }).check(isSecretsRequiredForObjectStorage, isAuthMethodConsistentWithProvider, isVolumesModuleConsistentWithProvider, isAddonsConsistentWithProvider);
214
- const MksClusterConfig = Schema.Struct({
215
- ..._commonFields,
216
- provider: Schema.Literal("ovh"),
217
- distro: Schema.Literal("ovh-mks"),
218
- version: PlainK8sVersion,
219
- dns: Dns,
220
- volumes: OpenStackVolumes
221
- }).check(isSecretsRequiredForObjectStorage, isAuthMethodConsistentWithProvider);
222
- const ClusterConfig = Schema.Union([K3sClusterConfig, MksClusterConfig]);
223
- //#endregion
224
- //#region src/config/decode.ts
225
- const formatIssue = SchemaIssue.makeFormatterStandardSchemaV1();
226
- const _toPropertyKey = (segment) => typeof segment === "object" ? segment.key : segment;
227
- const _toConfigInvalid = (error) => new ConfigInvalid({ issues: formatIssue(error.issue).issues.map((issue) => ({
228
- path: (issue.path ?? []).map(_toPropertyKey),
229
- message: issue.message
230
- })) });
231
- const decodeConfig = (input) => Schema.decodeUnknownEffect(ClusterConfig)(input, { errors: "all" }).pipe(Effect.mapError(_toConfigInvalid));
232
- const encodeConfig = (config) => Schema.encodeEffect(ClusterConfig)(config).pipe(Effect.mapError(_toConfigInvalid));
233
- //#endregion
234
- //#region src/config/yaml.ts
235
- const parseConfigYaml = (text) => Effect.try({
317
+ // src/config/yaml.ts
318
+ const parseConfigYamlWith = (schema) => (text) => Effect.try({
236
319
  try: () => parse(text),
237
320
  catch: (cause) => new ConfigInvalid({ issues: [{
238
321
  path: [],
239
322
  message: String(cause)
240
323
  }] })
241
- }).pipe(Effect.flatMap(decodeConfig));
324
+ }).pipe(Effect.flatMap(decodeConfigWith(schema)));
242
325
  const stringifyConfigYaml = (config) => stringify(config);
243
- //#endregion
244
- //#region src/ports/addon.ts
245
- var Addon = class extends Context.Service()("@kumulo/core/Addon") {};
246
- //#endregion
247
- //#region src/ports/cloud-provider.ts
326
+ // src/ports/cloud-provider.ts
248
327
  var CloudProvider = class extends Context.Service()("@kumulo/core/CloudProvider") {};
249
- //#endregion
250
- //#region src/ports/credentials-sink.ts
328
+ // src/ports/credentials-sink.ts
251
329
  var CredentialsSink = class extends Context.Service()("@kumulo/core/CredentialsSink") {};
252
- //#endregion
253
- //#region src/ports/distro.ts
254
- var Distro = class extends Context.Service()("@kumulo/core/Distro") {};
255
- //#endregion
256
- //#region src/ports/dns-provider.ts
330
+ // src/ports/dns-provider.ts
257
331
  var DnsProvider = class extends Context.Service()("@kumulo/core/DnsProvider") {};
258
- //#endregion
259
- //#region src/ports/object-storage-provider.ts
332
+ // src/ports/object-storage-provider.ts
260
333
  var ObjectStorageProvider = class extends Context.Service()("@kumulo/core/ObjectStorageProvider") {};
261
- //#endregion
262
- //#region src/ports/provider-profile.ts
334
+ // src/ports/provider-profile.ts
263
335
  var ProviderProfile = class extends Context.Service()("@kumulo/core/ProviderProfile") {};
264
- //#endregion
265
- //#region src/domain/capabilities.ts
336
+ // src/domain/capabilities.ts
266
337
  const distroCapabilities = {
267
338
  "k3s": {
268
339
  autoscaling: false,
@@ -271,161 +342,420 @@ const distroCapabilities = {
271
342
  "ovh-mks": {
272
343
  autoscaling: true,
273
344
  selectableCni: false
345
+ },
346
+ "upcloud-uks": {
347
+ autoscaling: false,
348
+ selectableCni: false
274
349
  }
275
350
  };
276
- //#endregion
277
- //#region src/ports/validation.ts
278
- const validateAutoscaling = (config) => !distroCapabilities[config.distro].autoscaling && config.worker_pools.some((pool) => pool.autoscaling?.enabled === true) ? Option.some(new PlanRejected({ reason: "autoscaling is not yet implemented for k3s" })) : Option.none();
279
- const validateCni = (config) => !distroCapabilities[config.distro].selectableCni && config.addons.cni === "cilium" ? Option.some(new PlanRejected({ reason: "cilium is not selectable under ovh-mks; CNI is fixed by OVH" })) : Option.none();
280
- //#endregion
281
- //#region src/ports/volume-provider.ts
351
+ // src/ports/validation.ts
352
+ const validateAutoscaling = (config) => !distroCapabilities[config.distro].autoscaling && config.worker_pools.some((pool) => pool.autoscaling?.enabled === true) ? Option.some(new PlanRejected({ reason: `autoscaling is not yet implemented for ${config.distro}` })) : Option.none();
353
+ const validateCni = (config) => !distroCapabilities[config.distro].selectableCni && config.addons.cni === "cilium" ? Option.some(new PlanRejected({ reason: `cilium is not selectable under ${config.distro}; CNI is fixed by the provider` })) : Option.none();
354
+ // src/ports/volume-provider.ts
282
355
  var VolumeProvider = class extends Context.Service()("@kumulo/core/VolumeProvider") {};
283
- //#endregion
284
- //#region src/plan/hash.ts
285
- const _canonical = (value) => Array.isArray(value) ? value.map(_canonical) : value !== null && typeof value === "object" ? Object.fromEntries(Object.entries(value).toSorted(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, entry]) => [key, _canonical(entry)])) : value;
356
+ // src/plan/hash.ts
357
+ const _compareKeys = ([a], [b]) => a < b ? -1 : a > b ? 1 : 0;
286
358
  const _fnv1a = (text) => [...text].reduce((hash, char) => BigInt.asUintN(64, (hash ^ BigInt(char.codePointAt(0) ?? 0)) * 1099511628211n), 14695981039346656037n);
287
359
  const CONFIG_HASH_KEY = "kumulo-config-hash";
288
- const configHash = (spec) => _fnv1a(JSON.stringify(_canonical(spec)) ?? "undefined").toString(16).padStart(16, "0");
289
- //#endregion
290
- //#region src/plan/naming.ts
360
+ const configHash = (spec) => _fnv1a(JSON.stringify(spec, (_key, value) => Predicate.isObject(value) ? Object.fromEntries(Object.entries(value).toSorted(_compareKeys)) : value) ?? "undefined").toString(16).padStart(16, "0");
361
+ const serverConfigHash = (spec) => {
362
+ const { userData: _userData, networkId: _networkId, ...rest } = spec;
363
+ return configHash(rest);
364
+ };
365
+ // src/plan/naming.ts
291
366
  const resourceName = ({ cluster, role, pool, index }) => `kumulo-${cluster}-${role}-${pool}-${index}`;
292
- //#endregion
293
- //#region src/plan/diff.ts
367
+ // src/plan/types.ts
368
+ const PlanAction = Data.taggedEnum();
369
+ // src/plan/diff.ts
294
370
  const toTaggedResource = (desired) => ({
295
371
  name: resourceName(desired),
296
372
  configHash: configHash(desired.spec)
297
373
  });
298
374
  const _actionFor = (desired, actual) => {
299
375
  const name = resourceName(desired);
300
- if (actual === void 0) return {
301
- _tag: "Create",
302
- name
303
- };
304
- if (actual.configHash === void 0) return {
305
- _tag: "NoOp",
306
- name
307
- };
308
- return actual.configHash === configHash(desired.spec) ? {
309
- _tag: "NoOp",
310
- name
311
- } : {
312
- _tag: "ReplaceNeedsConfirm",
376
+ if (actual === void 0) return PlanAction.Create({ name });
377
+ if (actual.configHash === void 0) return PlanAction.NoOp({ name });
378
+ return actual.configHash === configHash(desired.spec) ? PlanAction.NoOp({ name }) : PlanAction.ReplaceNeedsConfirm({
313
379
  name,
314
380
  reason: "config-hash drifted from desired spec"
315
- };
381
+ });
316
382
  };
317
- /**
318
- * The names the plan says must be replaced. Callers hand this to the
319
- * reconciler *only* once the operator confirmed, so execution never
320
- * re-derives replace intent from names or inventory.
321
- */
322
- const namesToReplace = (plan) => new Set(plan.actions.filter((action) => action._tag === "ReplaceNeedsConfirm").map((action) => action.name));
383
+ const namesToReplace = (plan) => new Set(plan.actions.flatMap((action) => PlanAction.$is("ReplaceNeedsConfirm")(action) ? [action.name] : []));
323
384
  const computePlan = ({ actual, desired }) => {
324
385
  const byName = new Map(actual.map((resource) => [resource.name, resource]));
325
386
  const desiredNames = new Set(desired.map(resourceName));
326
- return { actions: [...desired.map((resource) => _actionFor(resource, byName.get(resourceName(resource)))), ...actual.filter((resource) => !desiredNames.has(resource.name)).map((resource) => ({
327
- _tag: "Delete",
328
- name: resource.name
329
- }))] };
387
+ return { actions: [...desired.map((resource) => _actionFor(resource, byName.get(resourceName(resource)))), ...actual.filter((resource) => !desiredNames.has(resource.name)).map((resource) => PlanAction.Delete({ name: resource.name }))] };
330
388
  };
331
- //#endregion
332
- //#region src/reconcile/poll.ts
333
- const pollUntil = (options) => Effect.gen(function* () {
389
+ // src/plan/rows.ts
390
+ const deleteRow = ({ live, name, retain }) => !live ? PlanAction.NoOp({ name: `${name} (already absent)` }) : retain ? PlanAction.NoOp({ name: `${name} (retained)` }) : PlanAction.Delete({ name });
391
+ const createOrNoOp = ({ exists, name }) => exists ? PlanAction.NoOp({ name }) : PlanAction.Create({ name });
392
+ // src/paginate.ts
393
+ var PaginationLimitExceeded = class extends Data.TaggedError("PaginationLimitExceeded") {};
394
+ var PaginationStalled = class extends Data.TaggedError("PaginationStalled") {};
395
+ const paginate = (options) => Effect.gen(function* () {
396
+ const all = [];
397
+ let cursor = options.initial;
398
+ for (let pages = 1; pages <= options.maxPages; pages++) {
399
+ const page = yield* options.fetch(cursor);
400
+ const items = options.items(page);
401
+ all.push(...items);
402
+ const next = options.next({
403
+ page,
404
+ cursor,
405
+ items
406
+ });
407
+ if (next === void 0) return all;
408
+ if (Equal.equals(next, cursor)) return yield* new PaginationStalled({
409
+ cursor: String(cursor),
410
+ pages
411
+ });
412
+ cursor = next;
413
+ }
414
+ return yield* new PaginationLimitExceeded({ maxPages: options.maxPages });
415
+ });
416
+ const paginateByPage = (options) => paginate({
417
+ initial: options.firstPage ?? 1,
418
+ fetch: options.fetch,
419
+ items: options.items,
420
+ next: ({ cursor, items }) => items.length < options.perPage ? void 0 : cursor + 1,
421
+ maxPages: options.maxPages
422
+ });
423
+ const paginateByOffset = (options) => paginate({
424
+ initial: 0,
425
+ fetch: options.fetch,
426
+ items: options.items,
427
+ next: ({ cursor, items }) => items.length < options.limit || items.length === 0 ? void 0 : cursor + items.length,
428
+ maxPages: options.maxPages
429
+ });
430
+ // src/outputs/file.ts
431
+ var OutputsInvalid = class extends Data.TaggedError("OutputsInvalid") {};
432
+ const _tmpName = (path) => `${path}.tmp-${process.pid}-${Date.now()}`;
433
+ const makeOutputsFile = (options) => {
434
+ const path = ({ dir, format = "yaml", tag }) => `${dir.endsWith("/") ? dir.slice(0, -1) : dir}/${tag}.${options.suffix}.${format}`;
435
+ const decode = (input) => Schema.decodeUnknownEffect(options.schema)(input).pipe(Effect.mapError((cause) => new OutputsInvalid({ message: String(cause) })));
436
+ const parseYaml = (text) => Effect.try({
437
+ try: () => parse(text),
438
+ catch: (cause) => new OutputsInvalid({ message: String(cause) })
439
+ }).pipe(Effect.flatMap(decode));
440
+ const stringifyFile = ({ file, format = "yaml" }) => {
441
+ const ordered = options.order ? options.order(file) : file;
442
+ return format === "json" ? `${JSON.stringify(ordered, null, 2)}\n` : stringify(ordered);
443
+ };
444
+ const read = ({ dir, format = "yaml", tag }) => Effect.gen(function* () {
445
+ const fs = yield* FileSystem;
446
+ const other = format === "yaml" ? "json" : "yaml";
447
+ for (const candidate of [format, other]) {
448
+ const candidatePath = path({
449
+ dir,
450
+ tag,
451
+ format: candidate
452
+ });
453
+ if (yield* fs.exists(candidatePath)) return yield* parseYaml(yield* fs.readFileString(candidatePath));
454
+ }
455
+ return options.empty(tag);
456
+ });
457
+ const write = ({ dir, file, format = "yaml" }) => Effect.gen(function* () {
458
+ const fs = yield* FileSystem;
459
+ const target = path({
460
+ dir,
461
+ tag: options.clusterOf(file),
462
+ format
463
+ });
464
+ const tmp = _tmpName(target);
465
+ yield* fs.writeFileString(tmp, stringifyFile({
466
+ file,
467
+ format
468
+ }), { mode: 384 });
469
+ yield* fs.rename(tmp, target).pipe(Effect.tapError(() => Effect.ignore(fs.remove(tmp))));
470
+ });
471
+ return {
472
+ path,
473
+ decode,
474
+ parseYaml,
475
+ stringify: stringifyFile,
476
+ read,
477
+ write,
478
+ empty: options.empty
479
+ };
480
+ };
481
+ // src/storage/diff.ts
482
+ const diffBuckets = ({ desired, existing, isImmutable, isMutable }) => {
483
+ const byName = new Map(existing.map((bucket) => [bucket.name, bucket]));
484
+ const desiredNames = new Set(desired.map((bucket) => bucket.name));
485
+ const toCreate = [];
486
+ const toReplace = [];
487
+ const toUpdate = [];
488
+ const noop = [];
489
+ for (const spec of desired) {
490
+ const match = byName.get(spec.name);
491
+ if (!match) toCreate.push(spec);
492
+ else if (isImmutable(spec, match)) toReplace.push({
493
+ existing: match,
494
+ spec
495
+ });
496
+ else if (isMutable?.(spec, match) === true) toUpdate.push({
497
+ existing: match,
498
+ spec
499
+ });
500
+ else noop.push(match);
501
+ }
502
+ return {
503
+ toCreate,
504
+ toReplace,
505
+ toUpdate,
506
+ toDelete: existing.filter((bucket) => !desiredNames.has(bucket.name) && !bucket.retain),
507
+ noop
508
+ };
509
+ };
510
+ // src/reconcile/poll.ts
511
+ const _describe = (status) => Predicate.isObjectOrArray(status) ? JSON.stringify(status) : String(status);
512
+ function pollUntil(options) {
513
+ return _poll(options);
514
+ }
515
+ const _poll = (options) => Effect.gen(function* () {
334
516
  const last = yield* Ref.make(void 0);
335
- return yield* options.check.pipe(Effect.tap((status) => Ref.set(last, status)), Effect.repeat({
336
- until: options.isDone,
517
+ const tolerated = yield* Ref.make(0);
518
+ const allowed = options.tolerateNotFound ?? 0;
519
+ const failFast = (status) => options.isFailed?.(status) === true ? Effect.fail(new ProviderApiError({
520
+ operation: `${options.kind} ${options.ref}`,
521
+ status: 0,
522
+ body: `entered state "failed"`
523
+ })) : Effect.void;
524
+ return yield* (allowed === 0 ? options.check : options.check.pipe(Effect.catchIf((error) => Predicate.isTagged(error, "ResourceNotFound"), (error) => Ref.modify(tolerated, (count) => [count < allowed, count + 1]).pipe(Effect.flatMap((skip) => skip ? Effect.succeed(void 0) : Effect.fail(error)))))).pipe(Effect.tap((status) => status === void 0 ? Effect.void : Ref.set(last, status).pipe(Effect.andThen(failFast(status)))), Effect.repeat({
525
+ until: (status) => status !== void 0 && options.isDone(status),
337
526
  schedule: Schedule.spaced(options.interval)
338
- })).pipe(Effect.timeoutOrElse({
527
+ }), Effect.flatMap((status) => status === void 0 ? Effect.never : Effect.succeed(status))).pipe(Effect.timeoutOrElse({
339
528
  duration: options.timeout,
340
- orElse: () => Ref.get(last).pipe(Effect.flatMap((status) => Effect.fail(new ProvisioningTimeout({
529
+ orElse: () => Ref.get(last).pipe(Effect.flatMap((status) => Effect.fail(options.onTimeout ? options.onTimeout(status) : new ProvisioningTimeout({
341
530
  kind: options.kind,
342
531
  ref: options.ref,
343
- lastStatus: status === void 0 ? "unknown" : String(status)
532
+ lastStatus: status === void 0 ? "unknown" : (options.describe ?? _describe)(status)
344
533
  }))))
345
534
  }));
346
535
  });
347
- //#endregion
348
- //#region src/reconcile/apply.ts
349
- const applyServers = ({ concurrency, specs }) => Effect.gen(function* () {
350
- const cloudProvider = yield* CloudProvider;
351
- yield* Effect.forEach(specs, cloudProvider.ensureServer, {
352
- concurrency,
353
- discard: true
354
- });
355
- });
356
- //#endregion
357
- //#region src/present/decide.ts
536
+ // src/present/decide.ts
537
+ const PlanDecision = Data.taggedEnum();
358
538
  const decidePlanAction = ({ plan, yes, dryRun }) => {
359
- if (dryRun) return { _tag: "DryRun" };
360
- if (plan.actions.every((action) => action._tag === "NoOp")) return { _tag: "NothingToDo" };
361
- if (yes) return { _tag: "Proceed" };
362
- return { _tag: "NeedsConfirm" };
363
- };
364
- //#endregion
365
- //#region src/present/render.ts
366
- const _renderLine = (action) => {
367
- if (action._tag === "Create") return ` + ${action.name}`;
368
- if (action._tag === "Delete") return ` - ${action.name}`;
369
- if (action._tag === "NoOp") return ` = ${action.name}`;
370
- if (action._tag === "Update") return ` ~ ${action.name} (${action.reason})`;
371
- return ` -/+ ${action.name} (${action.reason})`;
372
- };
373
- const _count = (actions, tag) => actions.filter((action) => action._tag === tag).length;
374
- const _groupOrder = [
375
- "Create",
376
- "Update",
377
- "ReplaceNeedsConfirm",
378
- "Delete",
379
- "NoOp"
380
- ];
381
- const renderPlan = (plan) => {
382
- const summary = `Plan: ${_count(plan.actions, "Create")} to create, ${_count(plan.actions, "Delete")} to delete, ${_count(plan.actions, "Update")} to update, ${_count(plan.actions, "ReplaceNeedsConfirm")} to replace, ${_count(plan.actions, "NoOp")} unchanged.`;
383
- if (plan.actions.length === 0) return summary;
384
- return [
385
- summary,
386
- "",
387
- ..._groupOrder.flatMap((tag) => plan.actions.filter((action) => action._tag === tag)).map(_renderLine)
388
- ].join("\n");
539
+ if (dryRun) return PlanDecision.DryRun();
540
+ if (plan.actions.every(PlanAction.$is("NoOp"))) return PlanDecision.NothingToDo();
541
+ if (yes) return PlanDecision.Proceed();
542
+ return PlanDecision.NeedsConfirm();
389
543
  };
390
- //#endregion
391
- //#region src/profiles/generic.ts
392
- const genericProfile = {
393
- name: "generic",
394
- auth: {
395
- keystoneUrlPattern: "",
396
- domainDefault: "Default"
397
- },
398
- capabilities: {
399
- octavia: (_region) => true,
400
- floatingIps: true,
401
- volumeTypes: []
402
- },
403
- defaults: {
404
- externalNetworkName: "",
405
- imageAliases: {},
406
- dnsServers: []
407
- },
408
- validate: (_config) => Effect.void
544
+ // src/profiles/generic.ts
545
+ const genericProfile = { validate: (config) => _validateCrossDistro(config) };
546
+ const _validateCrossDistro = (config) => {
547
+ const issues = [validateAutoscaling(config), validateCni(config)].flatMap(Option.toArray).map((violation) => ({
548
+ path: [],
549
+ message: violation.reason
550
+ }));
551
+ return issues.length === 0 ? Effect.void : Effect.fail(new ConfigInvalid({ issues }));
409
552
  };
410
553
  const genericProfileLive = Layer.succeed(ProviderProfile, genericProfile);
411
- //#endregion
412
- //#region src/dns-noop/index.ts
554
+ // src/ports/cdn-provider.ts
555
+ var CdnProvider = class extends Context.Service()("@kumulo/core/CdnProvider") {};
556
+ // src/cdn-noop/index.ts
557
+ const cdnNoop = CdnProvider.of({
558
+ ensureEdge: (spec) => Effect.succeed({
559
+ ref: {
560
+ id: spec.name,
561
+ name: spec.name
562
+ },
563
+ originUrl: spec.originUrl,
564
+ verifyOriginTls: spec.verifyOriginTls,
565
+ websockets: spec.websockets,
566
+ cache: spec.cache,
567
+ tier: spec.tier,
568
+ forceSsl: spec.forceSsl,
569
+ defaultHostname: "",
570
+ hostnames: spec.hostnames,
571
+ certificatesIssued: []
572
+ }),
573
+ ensureCertificates: () => Effect.void,
574
+ ensureSecurity: () => Effect.void,
575
+ describeEdge: (ref) => Effect.fail(new ResourceNotFound({
576
+ kind: "edge",
577
+ ref: ref.name
578
+ })),
579
+ deleteEdge: () => Effect.void
580
+ });
581
+ const cdnNoopLive = Layer.succeed(CdnProvider, cdnNoop);
582
+ // src/dns-noop/index.ts
413
583
  const dnsNoop = {
414
584
  ensureRecords: () => Effect.void,
415
585
  removeClusterRecords: () => Effect.void
416
586
  };
417
587
  const dnsNoopLive = Layer.succeed(DnsProvider, dnsNoop);
418
- //#endregion
419
- //#region src/dns/ownership.ts
588
+ // src/dns/ownership.ts
420
589
  const OWNERSHIP_PREFIX = "kumulo.cluster=";
421
590
  const ownershipTarget = (tag) => `${OWNERSHIP_PREFIX}${tag}`;
422
591
  const ownerTagOf = (target) => target.startsWith("kumulo.cluster=") ? target.slice(15) : void 0;
423
592
  const _isIpv4 = (target) => /^\d{1,3}(\.\d{1,3}){3}$/.test(target) && target.split(".").every((o) => Number(o) <= 255);
424
593
  const _isIpv6 = (target) => target.includes(":") && /^[0-9a-fA-F:]+$/.test(target);
425
- /** Record type inferred from the resolved target value (no explicit field on `DesiredRecord`). */
426
594
  const recordKind = (target) => ownerTagOf(target) !== void 0 ? "TXT" : _isIpv4(target) ? "A" : _isIpv6(target) ? "AAAA" : "CNAME";
427
- //#endregion
428
- //#region src/k8s/client.ts
595
+ // src/dns/reconcile.ts
596
+ const _DEFAULT_TTL = 600;
597
+ const _isManaged = (record) => record.type === "A" || record.type === "AAAA" || record.type === "CNAME";
598
+ const _isOwnershipRecord = (record) => ownerTagOf(record.target) !== void 0;
599
+ const _conflict = ({ zone, name }) => new ResourceConflict({
600
+ kind: "dns-record",
601
+ ref: `${zone}/${name}`
602
+ });
603
+ const reconcileDns = (adapter) => {
604
+ const ttl = adapter.ttl ?? _DEFAULT_TTL;
605
+ const canon = (record) => adapter.canonical({
606
+ type: record.type,
607
+ value: record.value
608
+ });
609
+ const nameOf = (zone) => (record) => adapter.normalize({
610
+ name: record.name,
611
+ zone
612
+ });
613
+ const ownerTagOfRecord = (record) => record.type === "TXT" ? ownerTagOf(canon(record)) : void 0;
614
+ const converge = Effect.fn("dns.converge")(function* ({ zone, name, type, value, existing }) {
615
+ const [keep, ...surplus] = existing;
616
+ const record = {
617
+ name,
618
+ type,
619
+ value,
620
+ ttl
621
+ };
622
+ if (keep === void 0) yield* adapter.create({
623
+ zone,
624
+ record
625
+ });
626
+ else if (canon(keep) !== adapter.canonical({
627
+ type,
628
+ value
629
+ }) || keep.ttl !== ttl) yield* adapter.update({
630
+ zone,
631
+ existing: keep,
632
+ record
633
+ });
634
+ yield* Effect.forEach(surplus, (r) => adapter.delete({
635
+ zone,
636
+ record: r
637
+ }), { discard: true });
638
+ });
639
+ const ensureName = Effect.fn("dns.ensureName")(function* ({ zone, name, target, ownerTarget, snapshot }) {
640
+ const here = snapshot.filter((r) => nameOf(zone)(r) === name);
641
+ const ownerTxts = here.filter((r) => ownerTagOfRecord(r) !== void 0);
642
+ const managed = here.filter(_isManaged);
643
+ const ownerCanonical = ownerTarget === void 0 ? void 0 : adapter.canonical({
644
+ type: "TXT",
645
+ value: ownerTarget
646
+ });
647
+ if (ownerTxts.some((r) => canon(r) !== ownerCanonical) || target !== void 0 && managed.length > 0 && ownerTxts.length === 0) return yield* Effect.fail(_conflict({
648
+ zone,
649
+ name
650
+ }));
651
+ if (ownerTarget !== void 0) yield* converge({
652
+ zone,
653
+ name,
654
+ type: "TXT",
655
+ value: ownerTarget,
656
+ existing: ownerTxts
657
+ });
658
+ if (target === void 0) return;
659
+ const kind = recordKind(target);
660
+ yield* Effect.forEach(managed.filter((r) => r.type !== kind), (r) => adapter.delete({
661
+ zone,
662
+ record: r
663
+ }), { discard: true });
664
+ yield* converge({
665
+ zone,
666
+ name,
667
+ type: kind,
668
+ value: target,
669
+ existing: managed.filter((r) => r.type === kind)
670
+ });
671
+ });
672
+ return {
673
+ ensureRecords: (zone, records) => Effect.gen(function* () {
674
+ const snapshot = yield* adapter.list(zone);
675
+ const names = [...new Set(records.map(nameOf(zone)))];
676
+ for (const name of names) {
677
+ const at = records.filter((r) => nameOf(zone)(r) === name);
678
+ const ownerTarget = at.find(_isOwnershipRecord)?.target;
679
+ const targets = at.filter((r) => !_isOwnershipRecord(r));
680
+ if (targets.length > 1) return yield* Effect.fail(_conflict({
681
+ zone,
682
+ name
683
+ }));
684
+ yield* ensureName({
685
+ zone,
686
+ name,
687
+ target: targets[0]?.target,
688
+ ownerTarget,
689
+ snapshot
690
+ });
691
+ }
692
+ }),
693
+ removeClusterRecords: (zone, tag) => Effect.gen(function* () {
694
+ const snapshot = yield* adapter.list(zone);
695
+ const owned = /* @__PURE__ */ new Set();
696
+ const contested = /* @__PURE__ */ new Set();
697
+ for (const r of snapshot) {
698
+ const owner = ownerTagOfRecord(r);
699
+ if (owner === tag) owned.add(nameOf(zone)(r));
700
+ else if (owner !== void 0) contested.add(nameOf(zone)(r));
701
+ }
702
+ const doomed = snapshot.filter((r) => {
703
+ const name = nameOf(zone)(r);
704
+ return owned.has(name) && !contested.has(name) && (_isManaged(r) || ownerTagOfRecord(r) === tag);
705
+ });
706
+ yield* Effect.forEach(doomed, (r) => adapter.delete({
707
+ zone,
708
+ record: r
709
+ }), { discard: true });
710
+ })
711
+ };
712
+ };
713
+ const reconcileDnsLive = (adapter) => Layer.succeed(DnsProvider, reconcileDns(adapter));
714
+ // src/k8s/kubeconfig.ts
715
+ const _invalid = (message) => new ConfigInvalid({ issues: [{
716
+ path: [],
717
+ message
718
+ }] });
719
+ const _base64Decode = (value) => globalThis.atob(value);
720
+ const _KubeconfigDoc = Schema.Struct({
721
+ clusters: Schema.optional(Schema.Array(Schema.Struct({ cluster: Schema.optional(Schema.Struct({
722
+ server: Schema.optional(Schema.String),
723
+ "certificate-authority-data": Schema.optional(Schema.String)
724
+ })) }))),
725
+ users: Schema.optional(Schema.Array(Schema.Struct({ user: Schema.optional(Schema.Struct({
726
+ token: Schema.optional(Schema.String),
727
+ "client-certificate-data": Schema.optional(Schema.String),
728
+ "client-key-data": Schema.optional(Schema.String)
729
+ })) })))
730
+ });
731
+ const _parseAuth = (user) => {
732
+ if (user?.token !== void 0) return {
733
+ kind: "token",
734
+ token: Redacted.make(user.token)
735
+ };
736
+ const certData = user?.["client-certificate-data"];
737
+ const keyData = user?.["client-key-data"];
738
+ if (certData !== void 0 && keyData !== void 0) return {
739
+ kind: "clientCert",
740
+ certPem: _base64Decode(certData),
741
+ keyPem: _base64Decode(keyData)
742
+ };
743
+ };
744
+ const parseKubeconfig = (text) => Effect.try({
745
+ try: () => parse(text),
746
+ catch: (cause) => _invalid(String(cause))
747
+ }).pipe(Effect.flatMap((yaml) => Schema.decodeUnknownEffect(_KubeconfigDoc)(yaml).pipe(Effect.mapError(() => _invalid("kubeconfig is not a valid document")))), Effect.flatMap((doc) => {
748
+ const cluster = doc.clusters?.[0]?.cluster;
749
+ const user = doc.users?.[0]?.user;
750
+ const auth = _parseAuth(user);
751
+ if (cluster?.server === void 0 || auth === void 0) return Effect.fail(_invalid("kubeconfig missing cluster.server or a token/client-cert user"));
752
+ return Effect.succeed({
753
+ server: cluster.server,
754
+ caPem: cluster["certificate-authority-data"] === void 0 ? void 0 : _base64Decode(cluster["certificate-authority-data"]),
755
+ auth
756
+ });
757
+ }));
758
+ // src/k8s/client.ts
429
759
  var K8sClient = class extends Context.Service()("@kumulo/core/K8sClient") {};
430
760
  const _transportError = (cause) => new HttpTransportError({ cause });
431
761
  const _statusError = (ref, status) => status === 404 ? new ResourceNotFound({
@@ -435,26 +765,28 @@ const _statusError = (ref, status) => status === 404 ? new ResourceNotFound({
435
765
  const K8sManifestSchema = Schema.StructWithRest(Schema.Struct({
436
766
  apiVersion: Schema.String,
437
767
  kind: Schema.String
438
- }), [Schema.Record(Schema.String, Schema.Unknown)]);
768
+ }), [Schema.Record(Schema.String, Schema.Json)]);
439
769
  const K8sListSchema = Schema.Struct({ items: Schema.optional(Schema.Array(Schema.Unknown)) });
440
- const _emptyListing = { items: [] };
441
770
  const _url = (server, path) => new URL(path, server);
442
- const _decodeManifest = (body) => Schema.decodeUnknownEffect(K8sManifestSchema)(body).pipe(Effect.mapError(() => _transportError("response body was not a K8s manifest")));
443
- const _decodeManifestOption = (item) => Schema.decodeUnknownEffect(K8sManifestSchema)(item).pipe(Effect.option);
771
+ const _decodeManifest = Schema.decodeUnknownEffect(K8sManifestSchema);
772
+ const _manifestError = () => _transportError("response body was not a K8s manifest");
444
773
  const makeK8sClient = (options) => {
445
774
  const { client, server } = options;
446
775
  const get = (ref) => Effect.gen(function* () {
447
776
  const response = yield* client.execute(HttpClientRequest.get(_url(server, ref.path))).pipe(Effect.mapError(_transportError));
448
777
  if (response.status !== 200) return yield* Effect.fail(_statusError(ref, response.status));
449
778
  const body = yield* response.json.pipe(Effect.mapError(_transportError));
450
- return yield* _decodeManifest(body);
779
+ return yield* _decodeManifest(body).pipe(Effect.mapError(_manifestError));
451
780
  });
452
781
  const list = (ref) => Effect.gen(function* () {
453
782
  const response = yield* client.execute(HttpClientRequest.get(_url(server, ref.path))).pipe(Effect.mapError(_transportError));
454
783
  if (response.status !== 200) return yield* Effect.fail(_transportError(`status ${response.status}`));
455
784
  const body = yield* response.json.pipe(Effect.mapError(_transportError));
456
- const listing = yield* Schema.decodeUnknownEffect(K8sListSchema)(body).pipe(Effect.orElseSucceed(() => _emptyListing));
457
- return (yield* Effect.forEach(listing.items ?? [], _decodeManifestOption)).flatMap(Option.toArray);
785
+ const listing = yield* Schema.decodeUnknownEffect(K8sListSchema)(body).pipe(Effect.mapError((error) => new ResponseDecodeError({
786
+ endpoint: ref.path,
787
+ issue: error.issue
788
+ })));
789
+ return (yield* Effect.forEach(listing.items ?? [], (item) => Effect.option(_decodeManifest(item)))).flatMap(Option.toArray);
458
790
  });
459
791
  const apply = (ref, manifest) => Effect.gen(function* () {
460
792
  const request = HttpClientRequest.patch(_url(server, `${ref.path}?fieldManager=kumulo&force=true`)).pipe(HttpClientRequest.bodyText(_toYaml(manifest), "application/apply-patch+yaml"));
@@ -465,7 +797,7 @@ const makeK8sClient = (options) => {
465
797
  }));
466
798
  if (response.status !== 200 && response.status !== 201) return yield* Effect.fail(_transportError(`status ${response.status}`));
467
799
  const body = yield* response.json.pipe(Effect.mapError(_transportError));
468
- return yield* _decodeManifest(body);
800
+ return yield* _decodeManifest(body).pipe(Effect.mapError(_manifestError));
469
801
  });
470
802
  const deleteResource = (ref) => client.execute(HttpClientRequest.delete(_url(server, ref.path))).pipe(Effect.mapError(_transportError), Effect.flatMap((response) => response.status === 200 || response.status === 202 || response.status === 404 ? Effect.void : Effect.fail(_statusError(ref, response.status))));
471
803
  const evict = (namespace, pod) => Effect.gen(function* () {
@@ -499,61 +831,24 @@ const makeK8sClient = (options) => {
499
831
  evict
500
832
  };
501
833
  };
502
- const _toYaml = (manifest) => JSON.stringify(manifest);
503
- //#endregion
504
- //#region src/k8s/kubeconfig.ts
505
- const _invalid = (message) => new ConfigInvalid({ issues: [{
506
- path: [],
507
- message
508
- }] });
509
- const _base64Decode = (value) => globalThis.atob(value);
510
- const _KubeconfigDoc = Schema.Struct({
511
- clusters: Schema.optional(Schema.Array(Schema.Struct({ cluster: Schema.optional(Schema.Struct({
512
- server: Schema.optional(Schema.String),
513
- "certificate-authority-data": Schema.optional(Schema.String)
514
- })) }))),
515
- users: Schema.optional(Schema.Array(Schema.Struct({ user: Schema.optional(Schema.Struct({
516
- token: Schema.optional(Schema.String),
517
- "client-certificate-data": Schema.optional(Schema.String),
518
- "client-key-data": Schema.optional(Schema.String)
519
- })) })))
520
- });
521
- const _parseAuth = (user) => {
522
- if (user?.token !== void 0) return {
523
- kind: "token",
524
- token: user.token
525
- };
526
- const certData = user?.["client-certificate-data"];
527
- const keyData = user?.["client-key-data"];
528
- if (certData !== void 0 && keyData !== void 0) return {
529
- kind: "clientCert",
530
- certPem: _base64Decode(certData),
531
- keyPem: _base64Decode(keyData)
532
- };
533
- };
534
- const parseKubeconfig = (text) => Effect.try({
535
- try: () => parse(text),
536
- catch: (cause) => _invalid(String(cause))
537
- }).pipe(Effect.flatMap((yaml) => Schema.decodeUnknownEffect(_KubeconfigDoc)(yaml).pipe(Effect.mapError(() => _invalid("kubeconfig is not a valid document")))), Effect.flatMap((doc) => {
538
- const cluster = doc.clusters?.[0]?.cluster;
539
- const user = doc.users?.[0]?.user;
540
- const auth = _parseAuth(user);
541
- if (cluster?.server === void 0 || auth === void 0) return Effect.fail(_invalid("kubeconfig missing cluster.server or a token/client-cert user"));
542
- return Effect.succeed({
543
- server: cluster.server,
544
- caPem: cluster["certificate-authority-data"] === void 0 ? void 0 : _base64Decode(cluster["certificate-authority-data"]),
545
- auth
834
+ const k8sClientFromKubeconfig = (options) => Effect.gen(function* () {
835
+ const context = yield* parseKubeconfig(options.kubeconfig.content);
836
+ const base = yield* options.httpClientFor(context);
837
+ const client = context.auth.kind === "token" ? HttpClient.mapRequest(base, HttpClientRequest.bearerToken(Redacted.value(context.auth.token))) : base;
838
+ return makeK8sClient({
839
+ client,
840
+ server: context.server
546
841
  });
547
- }));
548
- //#endregion
549
- //#region src/k8s/readiness.ts
550
- const _ConditionsShape = Schema.Struct({ status: Schema.optional(Schema.Struct({ conditions: Schema.optional(Schema.Array(Schema.Struct({
842
+ });
843
+ const _toYaml = (manifest) => JSON.stringify(manifest);
844
+ // src/k8s/readiness.ts
845
+ const _ConditionsFields = Schema.Struct({ status: Schema.optional(Schema.Struct({ conditions: Schema.optional(Schema.Array(Schema.Struct({
551
846
  type: Schema.String,
552
847
  status: Schema.String
553
848
  }))) })) });
554
849
  const _conditionStatus = (manifest, type) => {
555
- const decoded = Schema.decodeUnknownExit(_ConditionsShape)(manifest);
556
- if (decoded._tag !== "Success") return void 0;
850
+ const decoded = Schema.decodeUnknownExit(_ConditionsFields)(manifest);
851
+ if (Exit.isFailure(decoded)) return void 0;
557
852
  return decoded.value.status?.conditions?.find((c) => c.type === type)?.status;
558
853
  };
559
854
  const waitForDeploymentAvailable = (options) => pollUntil({
@@ -564,16 +859,7 @@ const waitForDeploymentAvailable = (options) => pollUntil({
564
859
  kind: "Deployment",
565
860
  ref: options.ref.path
566
861
  });
567
- const waitForNodeReady = (options) => pollUntil({
568
- check: options.get(options.ref),
569
- isDone: (manifest) => _conditionStatus(manifest, "Ready") === "True",
570
- interval: options.interval,
571
- timeout: options.timeout,
572
- kind: "Node",
573
- ref: options.ref.path
574
- });
575
- //#endregion
576
- //#region src/k8s/node-ops.ts
862
+ // src/k8s/node-ops.ts
577
863
  const _nodeRef = (name) => ({
578
864
  path: `/api/v1/nodes/${name}`,
579
865
  kind: "Node"
@@ -595,8 +881,203 @@ const _podRef = (pod) => Schema.decodeUnknownEffect(_PodMetadata)(pod).pipe(Effe
595
881
  const _podRefs = (pods) => Effect.forEach(pods, _podRef).pipe(Effect.map((refs) => refs.flatMap(Option.toArray)));
596
882
  const drainNode = (options) => options.client.list(options.podsRef).pipe(Effect.flatMap(_podRefs), Effect.flatMap((pods) => Effect.forEach(pods, (pod) => options.client.evict(pod.namespace, pod.name), { discard: true })));
597
883
  const deleteNode = (options) => options.client.delete(_nodeRef(options.name));
598
- //#endregion
599
- //#region src/index.ts
884
+ // src/k8s/resource-ref.ts
885
+ const PLURALS = /* @__PURE__ */ new Map([
886
+ ["Namespace", "namespaces"],
887
+ ["ServiceAccount", "serviceaccounts"],
888
+ ["Secret", "secrets"],
889
+ ["ClusterRole", "clusterroles"],
890
+ ["ClusterRoleBinding", "clusterrolebindings"],
891
+ ["Deployment", "deployments"],
892
+ ["DaemonSet", "daemonsets"],
893
+ ["StorageClass", "storageclasses"]
894
+ ]);
895
+ const _apiPrefix = (apiVersion) => apiVersion === "v1" ? "/api/v1" : `/apis/${apiVersion}`;
896
+ const K8sObjectMeta = Schema.Struct({
897
+ name: Schema.optionalKey(Schema.String),
898
+ namespace: Schema.optionalKey(Schema.String)
899
+ });
900
+ const _metadata = (manifest) => {
901
+ const decoded = Result.getOrElse(Schema.decodeUnknownResult(K8sObjectMeta)(manifest.metadata), () => ({
902
+ name: void 0,
903
+ namespace: void 0
904
+ }));
905
+ return {
906
+ name: decoded.name ?? "",
907
+ namespace: decoded.namespace
908
+ };
909
+ };
910
+ const refFor = (manifest) => {
911
+ const plural = PLURALS.get(manifest.kind) ?? manifest.kind.toLowerCase();
912
+ const { name, namespace } = _metadata(manifest);
913
+ return {
914
+ path: namespace === void 0 ? `${_apiPrefix(manifest.apiVersion)}/${plural}/${name}` : `${_apiPrefix(manifest.apiVersion)}/namespaces/${namespace}/${plural}/${name}`,
915
+ kind: manifest.kind
916
+ };
917
+ };
918
+ // src/k8s/addon.ts
919
+ const installAddons = ({ addons, k8sClient }) => Effect.forEach(addons, (addon) => _installOne({
920
+ addon,
921
+ k8sClient
922
+ }), { discard: true });
923
+ const _installOne = ({ addon, k8sClient }) => Effect.forEach(addon.manifests, (manifest) => k8sClient.apply(refFor(manifest), manifest), { discard: true }).pipe(Effect.mapError((cause) => new AddonInstallFailed({
924
+ addon: addon.name,
925
+ cause: String(cause)
926
+ })));
927
+ // src/http/retry-after.ts
928
+ const _UNIX_SECONDS_FLOOR = 1e9;
929
+ const parseRetryAfterAt = ({ nowMs, value }) => {
930
+ if (value === void 0 || value.trim() === "") return void 0;
931
+ const seconds = Number(value);
932
+ if (Number.isFinite(seconds) && seconds >= 0) return Duration.seconds(seconds);
933
+ const at = Date.parse(value);
934
+ if (Number.isNaN(at)) return void 0;
935
+ return Duration.millis(Math.max(at - nowMs, 0));
936
+ };
937
+ const parseRetryAfter = (value) => parseRetryAfterAt({
938
+ value,
939
+ nowMs: Date.now()
940
+ });
941
+ const parseRateLimitResetAt = ({ nowMs, value }) => {
942
+ if (value === void 0 || value.trim() === "") return void 0;
943
+ const n = Number(value);
944
+ if (!Number.isFinite(n) || n < 0) return void 0;
945
+ if (n >= _UNIX_SECONDS_FLOOR) return Duration.millis(Math.max(n * 1e3 - nowMs, 0));
946
+ return Duration.seconds(n);
947
+ };
948
+ const parseRateLimitReset = (value) => parseRateLimitResetAt({
949
+ value,
950
+ nowMs: Date.now()
951
+ });
952
+ // src/http/client.ts
953
+ const IDEMPOTENT_METHODS = [
954
+ "GET",
955
+ "HEAD",
956
+ "PUT",
957
+ "DELETE",
958
+ "OPTIONS"
959
+ ];
960
+ const _defaultRetryStatus = (status) => status === 408 || status === 429 || status >= 500 && status < 600;
961
+ const _withBaseUrl = ({ baseUrl, request }) => baseUrl === void 0 || URL.canParse(request.url) ? request : HttpClientRequest$1.prependUrl(request, baseUrl);
962
+ const _timeoutError = (request) => new HttpClientError.HttpClientError({ reason: new HttpClientError.TransportError({
963
+ request,
964
+ description: "request timed out"
965
+ }) });
966
+ const _serverWait = (response) => parseRetryAfter(response.headers["retry-after"]) ?? parseRateLimitReset(response.headers["ratelimit-reset"]);
967
+ const makeProviderHttpClient = (options) => Effect.gen(function* () {
968
+ const retry = options.retry === false ? void 0 : options.retry ?? {};
969
+ const statuses = retry?.statuses;
970
+ const retryStatus = (status) => statuses === void 0 ? _defaultRetryStatus(status) : statuses.includes(status);
971
+ const methods = retry?.methods ?? IDEMPOTENT_METHODS;
972
+ const maxRetries = retry === void 0 ? 0 : retry.maxRetries ?? 5;
973
+ const baseDelayMs = Duration.toMillis(Duration.fromInputUnsafe(retry?.baseDelay ?? "200 millis"));
974
+ const maxDelayMs = Duration.toMillis(Duration.fromInputUnsafe(retry?.maxDelay ?? "60 seconds"));
975
+ const timeout = options.timeout ?? "30 seconds";
976
+ const semaphore = options.maxConcurrentRequests === void 0 ? void 0 : yield* Semaphore.make(options.maxConcurrentRequests);
977
+ const attempt = (request) => Effect.gen(function* () {
978
+ const authed = options.authorize === void 0 ? request : yield* options.authorize(request);
979
+ return yield* options.base.execute(authed).pipe(Effect.timeoutOrElse({
980
+ duration: timeout,
981
+ orElse: () => Effect.fail(_timeoutError(request))
982
+ }));
983
+ });
984
+ const withReauth = (request) => Effect.gen(function* () {
985
+ const response = yield* attempt(request);
986
+ if (response.status !== 401 || options.onUnauthorized === void 0) return response;
987
+ yield* options.onUnauthorized;
988
+ return yield* attempt(request);
989
+ });
990
+ const delayFor = ({ response, retry: n }) => Effect.gen(function* () {
991
+ const server = response === void 0 ? void 0 : _serverWait(response);
992
+ if (server !== void 0) return Math.min(Duration.toMillis(server), maxDelayMs);
993
+ const jitter = yield* Random.next;
994
+ return Math.min(baseDelayMs * 2 ** n * (.5 + jitter), maxDelayMs);
995
+ });
996
+ const loop = (request, n) => Effect.gen(function* () {
997
+ const canRetry = n < maxRetries && methods.includes(request.method);
998
+ const result = yield* Effect.result(withReauth(request));
999
+ if (Result.isFailure(result)) {
1000
+ const reason = result.failure.reason;
1001
+ if (canRetry && Predicate.isTagged(reason, "TransportError")) {
1002
+ yield* Effect.sleep(yield* delayFor({
1003
+ retry: n,
1004
+ response: void 0
1005
+ }));
1006
+ return yield* loop(request, n + 1);
1007
+ }
1008
+ return yield* Effect.fail(result.failure);
1009
+ }
1010
+ const response = result.success;
1011
+ if (canRetry && retryStatus(response.status)) {
1012
+ yield* Effect.sleep(yield* delayFor({
1013
+ retry: n,
1014
+ response
1015
+ }));
1016
+ return yield* loop(request, n + 1);
1017
+ }
1018
+ return response;
1019
+ });
1020
+ const client = HttpClient$1.make((request) => {
1021
+ const run = loop(request, 0);
1022
+ return semaphore === void 0 ? run : semaphore.withPermit(run);
1023
+ });
1024
+ return HttpClient$1.mapRequest(client, (request) => _withBaseUrl({
1025
+ request,
1026
+ baseUrl: options.baseUrl
1027
+ }));
1028
+ });
1029
+ // src/http/errors.ts
1030
+ const HTTP_ERROR_BODY_LIMIT = 512;
1031
+ const truncateBody = (body) => body.slice(0, 512);
1032
+ const classifyHttpError = (options) => {
1033
+ const { isQuota, kind, operation, override, ref, retryAfter, status } = options;
1034
+ const body = truncateBody(options.body);
1035
+ const context = {
1036
+ status,
1037
+ body,
1038
+ kind,
1039
+ ref,
1040
+ retryAfter
1041
+ };
1042
+ const overridden = override?.(context);
1043
+ if (overridden !== void 0) return overridden;
1044
+ if (isQuota?.(context) === true) return new QuotaExceeded({ resource: kind });
1045
+ if (status === 401 || status === 403) return new AuthenticationFailed({ hint: `${kind} ${ref}: ${body || `HTTP ${status}`}` });
1046
+ if (status === 404) return new ResourceNotFound({
1047
+ kind,
1048
+ ref
1049
+ });
1050
+ if (status === 409) return new ResourceConflict({
1051
+ kind,
1052
+ ref
1053
+ });
1054
+ if (status === 413 || status === 429) return new RateLimited({
1055
+ kind,
1056
+ ref,
1057
+ retryAfter
1058
+ });
1059
+ return new ProviderApiError({
1060
+ operation: operation ?? `${kind} ${ref}`,
1061
+ status,
1062
+ body
1063
+ });
1064
+ };
1065
+ const mapHttpError = (options) => {
1066
+ const { cause, kind, ref } = options;
1067
+ if (!HttpClientError.isHttpClientError(cause)) return new ResponseDecodeError({
1068
+ endpoint: `${kind}/${ref}`,
1069
+ issue: cause.issue
1070
+ });
1071
+ const reason = cause.reason;
1072
+ if (!Predicate.isTagged(reason, "StatusCodeError")) return new HttpTransportError({ cause });
1073
+ return classifyHttpError({
1074
+ ...options,
1075
+ status: reason.response.status,
1076
+ body: reason.description ?? "",
1077
+ retryAfter: reason.response.headers["retry-after"]
1078
+ });
1079
+ };
1080
+ const ignoreNotFound = (effect) => Effect.catch(Effect.asVoid(effect), (error) => error instanceof ResourceNotFound ? Effect.void : Effect.fail(error));
1081
+ // src/index.ts
600
1082
  const packageName = "@kumulo/core";
601
- //#endregion
602
- export { Addon, AddonInstallFailed, AuthenticationFailed, BootstrapFailed, BucketNotEmpty, CONFIG_HASH_KEY, CapabilityMissing, CloudProvider, ClusterConfig, ConfigInvalid, CredentialsSink, Distro, DnsProvider, HttpTransportError, K3sClusterConfig, K8sClient, MksClusterConfig, OWNERSHIP_PREFIX, ObjectStorageProvider, OutputsFormat, PlanRejected, ProviderApiError, ProviderProfile, ProvisioningTimeout, QuotaExceeded, RateLimited, ResourceConflict, ResourceNotFound, ResponseDecodeError, SinkUnavailable, VolumeProvider, applyServers, computePlan, configHash, cordonNode, decidePlanAction, decodeConfig, deleteNode, distroCapabilities, dnsNoop, dnsNoopLive, drainNode, encodeConfig, genericProfile, genericProfileLive, isRetryable, makeK8sClient, namesToReplace, ownerTagOf, ownershipTarget, packageName, parseConfigYaml, parseKubeconfig, pollUntil, recordKind, renderError, renderPlan, resourceName, stringifyConfigYaml, toTaggedResource, validateAutoscaling, validateCni, waitForDeploymentAvailable, waitForNodeReady };
1083
+ export { AccessMode, AddonInstallFailed, Auth, AuthMethod as AuthMethodSchema, AuthenticationFailed, Autoscaling, BootstrapFailed, BucketName, BucketNotEmpty, BunnyBucketName, BunnyCdn, BunnyObjectStorage, BunnyStorageRegion, CONFIG_HASH_KEY, CapabilityMissing, Cdn, CdnOrigin, CdnProvider, Cidr, CinderVolumes, CloudProvider, ClusterName, ConfigInvalid, CredentialsSink, Dns, DnsProvider, HTTP_ERROR_BODY_LIMIT, HcloudVolumes, HttpTransportError, IDEMPOTENT_METHODS, K8sClient, ManagedVolume, NoVolumes, NonNegativeInt, OWNERSHIP_PREFIX, ObjectStorage, ObjectStorageProvider, OpenStackVolumes, Outputs, OutputsFormat, OutputsInvalid, PaginationLimitExceeded, PaginationStalled, PlanAction, PlanDecision, PlanRejected, PositiveInt, ProviderApiError, ProviderProfile, Provider as ProviderSchema, ProvisioningTimeout, Pvc, QuotaExceeded, RateLimited, ResourceConflict, ResourceNotFound, ResponseDecodeError, Secrets, Shield, SinkUnavailable, VolumeProvider, Volumes, WorkerPool as WorkerPoolSchema, authMethodConsistentWithProvider, authMethodsByProvider, cdnNoop, cdnNoopLive, cdnOriginUrlRequired, cidrRange, classifyHttpError, commonClusterFields, computePlan, configHash, cordonNode, createOrNoOp, crossFieldRule, decidePlanAction, decodeConfigWith, deleteNode, deleteRow, diffBuckets, distroCapabilities, dnsNoop, dnsNoopLive, drainNode, encodeConfigWith, genericProfile, genericProfileLive, ignoreNotFound, installAddons, isIpLiteral, k8sClientFromKubeconfig, makeK8sClient, makeOutputsFile, makeProviderHttpClient, mapHttpError, namesToReplace, ownerTagOf, ownershipTarget, packageName, paginate, paginateByOffset, paginateByPage, parseConfigYamlWith, parseKubeconfig, parseRateLimitReset, parseRateLimitResetAt, parseRetryAfter, parseRetryAfterAt, pollUntil, reconcileDns, reconcileDnsLive, recordKind, refFor, renderError, resourceName, secretsRequiredForObjectStorage, serverConfigHash, stringifyConfigYaml, toTaggedResource, truncateBody, validateAutoscaling, validateCni, waitForDeploymentAvailable };