- Added a new `rollback` command to roll back deployments to their previous release. - Introduced `findRollbackCandidates` and `rollbackDeployment` functions to handle rollback logic. - Updated CLI command definitions to include the new `rollback` command with an alias. - Enhanced deployment conversion to use resolved images for buildable services. - Introduced a new `graph` module to visualize Kubernetes resources and their relationships. - Added tests for the new rollback functionality and graph rendering. - Updated package version to 1.3.0.
75 lines
2.1 KiB
TypeScript
75 lines
2.1 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[];
|
|
/** Resolved immutable image references (`name -> registry/.../image:latest@sha256:...`) for buildable services. */
|
|
images: Record<string, 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. Overrides the Compose name and working directory. */
|
|
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>;
|
|
}
|