kubricate
Version:
A TypeScript framework for building reusable, type-safe Kubernetes infrastructure — without the YAML mess.
60 lines • 2.26 kB
TypeScript
import type { AnySecretManager } from './types.js';
/**
* SecretRegistry
*
* @description
* Central registry to globally manage all declared SecretManager instances within a project.
*
* - Provides a single authoritative map of all available SecretManagers.
* - Allows consistent conflict resolution across the entire project (not per-stack).
* - Decouples SecretManager lifecycle from consumer frameworks (e.g., Stacks in Kubricate).
* - Enables flexible, multi-environment setups (e.g., staging, production, DR plans).
*
* @remarks
* - **Conflict detection** during secret orchestration (apply/plan) operates *only* at the registry level.
* - **Stacks** or **consumers** simply reference SecretManagers; they are not responsible for conflict handling.
* - Synthing and Kubricate treat the registry as the **single source of truth** for all secret orchestration workflows.
*
* ---
*
* # Example
*
* ```ts
* const registry = new SecretRegistry()
* .register('frontend', frontendManager)
* .register('backend', backendManager);
*
* const manager = registry.get('frontend');
* ```
*
*
*/
export declare class SecretRegistry<SecretManagerStore extends Record<string, AnySecretManager> = {}> {
private registry;
/**
* Register a named SecretManager into the registry.
*
* @param name - Unique name for the secret manager.
* @param manager - SecretManager instance to register.
* @returns {SecretRegistry} for chaining
*
* @throws {Error} if a duplicate name is registered
*/
add<Name extends string, NewSecretManager extends AnySecretManager>(name: Name, manager: NewSecretManager): SecretRegistry<SecretManagerStore & Record<Name, NewSecretManager>>;
/**
* Retrieve a SecretManager by its registered name.
*
* @param name - The name of the secret manager.
* @returns {SecretManager}
*
* @throws {Error} if the name is not found
*/
get<Name extends keyof SecretManagerStore>(name: Name): SecretManagerStore[Name];
/**
* Return all registered secret managers as an object.
*
* Used internally by the orchestrator.
*/
list(): Record<string, AnySecretManager>;
}
//# sourceMappingURL=SecretRegistry.d.ts.map