Documentation
¶
Overview ¶
Package versioning provides multi-version plugin support with canary deployments
Index ¶
- type ABTestingConfig
- type ABTestingStrategy
- func (ab *ABTestingStrategy) Deploy(ctx context.Context, spec *DeploymentSpec) error
- func (ab *ABTestingStrategy) GetDescription() string
- func (ab *ABTestingStrategy) GetName() string
- func (ab *ABTestingStrategy) Rollback(ctx context.Context, spec *DeploymentSpec) error
- func (ab *ABTestingStrategy) Validate(spec *DeploymentSpec) error
- type BlueGreenDeploymentStrategy
- func (bg *BlueGreenDeploymentStrategy) Deploy(ctx context.Context, spec *DeploymentSpec) error
- func (bg *BlueGreenDeploymentStrategy) GetDescription() string
- func (bg *BlueGreenDeploymentStrategy) GetName() string
- func (bg *BlueGreenDeploymentStrategy) Rollback(ctx context.Context, spec *DeploymentSpec) error
- func (bg *BlueGreenDeploymentStrategy) Validate(spec *DeploymentSpec) error
- type CanaryConfig
- type CanaryDeployment
- type CanaryMetrics
- type CanaryStatus
- type DeploymentOrchestrator
- func (do *DeploymentOrchestrator) Deploy(ctx context.Context, spec *DeploymentSpec) error
- func (do *DeploymentOrchestrator) GetAvailableStrategies() map[string]string
- func (do *DeploymentOrchestrator) GetStrategy(name string) (DeploymentStrategy, bool)
- func (do *DeploymentOrchestrator) RegisterStrategy(name string, strategy DeploymentStrategy)
- func (do *DeploymentOrchestrator) Rollback(ctx context.Context, spec *DeploymentSpec) error
- type DeploymentSpec
- type DeploymentStrategy
- type NotificationConfig
- type PluginVersion
- type PluginVersions
- type RollingDeploymentStrategy
- func (rd *RollingDeploymentStrategy) Deploy(ctx context.Context, spec *DeploymentSpec) error
- func (rd *RollingDeploymentStrategy) GetDescription() string
- func (rd *RollingDeploymentStrategy) GetName() string
- func (rd *RollingDeploymentStrategy) Rollback(ctx context.Context, spec *DeploymentSpec) error
- func (rd *RollingDeploymentStrategy) Validate(spec *DeploymentSpec) error
- type VersionConfig
- type VersionHistoryEntry
- type VersionManager
- func (vm *VersionManager) GetPluginVersion(pluginName string, forCanary bool) (*PluginVersion, error)
- func (vm *VersionManager) GetVersionStatus(pluginName string) (map[string]interface{}, error)
- func (vm *VersionManager) PromoteCanary(pluginName string) error
- func (vm *VersionManager) RecordCanaryMetrics(pluginName string, success bool, responseTime time.Duration)
- func (vm *VersionManager) RegisterPluginVersion(pluginName string, version string, pluginInstance plugin.Plugin, ...) error
- func (vm *VersionManager) RollbackCanary(pluginName string, reason string) error
- func (vm *VersionManager) ShouldUseCanary(pluginName string, requestID string) bool
- func (vm *VersionManager) Start(ctx context.Context) error
- func (vm *VersionManager) StartCanaryDeployment(pluginName string, newVersion string, canaryConfig *CanaryConfig) error
- func (vm *VersionManager) Stop() error
- type VersionStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ABTestingConfig ¶
type ABTestingConfig struct {
TestPercent float64
TestDuration time.Duration
SuccessThreshold float64
ErrorThreshold float64
MinRequests int64
AutoRollback bool
}
ABTestingConfig contains A/B testing configuration
type ABTestingStrategy ¶
type ABTestingStrategy struct {
// contains filtered or unexported fields
}
A/B Testing Strategy for plugin versions
func NewABTestingStrategy ¶
func NewABTestingStrategy(vm *VersionManager, logger *slog.Logger) *ABTestingStrategy
NewABTestingStrategy creates a new A/B testing strategy
func (*ABTestingStrategy) Deploy ¶
func (ab *ABTestingStrategy) Deploy(ctx context.Context, spec *DeploymentSpec) error
Deploy performs A/B testing deployment
func (*ABTestingStrategy) GetDescription ¶
func (ab *ABTestingStrategy) GetDescription() string
GetDescription returns the strategy description
func (*ABTestingStrategy) GetName ¶
func (ab *ABTestingStrategy) GetName() string
GetName returns the strategy name
func (*ABTestingStrategy) Rollback ¶
func (ab *ABTestingStrategy) Rollback(ctx context.Context, spec *DeploymentSpec) error
Rollback performs A/B testing rollback
func (*ABTestingStrategy) Validate ¶
func (ab *ABTestingStrategy) Validate(spec *DeploymentSpec) error
Validate validates the deployment specification
type BlueGreenDeploymentStrategy ¶
type BlueGreenDeploymentStrategy struct {
// contains filtered or unexported fields
}
BlueGreenDeploymentStrategy implements blue-green deployment
func NewBlueGreenDeploymentStrategy ¶
func NewBlueGreenDeploymentStrategy(vm *VersionManager, logger *slog.Logger) *BlueGreenDeploymentStrategy
NewBlueGreenDeploymentStrategy creates a new blue-green deployment strategy
func (*BlueGreenDeploymentStrategy) Deploy ¶
func (bg *BlueGreenDeploymentStrategy) Deploy(ctx context.Context, spec *DeploymentSpec) error
Deploy performs blue-green deployment
func (*BlueGreenDeploymentStrategy) GetDescription ¶
func (bg *BlueGreenDeploymentStrategy) GetDescription() string
GetDescription returns the strategy description
func (*BlueGreenDeploymentStrategy) GetName ¶
func (bg *BlueGreenDeploymentStrategy) GetName() string
GetName returns the strategy name
func (*BlueGreenDeploymentStrategy) Rollback ¶
func (bg *BlueGreenDeploymentStrategy) Rollback(ctx context.Context, spec *DeploymentSpec) error
Rollback performs blue-green rollback
func (*BlueGreenDeploymentStrategy) Validate ¶
func (bg *BlueGreenDeploymentStrategy) Validate(spec *DeploymentSpec) error
Validate validates the deployment specification
type CanaryConfig ¶
type CanaryConfig struct {
InitialPercent float64 `json:"initial_percent"`
IncrementPercent float64 `json:"increment_percent"`
IncrementInterval time.Duration `json:"increment_interval"`
MaxPercent float64 `json:"max_percent"`
SuccessThreshold float64 `json:"success_threshold"`
ErrorThreshold float64 `json:"error_threshold"`
MinRequests int64 `json:"min_requests"`
ObservationPeriod time.Duration `json:"observation_period"`
AutoPromote bool `json:"auto_promote"`
AutoRollback bool `json:"auto_rollback"`
NotificationConfig *NotificationConfig `json:"notification_config"`
}
CanaryConfig contains canary deployment configuration
type CanaryDeployment ¶
type CanaryDeployment struct {
PluginName string
OldVersion string
NewVersion string
CanaryPercent float64
StartTime time.Time
Duration time.Duration
SuccessThreshold float64
ErrorThreshold float64
AutoPromote bool
AutoRollback bool
Status CanaryStatus
Metrics *CanaryMetrics
Config *CanaryConfig
// contains filtered or unexported fields
}
CanaryDeployment manages canary deployment configuration
type CanaryMetrics ¶
type CanaryMetrics struct {
TotalRequests int64
CanaryRequests int64
CanaryErrors int64
CanarySuccesses int64
CanaryErrorRate float64
CanarySuccessRate float64
CanaryResponseTime time.Duration
ProductionErrorRate float64
ProductionSuccessRate float64
HealthScore float64
LastUpdated time.Time
}
CanaryMetrics tracks canary deployment metrics
type CanaryStatus ¶
type CanaryStatus string
CanaryStatus represents the status of a canary deployment
const ( CanaryStatusPending CanaryStatus = "pending" CanaryStatusActive CanaryStatus = "active" CanaryStatusPromoting CanaryStatus = "promoting" CanaryStatusRollingBack CanaryStatus = "rolling_back" CanaryStatusCompleted CanaryStatus = "completed" CanaryStatusFailed CanaryStatus = "failed" )
type DeploymentOrchestrator ¶
type DeploymentOrchestrator struct {
// contains filtered or unexported fields
}
DeploymentOrchestrator manages deployment strategies
func NewDeploymentOrchestrator ¶
func NewDeploymentOrchestrator(vm *VersionManager, logger *slog.Logger) *DeploymentOrchestrator
NewDeploymentOrchestrator creates a new deployment orchestrator
func (*DeploymentOrchestrator) Deploy ¶
func (do *DeploymentOrchestrator) Deploy(ctx context.Context, spec *DeploymentSpec) error
Deploy deploys using the specified strategy
func (*DeploymentOrchestrator) GetAvailableStrategies ¶
func (do *DeploymentOrchestrator) GetAvailableStrategies() map[string]string
GetAvailableStrategies returns available deployment strategies
func (*DeploymentOrchestrator) GetStrategy ¶
func (do *DeploymentOrchestrator) GetStrategy(name string) (DeploymentStrategy, bool)
GetStrategy returns a specific deployment strategy
func (*DeploymentOrchestrator) RegisterStrategy ¶
func (do *DeploymentOrchestrator) RegisterStrategy(name string, strategy DeploymentStrategy)
RegisterStrategy registers a custom deployment strategy
func (*DeploymentOrchestrator) Rollback ¶
func (do *DeploymentOrchestrator) Rollback(ctx context.Context, spec *DeploymentSpec) error
Rollback rolls back using the specified strategy
type DeploymentSpec ¶
type DeploymentSpec struct {
PluginName string
OldVersion string
NewVersion string
Strategy string
Config map[string]interface{}
Timeout time.Duration
HealthCheckURL string
RollbackOnError bool
NotifyOnComplete bool
Metadata map[string]interface{}
}
DeploymentSpec contains deployment specification
type DeploymentStrategy ¶
type DeploymentStrategy interface {
Deploy(ctx context.Context, deployment *DeploymentSpec) error
Rollback(ctx context.Context, deployment *DeploymentSpec) error
GetName() string
GetDescription() string
Validate(spec *DeploymentSpec) error
}
DeploymentStrategy defines how plugin versions are deployed
type NotificationConfig ¶
type NotificationConfig struct {
EnableNotifications bool `json:"enable_notifications"`
WebhookURL string `json:"webhook_url"`
EmailRecipients []string `json:"email_recipients"`
SlackChannel string `json:"slack_channel"`
NotifyOnStart bool `json:"notify_on_start"`
NotifyOnComplete bool `json:"notify_on_complete"`
NotifyOnFailure bool `json:"notify_on_failure"`
}
NotificationConfig contains notification settings for canary deployments
type PluginVersion ¶
type PluginVersion struct {
Plugin plugin.Plugin
Version string
Status VersionStatus
LoadTime time.Time
LastAccessed time.Time
RequestCount int64
ErrorCount int64
HealthScore float64
Metadata map[string]interface{}
Dependencies []plugin.PluginDependency
Config map[string]interface{}
}
PluginVersion represents a specific version of a plugin
type PluginVersions ¶
type PluginVersions struct {
Name string
CurrentVersion string
Versions map[string]*PluginVersion
CanaryVersion string
CanaryPercent float64
VersionHistory []VersionHistoryEntry
// contains filtered or unexported fields
}
PluginVersions holds multiple versions of a plugin
type RollingDeploymentStrategy ¶
type RollingDeploymentStrategy struct {
// contains filtered or unexported fields
}
RollingDeploymentStrategy implements rolling deployment
func NewRollingDeploymentStrategy ¶
func NewRollingDeploymentStrategy(vm *VersionManager, logger *slog.Logger) *RollingDeploymentStrategy
NewRollingDeploymentStrategy creates a new rolling deployment strategy
func (*RollingDeploymentStrategy) Deploy ¶
func (rd *RollingDeploymentStrategy) Deploy(ctx context.Context, spec *DeploymentSpec) error
Deploy performs rolling deployment
func (*RollingDeploymentStrategy) GetDescription ¶
func (rd *RollingDeploymentStrategy) GetDescription() string
GetDescription returns the strategy description
func (*RollingDeploymentStrategy) GetName ¶
func (rd *RollingDeploymentStrategy) GetName() string
GetName returns the strategy name
func (*RollingDeploymentStrategy) Rollback ¶
func (rd *RollingDeploymentStrategy) Rollback(ctx context.Context, spec *DeploymentSpec) error
Rollback performs rolling rollback
func (*RollingDeploymentStrategy) Validate ¶
func (rd *RollingDeploymentStrategy) Validate(spec *DeploymentSpec) error
Validate validates the deployment specification
type VersionConfig ¶
type VersionConfig struct {
MaxVersionsPerPlugin int `json:"max_versions_per_plugin"`
DefaultCanaryConfig *CanaryConfig `json:"default_canary_config"`
AutoCleanupOldVersions bool `json:"auto_cleanup_old_versions"`
CleanupThreshold time.Duration `json:"cleanup_threshold"`
HealthCheckInterval time.Duration `json:"health_check_interval"`
MetricsRetentionPeriod time.Duration `json:"metrics_retention_period"`
EnableVersionHistory bool `json:"enable_version_history"`
HistoryRetentionPeriod time.Duration `json:"history_retention_period"`
}
VersionConfig contains version management configuration
func DefaultVersionConfig ¶
func DefaultVersionConfig() *VersionConfig
DefaultVersionConfig returns default version management configuration
type VersionHistoryEntry ¶
type VersionHistoryEntry struct {
Version string
Action string
Timestamp time.Time
Success bool
ErrorMessage string
CanaryPercent float64
Duration time.Duration
}
VersionHistoryEntry tracks version deployment history
type VersionManager ¶
type VersionManager struct {
// contains filtered or unexported fields
}
VersionManager manages multiple versions of plugins with canary deployments
func NewVersionManager ¶
func NewVersionManager( auditLogger security.SecurityAuditLogger, config *VersionConfig, logger *slog.Logger, ) *VersionManager
NewVersionManager creates a new version manager
func (*VersionManager) GetPluginVersion ¶
func (vm *VersionManager) GetPluginVersion(pluginName string, forCanary bool) (*PluginVersion, error)
GetPluginVersion returns the appropriate version for a request
func (*VersionManager) GetVersionStatus ¶
func (vm *VersionManager) GetVersionStatus(pluginName string) (map[string]interface{}, error)
GetVersionStatus returns the version status for a plugin
func (*VersionManager) PromoteCanary ¶
func (vm *VersionManager) PromoteCanary(pluginName string) error
PromoteCanary promotes a canary deployment to production
func (*VersionManager) RecordCanaryMetrics ¶
func (vm *VersionManager) RecordCanaryMetrics(pluginName string, success bool, responseTime time.Duration)
RecordCanaryMetrics records metrics for a canary deployment
func (*VersionManager) RegisterPluginVersion ¶
func (vm *VersionManager) RegisterPluginVersion( pluginName string, version string, pluginInstance plugin.Plugin, config map[string]interface{}, ) error
RegisterPluginVersion registers a new plugin version
func (*VersionManager) RollbackCanary ¶
func (vm *VersionManager) RollbackCanary(pluginName string, reason string) error
RollbackCanary rolls back a canary deployment
func (*VersionManager) ShouldUseCanary ¶
func (vm *VersionManager) ShouldUseCanary(pluginName string, requestID string) bool
ShouldUseCanary determines if a request should use the canary version
func (*VersionManager) Start ¶
func (vm *VersionManager) Start(ctx context.Context) error
Start starts the version manager
func (*VersionManager) StartCanaryDeployment ¶
func (vm *VersionManager) StartCanaryDeployment( pluginName string, newVersion string, canaryConfig *CanaryConfig, ) error
StartCanaryDeployment starts a canary deployment for a plugin
type VersionStatus ¶
type VersionStatus string
VersionStatus represents the status of a plugin version
const ( VersionStatusLoading VersionStatus = "loading" VersionStatusActive VersionStatus = "active" VersionStatusCanary VersionStatus = "canary" VersionStatusDeprecated VersionStatus = "deprecated" VersionStatusFailed VersionStatus = "failed" VersionStatusRetired VersionStatus = "retired" )