Documentation
¶
Index ¶
- func CreateMigrationCommand() *cobra.Command
- type AutomationConfig
- type CachedConversion
- type ConsoleStatusHandler
- type ConversionCache
- type ConversionOptimizer
- func (o *ConversionOptimizer) CacheConversion(source runtime.Object, target runtime.Object) error
- func (o *ConversionOptimizer) GetMetrics() OptimizationMetrics
- func (o *ConversionOptimizer) OptimizeBatch(resources []types.NamespacedName) []types.NamespacedName
- func (o *ConversionOptimizer) OptimizeConversion(ctx context.Context, source runtime.Object, targetGVK runtime.GroupVersionKind) (runtime.Object, bool, error)
- func (o *ConversionOptimizer) PrewarmCache(ctx context.Context, resources []runtime.Object) error
- func (o *ConversionOptimizer) ResetMetrics()
- type DataIntegrityRule
- type DependencyOrderStrategy
- type DeprecatedPath
- type DiffType
- type EventLevel
- type EventType
- type FieldChange
- type FieldChangeType
- type FieldDiff
- type FieldInfo
- type FieldRequirementRule
- type InMemorySchemaStorage
- func (s *InMemorySchemaStorage) LoadEvolution(ctx context.Context, gk schema.GroupKind) (*SchemaEvolution, error)
- func (s *InMemorySchemaStorage) LoadMigrationHistory(ctx context.Context, limit int) ([]*MigrationHistoryEntry, error)
- func (s *InMemorySchemaStorage) SaveEvolution(ctx context.Context, evolution *SchemaEvolution) error
- func (s *InMemorySchemaStorage) SaveMigrationHistory(ctx context.Context, entry *MigrationHistoryEntry) error
- type MetricsStatusHandler
- type MigrationAutomation
- func (a *MigrationAutomation) CreatePlan(ctx context.Context, sourceGVKStr, targetGVKStr, selector, outputFile string, ...) error
- func (a *MigrationAutomation) ExecutePlan(ctx context.Context, planFile string, autoApprove bool, ...) error
- func (a *MigrationAutomation) ValidateResources(ctx context.Context, resourceFile, targetVersion string, ...) error
- type MigrationError
- type MigrationEvent
- type MigrationHistoryEntry
- type MigrationManager
- func (m *MigrationManager) ExecuteMigration(ctx context.Context, plan *MigrationPlan) (*MigrationResult, error)
- func (m *MigrationManager) GetMigrationHistory(ctx context.Context, limit int) ([]*MigrationHistoryEntry, error)
- func (m *MigrationManager) GetMigrationStatus(ctx context.Context) (*MigrationStatus, error)
- func (m *MigrationManager) PlanMigration(ctx context.Context, sourceGVK, targetGVK schema.GroupVersionKind, ...) (*MigrationPlan, error)
- func (m *MigrationManager) Rollback(ctx context.Context, plan *MigrationPlan, result *MigrationResult) error
- type MigrationMetrics
- type MigrationOption
- type MigrationPhase
- type MigrationPlan
- type MigrationProgress
- type MigrationRecord
- type MigrationReport
- type MigrationResult
- type MigrationStatus
- type MigrationStatusReport
- type MigrationStatusReporter
- func (r *MigrationStatusReporter) AddError(message string, resource string, err error)
- func (r *MigrationStatusReporter) AddStatusHandler(handler StatusHandler)
- func (r *MigrationStatusReporter) AddWarning(message string, resource string, details map[string]interface{})
- func (r *MigrationStatusReporter) GenerateReport() (*MigrationStatusReport, error)
- func (r *MigrationStatusReporter) GetCurrentStatus() (*MigrationStatus, error)
- func (r *MigrationStatusReporter) SetPhase(phase MigrationPhase)
- func (r *MigrationStatusReporter) Start(ctx context.Context, plan *MigrationPlan, result *MigrationResult)
- func (r *MigrationStatusReporter) UpdateProgress(result *MigrationResult)
- func (r *MigrationStatusReporter) UpdateResourceStatus(namespace, name string, status ResourceStatus, err error)
- type MigrationUtils
- func (u *MigrationUtils) AnalyzeMigrationRisk(plan *MigrationPlan) (*RiskAnalysis, error)
- func (u *MigrationUtils) BackupResource(ctx context.Context, resource *unstructured.Unstructured) (*ResourceBackup, error)
- func (u *MigrationUtils) CompareVersions(v1, v2 string) int
- func (u *MigrationUtils) DiffResources(old, new *unstructured.Unstructured) (*ResourceDiff, error)
- func (u *MigrationUtils) FindMigrationPath(gk schema.GroupKind, fromVersion, toVersion string) ([]string, error)
- func (u *MigrationUtils) GenerateMigrationScript(plan *MigrationPlan) (string, error)
- func (u *MigrationUtils) RestoreResource(ctx context.Context, backup *ResourceBackup) error
- type MigrationValidator
- func (v *MigrationValidator) RegisterRule(gvk string, rules ...ValidationRule)
- func (v *MigrationValidator) ValidatePostMigration(ctx context.Context, plan *MigrationPlan) (ValidationReport, error)
- func (v *MigrationValidator) ValidatePreMigration(ctx context.Context, plan *MigrationPlan) (ValidationReport, error)
- type NamespaceGroupingStrategy
- type OptimizationMetrics
- type OptimizationStrategy
- type PerformanceAnalyzer
- type PerformanceReport
- type PerformanceSample
- type PriorityStrategy
- type ResourceBackup
- type ResourceConsistencyRule
- type ResourceDiff
- type ResourceExistsRule
- type ResourceMigrationStatus
- type ResourcePerformance
- type ResourceQuotaRule
- type ResourceSizeStrategy
- type ResourceStatus
- type RiskAnalysis
- type RiskFactor
- type RiskLevel
- type SchemaEvolution
- type SchemaEvolutionTracker
- func (t *SchemaEvolutionTracker) GenerateMigrationReport(gk schema.GroupKind, fromVersion, toVersion string) (*MigrationReport, error)
- func (t *SchemaEvolutionTracker) GetDeprecatedFields(gk schema.GroupKind) ([]DeprecatedPath, error)
- func (t *SchemaEvolutionTracker) GetMigrationHistory(limit int) ([]*MigrationHistoryEntry, error)
- func (t *SchemaEvolutionTracker) GetSchemaEvolution(gk schema.GroupKind) (*SchemaEvolution, error)
- func (t *SchemaEvolutionTracker) RecordMigrationPlan(plan *MigrationPlan) error
- func (t *SchemaEvolutionTracker) RecordMigrationResult(plan *MigrationPlan, result *MigrationResult) error
- func (t *SchemaEvolutionTracker) TrackSchemaChange(gk schema.GroupKind, fromVersion, toVersion string, changes []FieldChange) error
- func (t *SchemaEvolutionTracker) WithStorage(storage SchemaStorage) *SchemaEvolutionTracker
- type SchemaStorage
- type SchemaValidationRule
- type StatusHandler
- type StatusValidationRule
- type ValidationError
- type ValidationReport
- type ValidationRule
- type ValidationSeverity
- type ValidationSummary
- type ValidationWarning
- type VersionCompatibilityRule
- type VersionInfo
- type WebSocketStatusHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMigrationCommand ¶
CreateMigrationCommand creates the migration CLI command
Types ¶
type AutomationConfig ¶
type AutomationConfig struct {
DryRun bool
Force bool
SkipValidation bool
BackupBeforeMigrate bool
MaxParallel int
Timeout time.Duration
OutputFormat string
LogLevel string
}
AutomationConfig contains configuration for migration automation
type CachedConversion ¶
type CachedConversion struct {
Source runtime.Object
Target runtime.Object
LastAccessed time.Time
AccessCount int
Size int64
}
CachedConversion represents a cached conversion result
type ConsoleStatusHandler ¶
type ConsoleStatusHandler struct {
// contains filtered or unexported fields
}
ConsoleStatusHandler outputs status updates to console
func (*ConsoleStatusHandler) HandleStatusUpdate ¶
func (h *ConsoleStatusHandler) HandleStatusUpdate(status *MigrationStatus)
type ConversionCache ¶
type ConversionCache struct {
// contains filtered or unexported fields
}
ConversionCache caches conversion results for reuse
func NewConversionCache ¶
func NewConversionCache(maxSize int) *ConversionCache
NewConversionCache creates a new conversion cache
func (*ConversionCache) Get ¶
func (c *ConversionCache) Get(key string) (*CachedConversion, bool)
Get retrieves a cached conversion
func (*ConversionCache) Put ¶
func (c *ConversionCache) Put(key string, value *CachedConversion)
Put stores a conversion in the cache
func (*ConversionCache) Size ¶
func (c *ConversionCache) Size() int
Size returns the current cache size
type ConversionOptimizer ¶
type ConversionOptimizer struct {
// contains filtered or unexported fields
}
ConversionOptimizer optimizes conversion operations for performance
func NewConversionOptimizer ¶
func NewConversionOptimizer(log logr.Logger) *ConversionOptimizer
NewConversionOptimizer creates a new conversion optimizer
func (*ConversionOptimizer) CacheConversion ¶
CacheConversion caches a conversion result
func (*ConversionOptimizer) GetMetrics ¶
func (o *ConversionOptimizer) GetMetrics() OptimizationMetrics
GetMetrics returns optimization metrics
func (*ConversionOptimizer) OptimizeBatch ¶
func (o *ConversionOptimizer) OptimizeBatch(resources []types.NamespacedName) []types.NamespacedName
OptimizeBatch optimizes a batch of resources for conversion
func (*ConversionOptimizer) OptimizeConversion ¶
func (o *ConversionOptimizer) OptimizeConversion(ctx context.Context, source runtime.Object, targetGVK runtime.GroupVersionKind) (runtime.Object, bool, error)
OptimizeConversion optimizes a single conversion operation
func (*ConversionOptimizer) PrewarmCache ¶
PrewarmCache prewarms the cache with common conversions
func (*ConversionOptimizer) ResetMetrics ¶
func (o *ConversionOptimizer) ResetMetrics()
ResetMetrics resets optimization metrics
type DataIntegrityRule ¶
type DataIntegrityRule struct {
// contains filtered or unexported fields
}
DataIntegrityRule validates data integrity after migration
func (*DataIntegrityRule) Description ¶
func (r *DataIntegrityRule) Description() string
func (*DataIntegrityRule) Name ¶
func (r *DataIntegrityRule) Name() string
func (*DataIntegrityRule) Validate ¶
func (r *DataIntegrityRule) Validate(ctx context.Context, obj *unstructured.Unstructured) error
type DependencyOrderStrategy ¶
type DependencyOrderStrategy struct{}
DependencyOrderStrategy orders resources by dependencies
func (*DependencyOrderStrategy) Apply ¶
func (s *DependencyOrderStrategy) Apply(resources []types.NamespacedName) []types.NamespacedName
func (*DependencyOrderStrategy) Name ¶
func (s *DependencyOrderStrategy) Name() string
type DeprecatedPath ¶
type DeprecatedPath struct {
Path string
DeprecatedSince string
RemovedIn string
MigrationPath string
Description string
}
DeprecatedPath represents a deprecated field path
type EventLevel ¶
type EventLevel string
EventLevel represents the severity level of an event
const ( EventLevelInfo EventLevel = "Info" EventLevelWarning EventLevel = "Warning" EventLevelError EventLevel = "Error" )
type FieldChange ¶
type FieldChange struct {
Type FieldChangeType
Path string
FieldType string
Description string
MigratedTo string
}
FieldChange represents a change in a field
type FieldChangeType ¶
type FieldChangeType string
FieldChangeType represents the type of field change
const ( FieldChangeTypeAdded FieldChangeType = "Added" FieldChangeTypeRemoved FieldChangeType = "Removed" FieldChangeTypeModified FieldChangeType = "Modified" FieldChangeTypeDeprecated FieldChangeType = "Deprecated" )
type FieldInfo ¶
type FieldInfo struct {
Path string
Type string
Description string
Added time.Time
Deprecated *time.Time
Removed *time.Time
MigratedTo string
}
FieldInfo contains information about a field
type FieldRequirementRule ¶
type FieldRequirementRule struct{}
FieldRequirementRule validates required fields
func (*FieldRequirementRule) Description ¶
func (r *FieldRequirementRule) Description() string
func (*FieldRequirementRule) Name ¶
func (r *FieldRequirementRule) Name() string
func (*FieldRequirementRule) Validate ¶
func (r *FieldRequirementRule) Validate(ctx context.Context, obj *unstructured.Unstructured) error
type InMemorySchemaStorage ¶
type InMemorySchemaStorage struct {
// contains filtered or unexported fields
}
InMemorySchemaStorage provides in-memory storage for schema evolution
func NewInMemorySchemaStorage ¶
func NewInMemorySchemaStorage() *InMemorySchemaStorage
NewInMemorySchemaStorage creates a new in-memory storage
func (*InMemorySchemaStorage) LoadEvolution ¶
func (s *InMemorySchemaStorage) LoadEvolution(ctx context.Context, gk schema.GroupKind) (*SchemaEvolution, error)
LoadEvolution loads schema evolution
func (*InMemorySchemaStorage) LoadMigrationHistory ¶
func (s *InMemorySchemaStorage) LoadMigrationHistory(ctx context.Context, limit int) ([]*MigrationHistoryEntry, error)
LoadMigrationHistory loads migration history
func (*InMemorySchemaStorage) SaveEvolution ¶
func (s *InMemorySchemaStorage) SaveEvolution(ctx context.Context, evolution *SchemaEvolution) error
SaveEvolution saves schema evolution
func (*InMemorySchemaStorage) SaveMigrationHistory ¶
func (s *InMemorySchemaStorage) SaveMigrationHistory(ctx context.Context, entry *MigrationHistoryEntry) error
SaveMigrationHistory saves migration history
type MetricsStatusHandler ¶
type MetricsStatusHandler struct {
}
MetricsStatusHandler updates Prometheus metrics
func (*MetricsStatusHandler) HandleStatusUpdate ¶
func (h *MetricsStatusHandler) HandleStatusUpdate(status *MigrationStatus)
HandleStatusUpdate updates Prometheus metrics
type MigrationAutomation ¶
type MigrationAutomation struct {
// contains filtered or unexported fields
}
MigrationAutomation provides automated migration capabilities
func NewMigrationAutomation ¶
func NewMigrationAutomation(configFlags *genericclioptions.ConfigFlags) (*MigrationAutomation, error)
NewMigrationAutomation creates a new migration automation instance
func (*MigrationAutomation) CreatePlan ¶
func (a *MigrationAutomation) CreatePlan(ctx context.Context, sourceGVKStr, targetGVKStr, selector, outputFile string, config *AutomationConfig) error
CreatePlan creates a migration plan
func (*MigrationAutomation) ExecutePlan ¶
func (a *MigrationAutomation) ExecutePlan(ctx context.Context, planFile string, autoApprove bool, config *AutomationConfig) error
ExecutePlan executes a migration plan
func (*MigrationAutomation) ValidateResources ¶
func (a *MigrationAutomation) ValidateResources(ctx context.Context, resourceFile, targetVersion string, config *AutomationConfig) error
ValidateResources validates resources for migration
type MigrationError ¶
type MigrationError struct {
Resource types.NamespacedName
Error error
Phase string
Retry bool
}
MigrationError represents an error during migration
type MigrationEvent ¶
type MigrationEvent struct {
Timestamp time.Time
Type EventType
Level EventLevel
Message string
Resource string
Details map[string]interface{}
}
MigrationEvent represents an event during migration
type MigrationHistoryEntry ¶
type MigrationHistoryEntry struct {
Timestamp time.Time
Plan *MigrationPlan
Result *MigrationResult
Annotations map[string]string
}
MigrationHistoryEntry represents an entry in migration history
type MigrationManager ¶
type MigrationManager struct {
// contains filtered or unexported fields
}
MigrationManager manages the migration of resources between API versions
func NewMigrationManager ¶
func NewMigrationManager(client client.Client, scheme *runtime.Scheme, log logr.Logger) *MigrationManager
NewMigrationManager creates a new migration manager
func (*MigrationManager) ExecuteMigration ¶
func (m *MigrationManager) ExecuteMigration(ctx context.Context, plan *MigrationPlan) (*MigrationResult, error)
ExecuteMigration executes a migration plan
func (*MigrationManager) GetMigrationHistory ¶
func (m *MigrationManager) GetMigrationHistory(ctx context.Context, limit int) ([]*MigrationHistoryEntry, error)
GetMigrationHistory returns the history of migrations
func (*MigrationManager) GetMigrationStatus ¶
func (m *MigrationManager) GetMigrationStatus(ctx context.Context) (*MigrationStatus, error)
GetMigrationStatus returns the current status of migrations
func (*MigrationManager) PlanMigration ¶
func (m *MigrationManager) PlanMigration(ctx context.Context, sourceGVK, targetGVK schema.GroupVersionKind, opts ...MigrationOption) (*MigrationPlan, error)
PlanMigration creates a migration plan for resources
func (*MigrationManager) Rollback ¶
func (m *MigrationManager) Rollback(ctx context.Context, plan *MigrationPlan, result *MigrationResult) error
Rollback performs a rollback of a failed migration
type MigrationMetrics ¶
type MigrationMetrics struct {
AverageResourceTime time.Duration
TotalDuration time.Duration
ResourcesPerSecond float64
SuccessRate float64
RetryRate float64
EstimatedCompletion time.Time
MemoryUsageMB float64
CPUUsagePercent float64
NetworkBandwidthMBps float64
}
MigrationMetrics contains migration performance metrics
type MigrationOption ¶
type MigrationOption func(*migrationOptions)
MigrationOption is a function that configures migration options
func WithBatchSize ¶
func WithBatchSize(size int) MigrationOption
WithBatchSize sets the batch size for migration
func WithMaxConcurrency ¶
func WithMaxConcurrency(max int) MigrationOption
WithMaxConcurrency sets the maximum concurrency for parallel migration
func WithParallel ¶
func WithParallel(parallel bool) MigrationOption
WithParallel enables parallel migration
func WithValidation ¶
func WithValidation(pre, post bool) MigrationOption
WithValidation configures validation options
type MigrationPhase ¶
type MigrationPhase string
MigrationPhase represents the current phase of migration
const ( MigrationPhaseInitializing MigrationPhase = "Initializing" MigrationPhaseValidating MigrationPhase = "Validating" MigrationPhaseMigrating MigrationPhase = "Migrating" MigrationPhaseVerifying MigrationPhase = "Verifying" MigrationPhaseCompleted MigrationPhase = "Completed" MigrationPhaseFailed MigrationPhase = "Failed" MigrationPhaseRollingBack MigrationPhase = "RollingBack" )
type MigrationPlan ¶
type MigrationPlan struct {
SourceGVK schema.GroupVersionKind
TargetGVK schema.GroupVersionKind
Resources []types.NamespacedName
BatchSize int
DryRun bool
PreValidation bool
PostValidation bool
Parallel bool
MaxConcurrency int
}
MigrationPlan represents a plan for migrating resources
type MigrationProgress ¶
type MigrationProgress struct {
TotalResources int
ProcessedResources int
SuccessfulResources int
FailedResources int
SkippedResources int
PercentComplete float64
EstimatedTimeLeft time.Duration
CurrentBatch int
TotalBatches int
}
MigrationProgress tracks migration progress
type MigrationRecord ¶
type MigrationRecord struct {
ID string
FromVersion string
ToVersion string
StartTime time.Time
EndTime *time.Time
Status MigrationStatus
TotalResources int
Successful int
Failed int
Details map[string]interface{}
}
MigrationRecord represents a migration between versions
type MigrationReport ¶
type MigrationReport struct {
GroupKind schema.GroupKind
FromVersion string
ToVersion string
Timestamp time.Time
FieldChanges []FieldChange
DeprecatedFields []DeprecatedPath
Recommendations []string
}
MigrationReport represents a comprehensive migration report
type MigrationResult ¶
type MigrationResult struct {
TotalResources int
SuccessfulCount int
FailedCount int
SkippedCount int
Duration time.Duration
Errors []MigrationError
ValidationReport ValidationReport
}
MigrationResult contains the results of a migration operation
type MigrationStatus ¶
type MigrationStatus struct {
ID string
Plan *MigrationPlan
StartTime time.Time
LastUpdateTime time.Time
Phase MigrationPhase
Progress MigrationProgress
ResourceStatuses map[string]*ResourceMigrationStatus
Metrics MigrationMetrics
Events []MigrationEvent
}
MigrationStatus represents the current status of a migration
const ( MigrationStatusPending MigrationStatus = "Pending" MigrationStatusInProgress MigrationStatus = "InProgress" MigrationStatusCompleted MigrationStatus = "Completed" MigrationStatusFailed MigrationStatus = "Failed" MigrationStatusRollback MigrationStatus = "Rollback" )
type MigrationStatusReport ¶
type MigrationStatusReport struct {
ID string
StartTime time.Time
EndTime time.Time
Duration time.Duration
Plan *MigrationPlan
Progress MigrationProgress
Metrics MigrationMetrics
Summary string
ResourcesByStatus map[ResourceStatus][]*ResourceMigrationStatus
Events []MigrationEvent
}
MigrationStatusReport represents a comprehensive status report
type MigrationStatusReporter ¶
type MigrationStatusReporter struct {
// contains filtered or unexported fields
}
MigrationStatusReporter provides real-time migration status reporting
func NewMigrationStatusReporter ¶
func NewMigrationStatusReporter(log logr.Logger) *MigrationStatusReporter
NewMigrationStatusReporter creates a new migration status reporter
func (*MigrationStatusReporter) AddError ¶
func (r *MigrationStatusReporter) AddError(message string, resource string, err error)
AddError adds an error event
func (*MigrationStatusReporter) AddStatusHandler ¶
func (r *MigrationStatusReporter) AddStatusHandler(handler StatusHandler)
AddStatusHandler adds a status update handler
func (*MigrationStatusReporter) AddWarning ¶
func (r *MigrationStatusReporter) AddWarning(message string, resource string, details map[string]interface{})
AddWarning adds a warning event
func (*MigrationStatusReporter) GenerateReport ¶
func (r *MigrationStatusReporter) GenerateReport() (*MigrationStatusReport, error)
GenerateReport generates a migration status report
func (*MigrationStatusReporter) GetCurrentStatus ¶
func (r *MigrationStatusReporter) GetCurrentStatus() (*MigrationStatus, error)
GetCurrentStatus returns the current migration status
func (*MigrationStatusReporter) SetPhase ¶
func (r *MigrationStatusReporter) SetPhase(phase MigrationPhase)
SetPhase sets the current migration phase
func (*MigrationStatusReporter) Start ¶
func (r *MigrationStatusReporter) Start(ctx context.Context, plan *MigrationPlan, result *MigrationResult)
Start begins status reporting for a migration
func (*MigrationStatusReporter) UpdateProgress ¶
func (r *MigrationStatusReporter) UpdateProgress(result *MigrationResult)
UpdateProgress updates the migration progress
func (*MigrationStatusReporter) UpdateResourceStatus ¶
func (r *MigrationStatusReporter) UpdateResourceStatus(namespace, name string, status ResourceStatus, err error)
UpdateResourceStatus updates the status of a specific resource
type MigrationUtils ¶
type MigrationUtils struct {
// contains filtered or unexported fields
}
MigrationUtils provides utility functions for migration operations
func NewMigrationUtils ¶
func NewMigrationUtils(client client.Client, scheme *runtime.Scheme, log logr.Logger) *MigrationUtils
NewMigrationUtils creates a new migration utilities instance
func (*MigrationUtils) AnalyzeMigrationRisk ¶
func (u *MigrationUtils) AnalyzeMigrationRisk(plan *MigrationPlan) (*RiskAnalysis, error)
AnalyzeMigrationRisk analyzes the risk level of a migration
func (*MigrationUtils) BackupResource ¶
func (u *MigrationUtils) BackupResource(ctx context.Context, resource *unstructured.Unstructured) (*ResourceBackup, error)
BackupResource creates a backup of a resource
func (*MigrationUtils) CompareVersions ¶
func (u *MigrationUtils) CompareVersions(v1, v2 string) int
CompareVersions compares two API versions to determine migration direction
func (*MigrationUtils) DiffResources ¶
func (u *MigrationUtils) DiffResources(old, new *unstructured.Unstructured) (*ResourceDiff, error)
DiffResources compares two resources and returns differences
func (*MigrationUtils) FindMigrationPath ¶
func (u *MigrationUtils) FindMigrationPath(gk schema.GroupKind, fromVersion, toVersion string) ([]string, error)
FindMigrationPath finds the migration path between versions
func (*MigrationUtils) GenerateMigrationScript ¶
func (u *MigrationUtils) GenerateMigrationScript(plan *MigrationPlan) (string, error)
GenerateMigrationScript generates a migration script
func (*MigrationUtils) RestoreResource ¶
func (u *MigrationUtils) RestoreResource(ctx context.Context, backup *ResourceBackup) error
RestoreResource restores a resource from backup
type MigrationValidator ¶
type MigrationValidator struct {
// contains filtered or unexported fields
}
MigrationValidator validates resources before and after migration
func NewMigrationValidator ¶
func NewMigrationValidator(client client.Client, scheme *runtime.Scheme, log logr.Logger) *MigrationValidator
NewMigrationValidator creates a new migration validator
func (*MigrationValidator) RegisterRule ¶
func (v *MigrationValidator) RegisterRule(gvk string, rules ...ValidationRule)
RegisterRule registers validation rules for a GVK
func (*MigrationValidator) ValidatePostMigration ¶
func (v *MigrationValidator) ValidatePostMigration(ctx context.Context, plan *MigrationPlan) (ValidationReport, error)
ValidatePostMigration performs post-migration validation
func (*MigrationValidator) ValidatePreMigration ¶
func (v *MigrationValidator) ValidatePreMigration(ctx context.Context, plan *MigrationPlan) (ValidationReport, error)
ValidatePreMigration performs pre-migration validation
type NamespaceGroupingStrategy ¶
type NamespaceGroupingStrategy struct{}
NamespaceGroupingStrategy groups resources by namespace
func (*NamespaceGroupingStrategy) Apply ¶
func (s *NamespaceGroupingStrategy) Apply(resources []types.NamespacedName) []types.NamespacedName
func (*NamespaceGroupingStrategy) Name ¶
func (s *NamespaceGroupingStrategy) Name() string
type OptimizationMetrics ¶
type OptimizationMetrics struct {
CacheHits int64
CacheMisses int64
ConversionsOptimized int64
TimeSaved time.Duration
MemorySaved int64
// contains filtered or unexported fields
}
OptimizationMetrics tracks optimization performance
type OptimizationStrategy ¶
type OptimizationStrategy interface {
Name() string
Apply(resources []types.NamespacedName) []types.NamespacedName
}
OptimizationStrategy represents a conversion optimization strategy
type PerformanceAnalyzer ¶
type PerformanceAnalyzer struct {
// contains filtered or unexported fields
}
PerformanceAnalyzer analyzes conversion performance
func NewPerformanceAnalyzer ¶
func NewPerformanceAnalyzer(log logr.Logger) *PerformanceAnalyzer
NewPerformanceAnalyzer creates a new performance analyzer
func (*PerformanceAnalyzer) GetPerformanceReport ¶
func (a *PerformanceAnalyzer) GetPerformanceReport() *PerformanceReport
GetPerformanceReport generates a performance report
func (*PerformanceAnalyzer) RecordSample ¶
func (a *PerformanceAnalyzer) RecordSample(sample PerformanceSample)
RecordSample records a performance sample
type PerformanceReport ¶
type PerformanceReport struct {
TotalSamples int
ByResource map[string]*ResourcePerformance
}
PerformanceReport contains performance analysis results
type PerformanceSample ¶
type PerformanceSample struct {
ResourceType string
Operation string
Duration time.Duration
Size int64
Success bool
Timestamp time.Time
}
PerformanceSample represents a performance measurement
type PriorityStrategy ¶
type PriorityStrategy struct{}
PriorityStrategy orders resources by priority
func (*PriorityStrategy) Apply ¶
func (s *PriorityStrategy) Apply(resources []types.NamespacedName) []types.NamespacedName
func (*PriorityStrategy) Name ¶
func (s *PriorityStrategy) Name() string
type ResourceBackup ¶
type ResourceBackup struct {
Resource *unstructured.Unstructured
Timestamp metav1.Time
Annotations map[string]string
}
ResourceBackup represents a resource backup
type ResourceConsistencyRule ¶
type ResourceConsistencyRule struct {
// contains filtered or unexported fields
}
ResourceConsistencyRule validates resource consistency
func (*ResourceConsistencyRule) Description ¶
func (r *ResourceConsistencyRule) Description() string
func (*ResourceConsistencyRule) Name ¶
func (r *ResourceConsistencyRule) Name() string
func (*ResourceConsistencyRule) Validate ¶
func (r *ResourceConsistencyRule) Validate(ctx context.Context, obj *unstructured.Unstructured) error
type ResourceDiff ¶
type ResourceDiff struct {
Resource types.NamespacedName
OldGVK schema.GroupVersionKind
NewGVK schema.GroupVersionKind
Fields []FieldDiff
}
ResourceDiff represents differences between resources
type ResourceExistsRule ¶
type ResourceExistsRule struct {
// contains filtered or unexported fields
}
ResourceExistsRule validates that the resource exists
func (*ResourceExistsRule) Description ¶
func (r *ResourceExistsRule) Description() string
func (*ResourceExistsRule) Name ¶
func (r *ResourceExistsRule) Name() string
func (*ResourceExistsRule) Validate ¶
func (r *ResourceExistsRule) Validate(ctx context.Context, obj *unstructured.Unstructured) error
type ResourceMigrationStatus ¶
type ResourceMigrationStatus struct {
Name string
Namespace string
Status ResourceStatus
StartTime time.Time
EndTime *time.Time
Duration time.Duration
Error string
RetryCount int
LastAttempt time.Time
}
ResourceMigrationStatus tracks individual resource migration status
type ResourcePerformance ¶
type ResourcePerformance struct {
ResourceType string
TotalOperations int
SuccessfulOperations int
TotalDuration time.Duration
AverageDuration time.Duration
MinDuration time.Duration
MaxDuration time.Duration
SuccessRate float64
}
ResourcePerformance contains performance metrics for a resource type
type ResourceQuotaRule ¶
type ResourceQuotaRule struct {
// contains filtered or unexported fields
}
ResourceQuotaRule validates resource quota compliance
func (*ResourceQuotaRule) Description ¶
func (r *ResourceQuotaRule) Description() string
func (*ResourceQuotaRule) Name ¶
func (r *ResourceQuotaRule) Name() string
func (*ResourceQuotaRule) Validate ¶
func (r *ResourceQuotaRule) Validate(ctx context.Context, obj *unstructured.Unstructured) error
type ResourceSizeStrategy ¶
type ResourceSizeStrategy struct{}
ResourceSizeStrategy orders resources by estimated size
func (*ResourceSizeStrategy) Apply ¶
func (s *ResourceSizeStrategy) Apply(resources []types.NamespacedName) []types.NamespacedName
func (*ResourceSizeStrategy) Name ¶
func (s *ResourceSizeStrategy) Name() string
type ResourceStatus ¶
type ResourceStatus string
ResourceStatus represents the status of a resource migration
const ( ResourceStatusPending ResourceStatus = "Pending" ResourceStatusInProgress ResourceStatus = "InProgress" ResourceStatusCompleted ResourceStatus = "Completed" ResourceStatusFailed ResourceStatus = "Failed" ResourceStatusSkipped ResourceStatus = "Skipped" ResourceStatusRetrying ResourceStatus = "Retrying" )
type RiskAnalysis ¶
type RiskAnalysis struct {
OverallRisk RiskLevel
Factors []RiskFactor
}
RiskAnalysis represents migration risk analysis
type RiskFactor ¶
RiskFactor represents a risk factor
type SchemaEvolution ¶
type SchemaEvolution struct {
GroupKind schema.GroupKind
Versions []VersionInfo
Migrations []MigrationRecord
CurrentVersion string
DeprecatedPaths []DeprecatedPath
}
SchemaEvolution represents the evolution of a schema
type SchemaEvolutionTracker ¶
type SchemaEvolutionTracker struct {
// contains filtered or unexported fields
}
SchemaEvolutionTracker tracks schema changes and migration history
func NewSchemaEvolutionTracker ¶
func NewSchemaEvolutionTracker(log logr.Logger) *SchemaEvolutionTracker
NewSchemaEvolutionTracker creates a new schema evolution tracker
func (*SchemaEvolutionTracker) GenerateMigrationReport ¶
func (t *SchemaEvolutionTracker) GenerateMigrationReport(gk schema.GroupKind, fromVersion, toVersion string) (*MigrationReport, error)
GenerateMigrationReport generates a comprehensive migration report
func (*SchemaEvolutionTracker) GetDeprecatedFields ¶
func (t *SchemaEvolutionTracker) GetDeprecatedFields(gk schema.GroupKind) ([]DeprecatedPath, error)
GetDeprecatedFields returns all deprecated fields for a GroupKind
func (*SchemaEvolutionTracker) GetMigrationHistory ¶
func (t *SchemaEvolutionTracker) GetMigrationHistory(limit int) ([]*MigrationHistoryEntry, error)
GetMigrationHistory retrieves migration history
func (*SchemaEvolutionTracker) GetSchemaEvolution ¶
func (t *SchemaEvolutionTracker) GetSchemaEvolution(gk schema.GroupKind) (*SchemaEvolution, error)
GetSchemaEvolution retrieves schema evolution for a GroupKind
func (*SchemaEvolutionTracker) RecordMigrationPlan ¶
func (t *SchemaEvolutionTracker) RecordMigrationPlan(plan *MigrationPlan) error
RecordMigrationPlan records a migration plan
func (*SchemaEvolutionTracker) RecordMigrationResult ¶
func (t *SchemaEvolutionTracker) RecordMigrationResult(plan *MigrationPlan, result *MigrationResult) error
RecordMigrationResult records the result of a migration
func (*SchemaEvolutionTracker) TrackSchemaChange ¶
func (t *SchemaEvolutionTracker) TrackSchemaChange(gk schema.GroupKind, fromVersion, toVersion string, changes []FieldChange) error
TrackSchemaChange records a schema change
func (*SchemaEvolutionTracker) WithStorage ¶
func (t *SchemaEvolutionTracker) WithStorage(storage SchemaStorage) *SchemaEvolutionTracker
WithStorage sets a custom storage backend
type SchemaStorage ¶
type SchemaStorage interface {
SaveEvolution(ctx context.Context, evolution *SchemaEvolution) error
LoadEvolution(ctx context.Context, gk schema.GroupKind) (*SchemaEvolution, error)
SaveMigrationHistory(ctx context.Context, entry *MigrationHistoryEntry) error
LoadMigrationHistory(ctx context.Context, limit int) ([]*MigrationHistoryEntry, error)
}
SchemaStorage interface for persisting schema evolution data
type SchemaValidationRule ¶
type SchemaValidationRule struct {
// contains filtered or unexported fields
}
SchemaValidationRule validates against the OpenAPI schema
func (*SchemaValidationRule) Description ¶
func (r *SchemaValidationRule) Description() string
func (*SchemaValidationRule) Name ¶
func (r *SchemaValidationRule) Name() string
func (*SchemaValidationRule) Validate ¶
func (r *SchemaValidationRule) Validate(ctx context.Context, obj *unstructured.Unstructured) error
type StatusHandler ¶
type StatusHandler interface {
HandleStatusUpdate(status *MigrationStatus)
}
StatusHandler interface for handling status updates
type StatusValidationRule ¶
type StatusValidationRule struct{}
StatusValidationRule validates resource status
func (*StatusValidationRule) Description ¶
func (r *StatusValidationRule) Description() string
func (*StatusValidationRule) Name ¶
func (r *StatusValidationRule) Name() string
func (*StatusValidationRule) Validate ¶
func (r *StatusValidationRule) Validate(ctx context.Context, obj *unstructured.Unstructured) error
type ValidationError ¶
type ValidationError struct {
Resource types.NamespacedName
Rule string
Message string
Severity ValidationSeverity
Remediation string
}
ValidationError represents a validation error
type ValidationReport ¶
type ValidationReport struct {
Valid bool
TotalChecks int
PassedChecks int
FailedChecks int
Errors []ValidationError
Warnings []ValidationWarning
Summary map[string]ValidationSummary
}
ValidationReport contains the results of validation
func (ValidationReport) IsValid ¶
func (r ValidationReport) IsValid() bool
IsValid returns whether the validation report indicates success
type ValidationRule ¶
type ValidationRule interface {
Validate(ctx context.Context, obj *unstructured.Unstructured) error
Name() string
Description() string
}
ValidationRule represents a validation rule
type ValidationSeverity ¶
type ValidationSeverity string
ValidationSeverity represents the severity of a validation error
const ( ValidationSeverityCritical ValidationSeverity = "Critical" ValidationSeverityHigh ValidationSeverity = "High" ValidationSeverityMedium ValidationSeverity = "Medium" ValidationSeverityLow ValidationSeverity = "Low" )
type ValidationSummary ¶
type ValidationSummary struct {
TotalResources int
ValidResources int
InvalidResources int
Errors int
Warnings int
}
ValidationSummary provides a summary of validation results
type ValidationWarning ¶
type ValidationWarning struct {
Resource types.NamespacedName
Rule string
Message string
}
ValidationWarning represents a validation warning
type VersionCompatibilityRule ¶
type VersionCompatibilityRule struct{}
VersionCompatibilityRule validates version compatibility
func (*VersionCompatibilityRule) Description ¶
func (r *VersionCompatibilityRule) Description() string
func (*VersionCompatibilityRule) Name ¶
func (r *VersionCompatibilityRule) Name() string
func (*VersionCompatibilityRule) Validate ¶
func (r *VersionCompatibilityRule) Validate(ctx context.Context, obj *unstructured.Unstructured) error
type VersionInfo ¶
type VersionInfo struct {
Version string
ReleaseDate time.Time
Fields map[string]FieldInfo
Deprecated bool
DeprecationDate *time.Time
RemovalDate *time.Time
}
VersionInfo contains information about a specific version
type WebSocketStatusHandler ¶
type WebSocketStatusHandler struct {
// contains filtered or unexported fields
}
WebSocketStatusHandler sends status updates via WebSocket
func (*WebSocketStatusHandler) HandleStatusUpdate ¶
func (h *WebSocketStatusHandler) HandleStatusUpdate(status *MigrationStatus)
HandleStatusUpdate handles status updates for WebSocket