Documentation
¶
Index ¶
- Constants
- Variables
- type Auth
- type BasicAuth
- type ByVersion
- type Check
- type Checker
- func NewDeckhouseReleaseRequirementsChecker(k8sclient client.Client, enabledModules []string, ...) (*Checker[v1alpha1.DeckhouseRelease], error)
- func NewModuleReleaseRequirementsChecker(exts *extenders.ExtendersStack, options ...CheckerOption) (*Checker[v1alpha1.ModuleRelease], error)
- func NewPreApplyChecker(settings *Settings, logger *log.Logger) *Checker[v1alpha1.Release]
- type CheckerConfig
- type CheckerOption
- type DeployDelayReason
- type DeployTimeResult
- type DeployTimeService
- func (c *DeployTimeService) CalculateMinorDeployTime(release v1alpha1.Release, metricLabels MetricLabels) *DeployTimeResult
- func (c *DeployTimeService) CalculatePatchDeployTime(release v1alpha1.Release, metricLabels MetricLabels) *DeployTimeResult
- func (c *DeployTimeService) ProcessMinorReleaseDeployTime(release v1alpha1.Release, res *DeployTimeResult) *ProcessedDeployTimeResult
- func (c *DeployTimeService) ProcessPatchReleaseDeployTime(release v1alpha1.Release, res *DeployTimeResult) *ProcessedDeployTimeResult
- type MetricLabels
- type MetricsUpdater
- type NotMetReason
- type NotificationConfig
- type ProcessedDeployTimeResult
- type ReleaseInfo
- type ReleaseNotifier
- type ReleaseQueueDepthDelta
- type ReleaseType
- type RequirementsChecker
- type Settings
- type StatusPatch
- type Task
- type TaskCalculator
- type TaskType
- type WebhookData
Constants ¶
const ( ManualApprovalRequired = "manualApproval" DisruptionApprovalRequired = "disruptionApproval" RequirementsNotMet = "requirementsNotMet" ReleaseQueueDepth = "releaseQueueDepth" NotificationNotSent = "notificationNotSent" )
const ( SubjectDeckhouse = "Deckhouse" SubjectModule = "Module" )
const D8ReleaseBlockedMetricName = "d8_release_info"
const (
MigratedModulesRequirementFieldName = "migratedModules"
)
const ModuleReleaseBlockedMetricName = "d8_module_release_info"
Variables ¶
var ErrReleaseIsAlreadyDeployed = errors.New("release is already deployed")
var ErrReleasePhaseIsNotPending = errors.New("release phase is not pending")
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Checker ¶
type Checker[T any] struct { // contains filtered or unexported fields }
func NewDeckhouseReleaseRequirementsChecker ¶
func NewDeckhouseReleaseRequirementsChecker(k8sclient client.Client, enabledModules []string, exts *extenders.ExtendersStack, metricStorage metric.Storage, options ...CheckerOption) (*Checker[v1alpha1.DeckhouseRelease], error)
NewDeckhouseReleaseRequirementsChecker returns DeckhouseRelease checker with this checks:
1) deckhouse version check 2) deckhouse requirements check 3) deckhouse kubernetes version check 4) migrated modules check
for more checks information - look at extenders
func NewModuleReleaseRequirementsChecker ¶
func NewModuleReleaseRequirementsChecker(exts *extenders.ExtendersStack, options ...CheckerOption) (*Checker[v1alpha1.ModuleRelease], error)
NewModuleReleaseRequirementsChecker returns ModuleRelease checker with this checks:
1) module release requirements check
for more checks information - look at extenders
func NewPreApplyChecker ¶
NewPreApplyChecker returns Release checker with this checks:
1) disruption check
func (*Checker[T]) MetRequirements ¶
func (c *Checker[T]) MetRequirements(ctx context.Context, v *T) []NotMetReason
type CheckerConfig ¶ added in v1.72.0
type CheckerConfig struct {
// contains filtered or unexported fields
}
CheckerConfig holds configuration for a Checker
type CheckerOption ¶ added in v1.72.0
type CheckerOption func(*CheckerConfig)
CheckerOption represents an option for configuring a Checker
func WithLogger ¶ added in v1.72.0
func WithLogger(logger *log.Logger) CheckerOption
WithLogger sets the logger for the checker
type DeployDelayReason ¶
type DeployDelayReason byte
func (DeployDelayReason) GoString ¶
func (r DeployDelayReason) GoString() string
func (DeployDelayReason) IsNoDelay ¶
func (r DeployDelayReason) IsNoDelay() bool
func (DeployDelayReason) String ¶
func (r DeployDelayReason) String() string
type DeployTimeResult ¶
type DeployTimeResult struct {
ReleaseApplyTime time.Time
ReleaseApplyAfterTime time.Time
Reason DeployDelayReason
}
type DeployTimeService ¶
type DeployTimeService struct {
// contains filtered or unexported fields
}
func NewDeployTimeService ¶
func NewDeployTimeService(dc dependency.Container, settings *Settings, logger *log.Logger) *DeployTimeService
func (*DeployTimeService) CalculateMinorDeployTime ¶
func (c *DeployTimeService) CalculateMinorDeployTime(release v1alpha1.Release, metricLabels MetricLabels) *DeployTimeResult
CalculatePatchDeployTime calculates deploy time, returns deploy time or postpone time and reason. To calculate deploy time, we need to check:
1) Cooldown (TODO: deprecated?) 1) Canary (in any mode, except "Manual") 2) Notify 3) Window (only in "Auto" mode) 4) Manual approve (in any mode, except "Auto")
Notify reason must override any other reason
func (*DeployTimeService) CalculatePatchDeployTime ¶
func (c *DeployTimeService) CalculatePatchDeployTime(release v1alpha1.Release, metricLabels MetricLabels) *DeployTimeResult
CalculatePatchDeployTime calculates deploy time, returns deploy time or postpone time and reason. To calculate deploy time, we need to check:
1) Canary 2) Notify 3) Window (in not "Manual" mode) 4) Manual approve (only in "Manual" mode)
Notify reason must override any other reason
func (*DeployTimeService) ProcessMinorReleaseDeployTime ¶
func (c *DeployTimeService) ProcessMinorReleaseDeployTime(release v1alpha1.Release, res *DeployTimeResult) *ProcessedDeployTimeResult
ProcessMinorReleaseDeployTime for minor release we check: - Deckhouse pod is ready - No delay from calculated deploy time
func (*DeployTimeService) ProcessPatchReleaseDeployTime ¶
func (c *DeployTimeService) ProcessPatchReleaseDeployTime(release v1alpha1.Release, res *DeployTimeResult) *ProcessedDeployTimeResult
ProcessPatchReleaseDeployTime for patch release we check: - No delay from calculated deploy time
type MetricLabels ¶
func NewReleaseMetricLabels ¶
func NewReleaseMetricLabels(release v1alpha1.Release) MetricLabels
func (MetricLabels) SetFalse ¶
func (ml MetricLabels) SetFalse(key string)
func (MetricLabels) SetTrue ¶
func (ml MetricLabels) SetTrue(key string)
type MetricsUpdater ¶
type MetricsUpdater struct {
// contains filtered or unexported fields
}
func NewMetricsUpdater ¶
func NewMetricsUpdater(metricStorage metric.Storage, metricName string) *MetricsUpdater
func (*MetricsUpdater) PurgeReleaseMetric ¶
func (mu *MetricsUpdater) PurgeReleaseMetric(name string)
func (*MetricsUpdater) UpdateReleaseMetric ¶
func (mu *MetricsUpdater) UpdateReleaseMetric(name string, metricLabels MetricLabels)
type NotMetReason ¶
type NotificationConfig ¶
type NotificationConfig struct {
WebhookURL string `json:"webhook"`
SkipTLSVerify bool `json:"tlsSkipVerify"`
MinimalNotificationTime libapi.Duration `json:"minimalNotificationTime"`
Auth *Auth `json:"auth,omitempty"`
ReleaseType ReleaseType `json:"releaseType"`
}
func (*NotificationConfig) IsEmpty ¶
func (cfg *NotificationConfig) IsEmpty() bool
type ProcessedDeployTimeResult ¶
type ProcessedDeployTimeResult struct {
Reason DeployDelayReason
Message string
ReleaseApplyAfterTime time.Time
}
type ReleaseInfo ¶
type ReleaseNotifier ¶
type ReleaseNotifier struct {
// contains filtered or unexported fields
}
func NewReleaseNotifier ¶
func NewReleaseNotifier(settings *Settings) *ReleaseNotifier
func (*ReleaseNotifier) SendMinorReleaseNotification ¶
func (u *ReleaseNotifier) SendMinorReleaseNotification(ctx context.Context, release v1alpha1.Release, applyTime time.Time, metricLabels MetricLabels) error
func (*ReleaseNotifier) SendPatchReleaseNotification ¶
func (u *ReleaseNotifier) SendPatchReleaseNotification(ctx context.Context, release v1alpha1.Release, applyTime time.Time, metricLabels MetricLabels) error
SendPatchReleaseNotification sending patch notification (only if notification config has release type "All")
type ReleaseQueueDepthDelta ¶ added in v1.72.0
type ReleaseQueueDepthDelta struct {
Major int // Major versions delta, not used right now, for future usage
Minor int // Minor versions delta
Patch int // Patch versions delta
}
ReleaseQueueDepthDelta represents the difference between deployed and latest releases
func (*ReleaseQueueDepthDelta) GetReleaseQueueDepth ¶ added in v1.72.0
func (d *ReleaseQueueDepthDelta) GetReleaseQueueDepth() int
GetReleaseQueueDepth calculates the effective queue depth for monitoring and alerting purposes. This method transforms the internal delta representation into a simplified metric value that represents how many releases are pending deployment.
Queue depth calculation logic:
- If minor version differences exist: return the minor delta count
- If only patch version differences exist: return 1 (normalized patch indicator)
- If no differences exist: return 0 (up to date)
The function prioritizes minor version gaps over patch version gaps because:
- Minor version updates typically contain more significant changes
- Multiple patch versions are normalized to a single indicator (1)
- This provides a cleaner metric for alerting thresholds
Examples:
- Delta{Major: 0, Minor: 3, Patch: 0} → Returns: 3 (3 minor versions behind)
- Delta{Major: 0, Minor: 0, Patch: 5} → Returns: 1 (patch updates available, normalized)
- Delta{Major: 1, Minor: 2, Patch: 0} → Returns: 2 (focuses on minor gap, major handled separately)
- Delta{Major: 0, Minor: 0, Patch: 0} → Returns: 0 (up to date)
Note: Major version deltas are intentionally excluded from this calculation. A separate alerting mechanism is planned for major version updates due to their potentially breaking nature and different handling requirements.
type ReleaseType ¶
type ReleaseType string
const ( ReleaseTypeMinor ReleaseType = "Minor" ReleaseTypeAll ReleaseType = "All" )
type RequirementsChecker ¶
type RequirementsChecker[T any] interface { MetRequirements(ctx context.Context, v *T) []NotMetReason }
type Settings ¶
type Settings struct {
NotificationConfig NotificationConfig
DisruptionApprovalMode string
Mode v1alpha2.UpdateMode
Windows update.Windows
Subject string
}
func (*Settings) InDisruptionApprovalMode ¶
func (*Settings) InManualMode ¶
type StatusPatch ¶
type StatusPatch v1alpha1.DeckhouseReleaseStatus
TODO: replace patch marshalling with controller-runtime patch
func (StatusPatch) MarshalJSON ¶
func (sp StatusPatch) MarshalJSON() ([]byte, error)
type Task ¶
type Task struct {
TaskType TaskType
Message string
IsPatch bool
IsSingle bool
IsLatest bool
DeployedReleaseInfo *ReleaseInfo
QueueDepth *ReleaseQueueDepthDelta
}
type TaskCalculator ¶
type TaskCalculator struct {
// contains filtered or unexported fields
}
func NewModuleReleaseTaskCalculator ¶
func NewModuleReleaseTaskCalculator(k8sclient client.Client, logger *log.Logger) *TaskCalculator
func (*TaskCalculator) CalculatePendingReleaseTask ¶
func (p *TaskCalculator) CalculatePendingReleaseTask(ctx context.Context, release v1alpha1.Release) (*Task, error)
CalculatePendingReleaseTask determines the appropriate action for a pending release within the context of all available releases. This is the main orchestration function that evaluates release precedence, version constraints, and deployment readiness to produce a task decision.
Decision Flow Architecture:
- Validation: Ensure release is in pending state
- Force Release Check: Handle administratively forced releases
- Deployed Release Analysis: Consider currently deployed version
- Constraint Evaluation: Check for version jumping opportunities
- Sequential Logic: Apply standard version progression rules
- Neighbor Analysis: Determine if release should process or wait
Task Types Returned:
- Skip: Release should be bypassed (superseded by force/deployed/newer release)
- Await: Release must wait for dependencies (previous releases, constraints)
- Process: Release is ready for deployment
Key Features:
- Version Jumping: Supports constraint-based skipping of intermediate releases
- Channel-aware Logic: Different rules for LTS vs regular channels
- Major Version Control: Special handling for 0→1 transitions vs breaking changes
- Queue Depth Calculation: Provides metrics for monitoring and alerting
- Force Release Priority: Administrative overrides take precedence
Version Progression Rules:
- FORCE RELEASE: Always takes precedence, skips any lower versions
- DEPLOYED VERSION: Cannot deploy older than currently deployed
- MAJOR VERSION RESTRICTIONS: - 0→1: Allowed (development to stable transition) - 1→2+: Blocked (requires manual intervention)
- MINOR VERSION LIMITS: - Regular channels: Sequential (+1 minor at a time) - LTS channels: Up to +10 minor versions allowed
- PATCH VERSIONS: No restrictions, highest patch wins
Constraint-Based Version Jumping:
When update constraints are present, releases can jump to specified endpoints:
- Deployed: 1.67.5, Constraint: {from: "1.67", to: "1.70"}
- Result: Direct jump to 1.70.x (highest patch), skipping 1.68.x, 1.69.x
- Endpoint releases are processed as minor updates (not patches)
Examples:
Scenario 1 - Force Release Override:
Input: Pending v1.68.0, Force v1.70.0 exists
Result: Skip (v1.68.0 < v1.70.0)
Scenario 2 - Sequential Minor Update:
Input: Pending v1.68.0, Deployed v1.67.5, No constraints
Result: Process (valid +1 minor progression)
Scenario 3 - Major Version Block:
Input: Pending v2.0.0, Deployed v1.67.5
Result: Await (major version jump requires manual approval)
Scenario 4 - Constraint Jumping:
Input: Pending v1.70.0, Deployed v1.67.5, Constraint: {from: "1.67", to: "1.70"}
Result: Process (constraint allows jumping to v1.70.0)
Scenario 5 - Patch Priority:
Input: Pending v1.67.3, Next v1.67.5 exists
Result: Skip (higher patch available)
Queue Depth Calculation:
- Counts releases between current and latest (max 3 for alerting)
- Used for monitoring release lag and alert thresholds
- Includes current release in count (off-by-one correction)
Channel-Specific Behavior:
- Regular Channels: Strict +1 minor version progression
- LTS Channels: Allow up to +10 minor version jumps for stability
- All Channels: No restrictions on patch version progression