@chimoney.io/iaas-k8s-deployment
Version:
Kubernetes Infrastructure as a Service deployment package for streamlined multi-cloud environments
157 lines • 4.42 kB
TypeScript
import { TierCalculator } from "./tier-calculator.js";
import { PlanTier } from "../types/plans.js";
import { KubecostClient } from "./kubecost-client.js";
import { Logger } from "../types/index.js";
export interface MigrationPlan {
companyName: string;
fromTier: PlanTier;
toTier: PlanTier;
namespace: string;
migrationType: "upgrade" | "downgrade";
requiresDowntime: boolean;
estimatedDuration: string;
preChecks: string[];
steps: string[];
rollbackSteps: string[];
warnings: string[];
costImpact?: {
currentMonthlyCost: number;
newMonthlyCost: number;
difference: number;
};
}
export interface MigrationResult {
success: boolean;
duration?: string;
error?: string;
rollbackRequired?: boolean;
details?: Record<string, any>;
}
export interface MigrationValidationResult {
isValid: boolean;
errors: string[];
warnings: string[];
recommendations: string[];
}
export interface MigrationPreCheck {
name: string;
description: string;
passed: boolean;
error?: string;
details?: Record<string, any>;
}
export interface ResourceUsage {
cpu: number;
memory: number;
storage: number;
}
export declare class TierMigrationManager {
private tierCalculator;
private kubecostClient;
private logger;
constructor(tierCalculator: TierCalculator, kubecostClient: KubecostClient, logger: Logger);
/**
* Plan a migration between tiers
*/
planMigration(companyName: string, fromTier: PlanTier, toTier: PlanTier, namespace?: string): Promise<MigrationPlan>;
/**
* Execute a migration plan
*/
executeMigration(companyName: string, fromTier: PlanTier, toTier: PlanTier, namespace?: string, options?: {
dryRun?: boolean;
force?: boolean;
skipPreChecks?: boolean;
k8sProvider?: any;
}): Promise<MigrationResult>;
/**
* Execute rollback of a failed migration
*/
rollbackMigration(companyName: string, fromTier: PlanTier, toTier: PlanTier, namespace?: string, options?: {
k8sProvider?: any;
}): Promise<MigrationResult>;
/**
* Validate if a migration is possible and safe
*/
validateMigration(companyName: string, fromTier: PlanTier, toTier: PlanTier, namespace?: string, options?: {
checkResourceUsage?: boolean;
checkClusterCapacity?: boolean;
}): Promise<MigrationValidationResult>;
/**
* Get current resource usage for a company/namespace
*/
getCurrentResourceUsage(companyName: string, namespace?: string): Promise<ResourceUsage>;
/**
* Get resource limits for a specific tier
*/
private getTierResourceLimits;
/**
* Run pre-checks before migration
*/
private runPreChecks;
/**
* Execute a single migration step
*/
private executeStep;
/**
* Create configuration backup
*/
private createConfigurationBackup;
/**
* Update resource quota for new tier
*/
private updateResourceQuota;
/**
* Scale services to new tier specifications
*/
private scaleServices;
/**
* Update tier labels and annotations
*/
private updateTierLabels;
/**
* Update limit range for new tier
*/
private updateLimitRange;
/**
* Update Kubecost configuration
*/
private updateKubecostConfiguration;
/**
* Check if migration requires downtime
*/
private tierRequiresDowntime;
/**
* Check if a tier can be upgraded
*/
canUpgradeTier(tier: PlanTier): boolean;
/**
* Check if a tier can be downgraded
*/
canDowngradeTier(tier: PlanTier): boolean;
/**
* Get the next higher tier
*/
getNextTier(tier: PlanTier): PlanTier | null;
/**
* Get the next lower tier
*/
getPreviousTier(tier: PlanTier): PlanTier | null;
/**
* Get all possible migration paths from a tier
*/
getPossibleMigrations(tier: PlanTier): Array<{
targetTier: PlanTier;
migrationType: "upgrade" | "downgrade";
estimatedDuration: string;
complexity: "low" | "medium" | "high";
}>;
/**
* Determine migration type
*/
private getMigrationType;
/**
* Estimate migration duration
*/
private estimateMigrationDuration;
}
//# sourceMappingURL=tier-migration.d.ts.map