@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
@@ -0,0 +1,14 @@
1
+ import { Effect } from "effect";
2
+ import type { K8sManifest } from "../domain/types";
3
+ import { AddonInstallFailed } from "../errors/tagged";
4
+ import type { K8sClient } from "./client";
5
+ export interface Addon {
6
+ readonly name: string;
7
+ readonly manifests: ReadonlyArray<K8sManifest>;
8
+ }
9
+ export type AddonError = AddonInstallFailed;
10
+ export interface InstallAddonsParams {
11
+ readonly k8sClient: K8sClient["Service"];
12
+ readonly addons: ReadonlyArray<Addon>;
13
+ }
14
+ export declare const installAddons: ({ addons, k8sClient }: InstallAddonsParams) => Effect.Effect<void, AddonError>;
@@ -1,14 +1,16 @@
1
1
  import { Context, Effect } from "effect";
2
- import type { HttpClient } from "effect/unstable/http";
3
- import { HttpTransportError, ResourceConflict, ResourceNotFound } from "../errors/tagged";
4
- import type { K8sManifest } from "../domain/types";
2
+ import { HttpClient } from "effect/http";
3
+ import type { ConfigInvalid } from "../errors/tagged";
4
+ import { HttpTransportError, ResourceConflict, ResourceNotFound, ResponseDecodeError } from "../errors/tagged";
5
+ import type { K8sManifest, Kubeconfig } from "../domain/types";
6
+ import type { KubeconfigContext } from "./kubeconfig";
5
7
  export interface ResourceRef {
6
8
  readonly path: string;
7
9
  readonly kind: string;
8
10
  }
