conversion

package
v0.0.0-...-bac2f6a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMigrationCommand

func CreateMigrationCommand() *cobra.Command

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) Clear

func (c *ConversionCache) Clear()

Clear clears the 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

func (o *ConversionOptimizer) CacheConversion(source runtime.Object, target runtime.Object) error

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

func (o *ConversionOptimizer) PrewarmCache(ctx context.Context, resources []runtime.Object) error

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

type DependencyOrderStrategy

type DependencyOrderStrategy struct{}

DependencyOrderStrategy orders resources by dependencies

func (*DependencyOrderStrategy) Apply

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 DiffType

type DiffType string

DiffType represents the type of difference

const (
	DiffTypeAdded    DiffType = "Added"
	DiffTypeRemoved  DiffType = "Removed"
	DiffTypeModified DiffType = "Modified"
)

type EventLevel

type EventLevel string

EventLevel represents the severity level of an event

const (
	EventLevelInfo    EventLevel = "Info"
	EventLevelWarning EventLevel = "Warning"
	EventLevelError   EventLevel = "Error"
)

type EventType

type EventType string

EventType represents the type of migration event

const (
	EventTypeStarted      EventType = "Started"
	EventTypeProgress     EventType = "Progress"
	EventTypeResourceDone EventType = "ResourceDone"
	EventTypeWarning      EventType = "Warning"
	EventTypeError        EventType = "Error"
	EventTypeCompleted    EventType = "Completed"
	EventTypeRollback     EventType = "Rollback"
)

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 FieldDiff

type FieldDiff struct {
	Path     string
	Type     DiffType
	OldValue string
	NewValue string
}

FieldDiff represents a field difference

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

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

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 WithDryRun

func WithDryRun(dryRun bool) MigrationOption

WithDryRun enables dry run mode

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

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 (*NamespaceGroupingStrategy) Name

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

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

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

type ResourceSizeStrategy

type ResourceSizeStrategy struct{}

ResourceSizeStrategy orders resources by estimated size

func (*ResourceSizeStrategy) Apply

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

type RiskFactor struct {
	Type        string
	Description string
	Risk        RiskLevel
	Mitigation  string
}

RiskFactor represents a risk factor

type RiskLevel

type RiskLevel string

RiskLevel represents the risk level

const (
	RiskLevelLow    RiskLevel = "Low"
	RiskLevelMedium RiskLevel = "Medium"
	RiskLevelHigh   RiskLevel = "High"
)

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

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

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

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL