Files
kuber/types.d.ts
T

73 lines
1.9 KiB
TypeScript

import type { ComposeSpecification } from "./schema/docker.js";
export type { ComposeSpecification } from "./schema/docker.js";
export type MaybePromise<T> = T | Promise<T>;
export interface KuberHookContext {
cwd: string;
project: string;
composeFile: string;
configFile?: string;
}
export interface KuberBuildResult {
built: string[];
changed: string[];
}
export interface KuberResource {
apiVersion?: string;
kind?: string;
metadata?: {
name?: string;
namespace?: string;
labels?: Record<string, string>;
annotations?: Record<string, string>;
};
[key: string]: unknown;
}
export interface KuberBuildersConfig {
amd64?: string;
arm64?: string;
remoteRoot?: string;
}
export interface KuberConfig {
/** Kubernetes namespace/project name. Defaults to the working directory name. */
project?: string;
/** Compose file path, resolved relative to the working directory. */
composeFile?: string;
/** Container registry hostname or path, without a trailing slash. */
registry?: string;
builders?: KuberBuildersConfig;
/** Maximum time to wait for each deployment rollout. */
rolloutTimeoutMs?: number;
/** Runs once after the Compose file is parsed and validated. */
compose?(
compose: ComposeSpecification,
context: KuberHookContext,
): MaybePromise<void>;
/** Runs before build eligibility is evaluated when builds are enabled. */
preBuild?(
compose: ComposeSpecification,
context: KuberHookContext,
): MaybePromise<void>;
postBuild?(
result: KuberBuildResult,
context: KuberHookContext,
): MaybePromise<void>;
/** Runs after manifest rendering and before reconciliation planning. */
postRender?(
resources: KuberResource[],
context: KuberHookContext,
): MaybePromise<void>;
/** Runs after all desired resources have been applied. */
postApply?(
resources: KuberResource[],
context: KuberHookContext,
): MaybePromise<void>;
}