9
11
  declare const K8sClient_base: Context.ServiceClass<K8sClient, "@kumulo/core/K8sClient", {
10
12
  readonly get: (ref: ResourceRef) => Effect.Effect<K8sManifest, ResourceNotFound | HttpTransportError>;
11
- readonly list: (ref: ResourceRef) => Effect.Effect<ReadonlyArray<K8sManifest>, HttpTransportError>;
13
+ readonly list: (ref: ResourceRef) => Effect.Effect<ReadonlyArray<K8sManifest>, HttpTransportError | ResponseDecodeError>;
12
14
  readonly apply: (ref: ResourceRef, manifest: K8sManifest) => Effect.Effect<K8sManifest, ResourceConflict | HttpTransportError>;
13
15
  readonly delete: (ref: ResourceRef) => Effect.Effect<void, ResourceNotFound | HttpTransportError>;
14
16
  readonly evict: (namespace: string, pod: string) => Effect.Effect<void, ResourceNotFound | ResourceConflict | HttpTransportError>;
@@ -20,4 +22,9 @@ export interface K8sClientOptions {
20
22
  readonly server: string;
21
23
  }
22
24
  export declare const makeK8sClient: (options: K8sClientOptions) => K8sClient["Service"];
25
+ export interface K8sClientFromKubeconfigOptions<E, R> {
26
+ readonly kubeconfig: Kubeconfig;
27
+ readonly httpClientFor: (context: KubeconfigContext) => Effect.Effect<HttpClient.HttpClient, E, R>;
28
+ }
29
+ export declare const k8sClientFromKubeconfig: <E, R>(options: K8sClientFromKubeconfigOptions<E, R>) => Effect.Effect<K8sClient["Service"], ConfigInvalid | E, R>;
23
30
  export {};
@@ -1,7 +1,10 @@
1
- export { K8sClient, makeK8sClient } from "./client";
2
- export type { K8sClientOptions, ResourceRef } from "./client";
1
+ export { K8sClient, k8sClientFromKubeconfig, makeK8sClient } from "./client";
2
+ export type { K8sClientFromKubeconfigOptions, K8sClientOptions, ResourceRef } from "./client";
3
3
  export { parseKubeconfig } from "./kubeconfig";
4
4
  export type { ClientCertAuth, KubeconfigAuth, KubeconfigContext, TokenAuth } from "./kubeconfig";
5
- export { waitForDeploymentAvailable, waitForNodeReady } from "./readiness";
5
+ export { waitForDeploymentAvailable } from "./readiness";
6
6
  export type { WaitOptions } from "./readiness";
7
7
  export { cordonNode, deleteNode, drainNode } from "./node-ops";
8
+ export { installAddons } from "./addon";
9
+ export type { Addon, AddonError } from "./addon";
10
+ export { refFor } from "./resource-ref";
@@ -1,8 +1,8 @@
1
- import { Effect } from "effect";
1
+ import { Effect, Redacted } from "effect";
2
2
  import { ConfigInvalid } from "../errors/tagged";
3
3
  export interface TokenAuth {
4
4
  readonly kind: "token";
5
- readonly token: string;
5
+ readonly token: Redacted.Redacted;
6
6
  }
7
7
  export interface ClientCertAuth {
8
8
  readonly kind: "clientCert";
@@ -1,5 +1,5 @@
1
1
  import { Effect } from "effect";
2
- import type { HttpTransportError, ResourceConflict, ResourceNotFound } from "../errors/tagged";
2
+ import type { HttpTransportError, ResourceConflict, ResourceNotFound, ResponseDecodeError } from "../errors/tagged";
3
3
  import type { K8sManifest } from "../domain/types";
4
4
  import type { K8sClient, ResourceRef } from "./client";
5
5
  export interface CordonNodeOptions {
@@ -11,7 +11,7 @@ export interface DrainNodeOptions {
11
11
  readonly client: K8sClient["Service"];
12
12
  readonly podsRef: ResourceRef;
13
13
  }
14
- export declare const drainNode: (options: DrainNodeOptions) => Effect.Effect<void, ResourceNotFound | ResourceConflict | HttpTransportError>;
14
+ export declare const drainNode: (options: DrainNodeOptions) => Effect.Effect<void, ResourceNotFound | ResourceConflict | HttpTransportError | ResponseDecodeError>;
15
15
  export interface DeleteNodeOptions {
16
16
  readonly client: K8sClient["Service"];
17
17
  readonly name: string;
@@ -9,4 +9,3 @@ export interface WaitOptions {
9
9
  readonly timeout: Duration.Input;
10
10
  }
11
11
  export declare const waitForDeploymentAvailable: (options: WaitOptions) => Effect.Effect<K8sManifest, ResourceNotFound | HttpTransportError | ProvisioningTimeout>;
12
- export declare const waitForNodeReady: (options: WaitOptions) => Effect.Effect<K8sManifest, ResourceNotFound | HttpTransportError | ProvisioningTimeout>;
@@ -0,0 +1,3 @@
1
+ import type { K8sManifest } from "../domain/types";
2
+ import type { ResourceRef } from "./client";
3
+ export declare const refFor: (manifest: K8sManifest) => ResourceRef;
@@ -0,0 +1,41 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { FileSystem } from "effect/FileSystem";
3
+ import type { PlatformError } from "effect/PlatformError";
4
+ import type { OutputsFormat } from "../config/schema";
5
+ import type { ClusterTag } from "../domain/types";
6
+ declare const OutputsInvalid_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
7
+ readonly _tag: "OutputsInvalid";
8
+ } & Readonly<A>;
9
+ export declare class OutputsInvalid extends OutputsInvalid_base<{
10
+ readonly message: string;
11
+ }> {
12
+ }
13
+ export interface OutputsLocation {
14
+ readonly dir: string;
15
+ readonly tag: ClusterTag;
16
+ readonly format?: OutputsFormat | undefined;
17
+ }
18
+ export interface OutputsFileOptions<File> {
19
+ readonly schema: Schema.Codec<File, unknown>;
20
+ readonly suffix: string;
21
+ readonly empty: (tag: ClusterTag) => File;
22
+ readonly order?: ((file: File) => object) | undefined;
23
+ readonly clusterOf: (file: File) => ClusterTag;
24
+ }
25
+ export declare const makeOutputsFile: <File>(options: OutputsFileOptions<File>) => {
26
+ path: ({ dir, format, tag }: OutputsLocation) => string;
27
+ decode: (input: Schema.Json) => Effect.Effect<File, OutputsInvalid>;
28
+ parseYaml: (text: string) => Effect.Effect<File, OutputsInvalid>;
29
+ stringify: ({ file, format }: {
30
+ readonly file: File;
31
+ readonly format?: OutputsFormat | undefined;
32
+ }) => string;
33
+ read: ({ dir, format, tag }: OutputsLocation) => Effect.Effect<File, OutputsInvalid | PlatformError, FileSystem>;
34
+ write: ({ dir, file, format }: {
35
+ readonly dir: string;
36
+ readonly file: File;
37
+ readonly format?: OutputsFormat | undefined;
38
+ }) => Effect.Effect<void, PlatformError, FileSystem>;
39
+ empty: (tag: ClusterTag) => File;
40
+ };
41
+ export {};
@@ -0,0 +1,2 @@
1
+ export { makeOutputsFile, OutputsInvalid } from "./file";
2
+ export type { OutputsFileOptions, OutputsLocation } from "./file";
@@ -0,0 +1,43 @@
1
+ import { Effect } from "effect";
2
+ declare const PaginationLimitExceeded_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
3
+ readonly _tag: "PaginationLimitExceeded";
4
+ } & Readonly<A>;
5
+ export declare class PaginationLimitExceeded extends PaginationLimitExceeded_base<{
6
+ readonly maxPages: number;
7
+ }> {
8
+ }
9
+ declare const PaginationStalled_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
10
+ readonly _tag: "PaginationStalled";
11
+ } & Readonly<A>;
12
+ export declare class PaginationStalled extends PaginationStalled_base<{
13
+ readonly cursor: string;
14
+ readonly pages: number;
15
+ }> {
16
+ }
17
+ export type PaginationError = PaginationLimitExceeded | PaginationStalled;
18
+ export interface PaginateOptions<Cursor, Page, Item, E, R> {
19
+ readonly initial: Cursor;
20
+ readonly fetch: (cursor: Cursor) => Effect.Effect<Page, E, R>;
21
+ readonly items: (page: Page) => ReadonlyArray<Item>;
22
+ readonly next: (args: {
23
+ readonly page: Page;
24
+ readonly cursor: Cursor;
25
+ readonly items: ReadonlyArray<Item>;
26
+ }) => Cursor | undefined;
27
+ readonly maxPages: number;
28
+ }
29
+ export declare const paginate: <Cursor, Page, Item, E, R>(options: PaginateOptions<Cursor, Page, Item, E, R>) => Effect.Effect<ReadonlyArray<Item>, E | PaginationError, R>;
30
+ export declare const paginateByPage: <Page, Item, E, R>(options: {
31
+ readonly fetch: (page: number) => Effect.Effect<Page, E, R>;
32
+ readonly items: (page: Page) => ReadonlyArray<Item>;
33
+ readonly perPage: number;
34
+ readonly maxPages: number;
35
+ readonly firstPage?: number;
36
+ }) => Effect.Effect<ReadonlyArray<Item>, E | PaginationError, R>;
37
+ export declare const paginateByOffset: <Page, Item, E, R>(options: {
38
+ readonly fetch: (offset: number) => Effect.Effect<Page, E, R>;
39
+ readonly items: (page: Page) => ReadonlyArray<Item>;
40
+ readonly limit: number;
41
+ readonly maxPages: number;
42
+ }) => Effect.Effect<ReadonlyArray<Item>, E | PaginationError, R>;
43
+ export {};
@@ -1,10 +1,5 @@
1
1
  import type { DesiredResource, Plan, TaggedResource } from "./types";
2
2
  export declare const toTaggedResource: (desired: DesiredResource) => TaggedResource;
3
- /**
4
- * The names the plan says must be replaced. Callers hand this to the
5
- * reconciler *only* once the operator confirmed, so execution never
6
- * re-derives replace intent from names or inventory.
7
- */
8
3
  export declare const namesToReplace: (plan: Plan) => ReadonlySet<string>;
9
4
  export declare const computePlan: ({ actual, desired }: {
10
5
  readonly desired: ReadonlyArray<DesiredResource>;
@@ -1,2 +1,4 @@
1
+ import type { ServerSpec } from "../domain/types";
1
2
  export declare const CONFIG_HASH_KEY = "kumulo-config-hash";
2
- export declare const configHash: (spec: unknown) => string;
3
+ export declare const configHash: <Spec>(spec: Spec) => string;
4
+ export declare const serverConfigHash: (spec: ServerSpec) => string;
@@ -1,4 +1,6 @@
1
1
  export { computePlan, namesToReplace, toTaggedResource } from "./diff";
2
- export { CONFIG_HASH_KEY, configHash } from "./hash";
2
+ export { CONFIG_HASH_KEY, configHash, serverConfigHash } from "./hash";
3
3
  export { resourceName } from "./naming";
4
- export type { DesiredResource, Plan, PlanAction, TaggedResource } from "./types";
4
+ export { createOrNoOp, deleteRow } from "./rows";
5
+ export { PlanAction } from "./types";
6
+ export type { DesiredResource, Plan, TaggedResource } from "./types";
@@ -0,0 +1,10 @@
1
+ import { PlanAction } from "./types";
2
+ export declare const deleteRow: ({ live, name, retain }: {
3
+ readonly name: string;
4
+ readonly live: boolean;
5
+ readonly retain: boolean;
6
+ }) => PlanAction;
7
+ export declare const createOrNoOp: ({ exists, name }: {
8
+ readonly exists: boolean;
9
+ readonly name: string;
10
+ }) => PlanAction;
@@ -1,3 +1,4 @@
1
+ import { Data } from "effect";
1
2
  import type { ResourceCoordinates } from "./naming";
2
3
  export interface DesiredResource extends ResourceCoordinates {
3
4
  readonly spec: unknown;
@@ -6,7 +7,26 @@ export interface TaggedResource {
6
7
  readonly name: string;
7
8
  readonly configHash?: string | undefined;
8
9
  }
9
- export type PlanAction = {
10
+ export type PlanAction = Data.TaggedEnum<{
11
+ Create: {
12
+ readonly name: string;
13
+ };
14
+ Delete: {
15
+ readonly name: string;
16
+ };
17
+ NoOp: {
18
+ readonly name: string;
19
+ };
20
+ Update: {
21
+ readonly name: string;
22
+ readonly reason: string;
23
+ };
24
+ ReplaceNeedsConfirm: {
25
+ readonly name: string;
26
+ readonly reason: string;
27
+ };
28
+ }>;
29
+ export declare const PlanAction: Data.TaggedEnum.Constructor<{
10
30
  readonly _tag: "Create";
11
31
  readonly name: string;
12
32
  } | {
@@ -16,14 +36,14 @@ export type PlanAction = {
16
36
  readonly _tag: "NoOp";
17
37
  readonly name: string;
18
38
  } | {
19
- readonly _tag: "Update";
39
+ readonly _tag: "ReplaceNeedsConfirm";
20
40
  readonly name: string;
21
41
  readonly reason: string;
22
42
  } | {
23
- readonly _tag: "ReplaceNeedsConfirm";
43
+ readonly _tag: "Update";
24
44
  readonly name: string;
25
45
  readonly reason: string;
26
- };
46
+ }>;
27
47
  export interface Plan {
28
48
  readonly actions: ReadonlyArray<PlanAction>;
29
49
  }
@@ -0,0 +1,21 @@
1
+ import type { Effect } from "effect";
2
+ import { Context } from "effect";
3
+ import type { AuthenticationFailed, CapabilityMissing, HttpTransportError, ProviderApiError, ProvisioningTimeout, RateLimited, ResourceConflict, ResourceNotFound, ResponseDecodeError } from "../errors/tagged";
4
+ import type { EdgeInfo, EdgeRef, EdgeSpec, SecurityPolicy } from "../domain/types";
5
+ export type CdnError = ResourceNotFound | ResourceConflict | AuthenticationFailed | RateLimited | ProviderApiError | ResponseDecodeError | HttpTransportError | CapabilityMissing | ProvisioningTimeout;
6
+ declare const CdnProvider_base: Context.ServiceClass<CdnProvider, "@kumulo/core/CdnProvider", {
7
+ readonly ensureEdge: (spec: EdgeSpec) => Effect.Effect<EdgeInfo, CdnError>;
8
+ readonly ensureCertificates: (input: {
9
+ readonly ref: EdgeRef;
10
+ readonly hostnames: ReadonlyArray<string>;
11
+ }) => Effect.Effect<void, CdnError>;
12
+ readonly ensureSecurity: (input: {
13
+ readonly ref: EdgeRef;
14
+ readonly policy: SecurityPolicy;
15
+ }) => Effect.Effect<void, CdnError>;
16
+ readonly describeEdge: (ref: EdgeRef) => Effect.Effect<EdgeInfo, CdnError>;
17
+ readonly deleteEdge: (ref: EdgeRef) => Effect.Effect<void, CdnError>;
18
+ }>;
19
+ export declare class CdnProvider extends CdnProvider_base {
20
+ }
21
+ export {};
@@ -1,10 +1,12 @@
1
1
  import type { Effect } from "effect";
2
2
  import { Context } from "effect";
3
3
  import type { AuthenticationFailed, CapabilityMissing, HttpTransportError, ProviderApiError, ProvisioningTimeout, QuotaExceeded, RateLimited, ResourceConflict, ResourceNotFound, ResponseDecodeError } from "../errors/tagged";
4
- import type { ClusterTag, FlavorId, FlavorRef, ImageId, ImageRef, Inventory, LbInfo, LbSpec, NetworkInfo, NetworkSpec, SecGroupInfo, SecGroupSpec, ServerInfo, ServerSpec } from "../domain/types";
4
+ import type { ClusterTag, FlavorId, FlavorRef, ImageId, ImageRef, Inventory, LbInfo, LbSpec, GatewayRef, NetworkInfo, NetworkSpec, SecGroupInfo, SecGroupSpec, ServerInfo, ServerSpec } from "../domain/types";
5
5
  export type CloudError = AuthenticationFailed | QuotaExceeded | ResourceNotFound | ResourceConflict | CapabilityMissing | ProvisioningTimeout | RateLimited | ProviderApiError | ResponseDecodeError | HttpTransportError;
6
6
  declare const CloudProvider_base: Context.ServiceClass<CloudProvider, "@kumulo/core/CloudProvider", {
7
7
  readonly ensureNetwork: (spec: NetworkSpec) => Effect.Effect<NetworkInfo, CloudError>;
8
+ readonly findNetwork: (spec: NetworkSpec) => Effect.Effect<NetworkInfo | undefined, CloudError>;
9
+ readonly hasGateway: (spec: GatewayRef) => Effect.Effect<boolean, CloudError>;
8
10
  readonly ensureSecurityGroups: (spec: SecGroupSpec) => Effect.Effect<SecGroupInfo, CloudError>;
9
11
  readonly ensureLoadBalancer: (spec: LbSpec) => Effect.Effect<LbInfo, CloudError>;
10
12
  readonly ensureServer: (spec: ServerSpec) => Effect.Effect<ServerInfo, CloudError>;
@@ -1,29 +1,2 @@
1
- import type { Effect } from "effect";
2
- import { Context } from "effect";
3
- import type { AuthenticationFailed, BootstrapFailed, ConfigInvalid, HttpTransportError, ProviderApiError, ProvisioningTimeout, QuotaExceeded, RateLimited, ResourceConflict, ResourceNotFound, ResponseDecodeError } from "../errors/tagged";
4
- import type { BootstrapPlan, ClusterConfigShape, Inventory, K8sManifest, Kubeconfig, ManagedClusterInfo, ManagedClusterRef, NodeContext, NodeRef, NodeRole, ResolvedVersion, SshTarget, Version } from "../domain/types";
5
- export interface SelfManagedDistroShape {
6
- readonly kind: "self-managed";
7
- readonly name: string;
8
- readonly planBootstrap: (cluster: ClusterConfigShape, inventory: Inventory) => Effect.Effect<BootstrapPlan>;
9
- readonly renderUserData: (role: NodeRole, ctx: NodeContext) => Effect.Effect<string>;
10
- readonly fetchKubeconfig: (entry: SshTarget, apiEndpoint: string) => Effect.Effect<Kubeconfig, BootstrapFailed>;
11
- readonly upgradePlan: (target: Version) => Effect.Effect<ReadonlyArray<K8sManifest>>;
12
- readonly validateVersion: (v: string) => Effect.Effect<ResolvedVersion, ConfigInvalid>;
13
- readonly drainAndRemove: (node: NodeRef) => Effect.Effect<void, BootstrapFailed>;
14
- }
15
- export type MksError = AuthenticationFailed | ResourceNotFound | ResourceConflict | ProvisioningTimeout | QuotaExceeded | RateLimited | ProviderApiError | HttpTransportError | ResponseDecodeError;
16
- export interface ManagedDistroShape {
17
- readonly kind: "managed";
18
- readonly name: string;
19
- readonly ensureCluster: (cfg: ClusterConfigShape) => Effect.Effect<ManagedClusterInfo, MksError>;
20
- readonly ensureNodePools: (cfg: ClusterConfigShape) => Effect.Effect<void, MksError>;
21
- readonly fetchKubeconfig: (ref: ManagedClusterRef) => Effect.Effect<Kubeconfig, MksError>;
22
- readonly upgrade: (target: Version) => Effect.Effect<void, MksError>;
23
- readonly delete: (ref: ManagedClusterRef) => Effect.Effect<void, MksError>;
24
- }
25
- export type DistroShape = SelfManagedDistroShape | ManagedDistroShape;
26
- declare const Distro_base: Context.ServiceClass<Distro, "@kumulo/core/Distro", DistroShape>;
27
- export declare class Distro extends Distro_base {
28
- }
29
- export {};
1
+ import type { AuthenticationFailed, CapabilityMissing, HttpTransportError, ProviderApiError, ProvisioningTimeout, QuotaExceeded, RateLimited, ResourceConflict, ResourceNotFound, ResponseDecodeError } from "../errors/tagged";
2
+ export type ManagedDistroError = AuthenticationFailed | CapabilityMissing | ResourceNotFound | ResourceConflict | ProvisioningTimeout | QuotaExceeded | RateLimited | ProviderApiError | HttpTransportError | ResponseDecodeError;
@@ -1,26 +1,10 @@
1
1
  import type { Effect } from "effect";
2
2
  import { Context } from "effect";
3
3
  import type { ConfigInvalid } from "../errors/tagged";
4
- import type { ClusterConfigShape } from "../domain/types";
4
+ import type { ClusterConfigFields } from "../domain/types";
5
5
  export type ProfileError = ConfigInvalid;
6
- export interface AuthDefaults {
7
- readonly keystoneUrlPattern: string;
8
- readonly domainDefault: string;
9
- }
10
6
  declare const ProviderProfile_base: Context.ServiceClass<ProviderProfile, "@kumulo/core/ProviderProfile", {
11
- readonly name: string;
12
- readonly auth: AuthDefaults;
13
- readonly capabilities: {
14
- readonly octavia: (region: string) => boolean;
15
- readonly floatingIps: boolean;
16
- readonly volumeTypes: ReadonlyArray<string>;
17
- };
18
- readonly defaults: {
19
- readonly externalNetworkName: string;
20
- readonly imageAliases: Record<string, string>;
21
- readonly dnsServers: ReadonlyArray<string>;
22
- };
23
- readonly validate: (config: ClusterConfigShape) => Effect.Effect<void, ProfileError>;
7
+ readonly validate: (config: ClusterConfigFields) => Effect.Effect<void, ProfileError>;
24
8
  }>;
25
9
  export declare class ProviderProfile extends ProviderProfile_base {
26
10
  }
@@ -1,5 +1,5 @@
1
1
  import { Option } from "effect";
2
2
  import { PlanRejected } from "../errors/tagged";
3
- import type { ClusterConfigShape } from "../domain/types";
4
- export declare const validateAutoscaling: (config: ClusterConfigShape) => Option.Option<PlanRejected>;
5
- export declare const validateCni: (config: ClusterConfigShape) => Option.Option<PlanRejected>;
3
+ import type { ClusterConfigFields } from "../domain/types";
4
+ export declare const validateAutoscaling: (config: ClusterConfigFields) => Option.Option<PlanRejected>;
5
+ export declare const validateCni: (config: ClusterConfigFields) => Option.Option<PlanRejected>;
@@ -1,13 +1,20 @@
1
- import type { Plan } from "../plan/types";
2
- export type PlanDecision = {
1
+ import { Data } from "effect";
2
+ import { type Plan } from "../plan/types";
3
+ export type PlanDecision = Data.TaggedEnum<{
4
+ DryRun: {};
5
+ NothingToDo: {};
6
+ Proceed: {};
7
+ NeedsConfirm: {};
8
+ }>;
9
+ export declare const PlanDecision: Data.TaggedEnum.Constructor<{
3
10
  readonly _tag: "DryRun";
11
+ } | {
12
+ readonly _tag: "NeedsConfirm";
4
13
  } | {
5
14
  readonly _tag: "NothingToDo";
6
15
  } | {
7
16
  readonly _tag: "Proceed";
8
- } | {
9
- readonly _tag: "NeedsConfirm";
10
- };
17
+ }>;
11
18
  export declare const decidePlanAction: ({ plan, yes, dryRun }: {
12
19
  readonly plan: Plan;
13
20
  readonly yes: boolean;
@@ -1,3 +1 @@
1
- export { decidePlanAction } from "./decide";
2
- export type { PlanDecision } from "./decide";
3
- export { renderPlan } from "./render";
1
+ export { decidePlanAction, PlanDecision } from "./decide";
@@ -1,22 +1,8 @@
1
1
  import { Effect, Layer } from "effect";
2
- import type { ClusterConfigShape } from "../domain/types";
2
+ import { ConfigInvalid } from "../errors/tagged";
3
+ import type { ClusterConfigFields } from "../domain/types";
3
4
  import { ProviderProfile } from "../ports/provider-profile";
4
5
  export declare const genericProfile: {
5
- name: string;
6
- auth: {
7
- keystoneUrlPattern: string;
8
- domainDefault: string;
9
- };
10
- capabilities: {
11
- octavia: (_region: string) => boolean;
12
- floatingIps: boolean;
13
- volumeTypes: never[];
14
- };
15
- defaults: {
16
- externalNetworkName: string;
17
- imageAliases: {};
18
- dnsServers: never[];
19
- };
20
- validate: (_config: ClusterConfigShape) => Effect.Effect<void, never, never>;
6
+ validate: (config: ClusterConfigFields) => Effect.Effect<void, ConfigInvalid, never>;
21
7
  };
22
8
  export declare const genericProfileLive: Layer.Layer<ProviderProfile, never, never>;
@@ -1,3 +1,2 @@
1
1
  export { pollUntil } from "./poll";
2
2
  export type { PollOptions } from "./poll";
3
- export { applyServers } from "./apply";
@@ -1,12 +1,23 @@
1
1
  import { Effect } from "effect";
2
2
  import type { Duration } from "effect";
3
- import { ProvisioningTimeout } from "../errors/tagged";
4
- export interface PollOptions<Status, E, R> {
3
+ import { ProviderApiError, ProvisioningTimeout } from "../errors/tagged";
4
+ export interface PollOptions<Status, E, R, Timeout = ProvisioningTimeout> {
5
5
  readonly check: Effect.Effect<Status, E, R>;
6
6
  readonly isDone: (status: Status) => boolean;
7
7
  readonly interval: Duration.Input;
8
8
  readonly timeout: Duration.Input;
9
9
  readonly kind: string;
10
10
  readonly ref: string;
11
+ readonly describe?: (status: Status) => string;
12
+ readonly tolerateNotFound?: number;
13
+ readonly isFailed?: (status: Status) => boolean;
14
+ readonly onTimeout?: (lastStatus: Status | undefined) => Timeout;
11
15
  }
12
- export declare const pollUntil: <Status, E, R>(options: PollOptions<Status, E, R>) => Effect.Effect<Status, E | ProvisioningTimeout, R>;
16
+ interface PollFailFast<Status> {
17
+ readonly isFailed: (status: Status) => boolean;
18
+ }
19
+ export declare function pollUntil<Status, E, R, Timeout = ProvisioningTimeout>(options: PollOptions<Status, E, R, Timeout> & PollFailFast<Status>): Effect.Effect<Status, E | Timeout | ProviderApiError, R>;
20
+ export declare function pollUntil<Status, E, R, Timeout = ProvisioningTimeout>(options: PollOptions<Status, E, R, Timeout> & {
21
+ readonly isFailed?: undefined;
22
+ }): Effect.Effect<Status, E | Timeout, R>;
23
+ export {};
@@ -0,0 +1,24 @@
1
+ export interface BucketDiffResult<Spec, Existing> {
2
+ readonly toCreate: ReadonlyArray<Spec>;
3
+ readonly toReplace: ReadonlyArray<{
4
+ readonly existing: Existing;
5
+ readonly spec: Spec;
6
+ }>;
7
+ readonly toUpdate: ReadonlyArray<{
8
+ readonly existing: Existing;
9
+ readonly spec: Spec;
10
+ }>;
11
+ readonly toDelete: ReadonlyArray<Existing>;
12
+ readonly noop: ReadonlyArray<Existing>;
13
+ }
14
+ export declare const diffBuckets: <Spec extends {
15
+ readonly name: string;
16
+ }, Existing extends {
17
+ readonly name: string;
18
+ readonly retain: boolean;
19
+ }>({ desired, existing, isImmutable, isMutable }: {
20
+ readonly desired: ReadonlyArray<Spec>;
21
+ readonly existing: ReadonlyArray<Existing>;
22
+ readonly isImmutable: (spec: Spec, existing: Existing) => boolean;
23
+ readonly isMutable?: (spec: Spec, existing: Existing) => boolean;
24
+ }) => BucketDiffResult<Spec, Existing>;
@@ -0,0 +1,18 @@
1
+ import { Effect } from "effect";
2
+ import type { ClusterTag, DesiredRecord, DnsError } from "@kumulo/core";
3
+ export interface DnsProviderUnderTest {
4
+ readonly ensureRecords: (zone: string, records: ReadonlyArray<DesiredRecord>) => Effect.Effect<void, DnsError>;
5
+ readonly removeClusterRecords: (zone: string, tag: ClusterTag) => Effect.Effect<void, DnsError>;
6
+ }
7
+ export interface ContractHarness {
8
+ readonly zone: string;
9
+ readonly provider: DnsProviderUnderTest;
10
+ readonly targetOf: (subDomain: string) => string | undefined;
11
+ readonly seedForeign: (subDomain: string, target: string) => void;
12
+ readonly seedForeignKind: (subDomain: string, fieldType: string, target: string) => void;
13
+ readonly seedForeignOwnerTxt: (subDomain: string, tag: string) => void;
14
+ readonly kindsAt: (subDomain: string) => ReadonlyArray<string>;
15
+ readonly valuesAt: (subDomain: string, fieldType: string) => ReadonlyArray<string>;
16
+ readonly seedForeignTxt: (subDomain: string, value: string) => void;
17
+ }
18
+ export declare const dnsProviderContract: (build: () => ContractHarness) => void;
@@ -0,0 +1,2 @@
1
+ export { dnsProviderContract } from "./contract";
2
+ export type { ContractHarness, DnsProviderUnderTest } from "./contract";