releaseupdater

package
v1.68.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManualApprovalRequired     = "manualApproval"
	DisruptionApprovalRequired = "disruptionApproval"
	RequirementsNotMet         = "requirementsNotMet"
	ReleaseQueueDepth          = "releaseQueueDepth"
	NotificationNotSent        = "notificationNotSent"
)
View Source
const (
	SubjectDeckhouse = "Deckhouse"
	SubjectModule    = "Module"
)
View Source
const D8ReleaseBlockedMetricName = "d8_release_info"
View Source
const ModuleReleaseBlockedMetricName = "d8_module_release_info"

Variables

View Source
var ErrReleaseIsAlreadyDeployed = errors.New("release is already deployed")
View Source
var ErrReleasePhaseIsNotPending = errors.New("release phase is not pending")

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Basic *BasicAuth `json:"basic,omitempty"`
	Token *string    `json:"bearerToken,omitempty"`
}

func (*Auth) Fill

func (a *Auth) Fill(req *http.Request)

type BasicAuth

type BasicAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type ByVersion

type ByVersion[R v1alpha1.Release] []R

func (ByVersion[R]) Len

func (a ByVersion[R]) Len() int

func (ByVersion[R]) Less

func (a ByVersion[R]) Less(i, j int) bool

func (ByVersion[R]) Swap

func (a ByVersion[R]) Swap(i, j int)

type Check

type Check[T any] interface {
	GetName() string
	Verify(v *T) error
}

type Checker

type Checker[T any] struct {
	// contains filtered or unexported fields
}

func NewDeckhouseReleaseRequirementsChecker

func NewDeckhouseReleaseRequirementsChecker(k8sclient client.Client, enabledModules []string, logger *log.Logger) (*Checker[v1alpha1.DeckhouseRelease], error)

NewDeckhouseReleaseRequirementsChecker returns DeckhouseRelease checker with this checks:

1) deckhouse version check 2) deckhouse requirements check 3) deckhouse kubernetes version check

for more checks information - look at extenders

func NewModuleReleaseRequirementsChecker

func NewModuleReleaseRequirementsChecker(logger *log.Logger) (*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

func NewPreApplyChecker(settings *Settings, logger *log.Logger) *Checker[v1alpha1.Release]

NewPreApplyChecker returns Release checker with this checks:

1) disruption check

func (*Checker[T]) MetRequirements

func (c *Checker[T]) MetRequirements(v *T) []NotMetReason

type DeployDelayReason

type DeployDelayReason byte

func (DeployDelayReason) GoString

func (r DeployDelayReason) GoString() string

func (DeployDelayReason) IsNoDelay

func (r DeployDelayReason) IsNoDelay() bool

func (DeployDelayReason) Message

func (r DeployDelayReason) Message(release v1alpha1.Release, applyTime time.Time) string

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, deckhousePodReadyFunc func(ctx context.Context) bool, 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 (only in "AutoPatch" mode) 4) Manual approve (only in "Manual" mode)

Notify reason must override any other reason

func (*DeployTimeService) ProcessMinorReleaseDeployTime

func (c *DeployTimeService) ProcessMinorReleaseDeployTime(ctx context.Context, release v1alpha1.Release, res *DeployTimeResult, dri *ReleaseInfo) *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

type MetricLabels map[string]string

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 *metricstorage.MetricStorage, 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 NotMetReason struct {
	Reason  string
	Message string
}

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 ReleaseInfo struct {
	Name    string
	Version *semver.Version
}

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 ReleaseType

type ReleaseType string
const (
	ReleaseTypeMinor ReleaseType = "Minor"
	ReleaseTypeAll   ReleaseType = "All"
)

type RequirementsChecker

type RequirementsChecker[T any] interface {
	MetRequirements(v *T) []NotMetReason
}

type Settings

type Settings struct {
	NotificationConfig     NotificationConfig
	DisruptionApprovalMode string
	Mode                   v1alpha1.UpdateMode
	Windows                update.Windows
	Subject                string
}

func (*Settings) InDisruptionApprovalMode

func (s *Settings) InDisruptionApprovalMode() bool

func (*Settings) InManualMode

func (s *Settings) InManualMode() bool

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          int
}

type TaskCalculator

type TaskCalculator struct {
	// contains filtered or unexported fields
}

func NewDeckhouseReleaseTaskCalculator

func NewDeckhouseReleaseTaskCalculator(k8sclient client.Client, logger *log.Logger) *TaskCalculator

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 calculate task with information about current reconcile

calculating flow: 1) find forced release. if current release has a lower version - skip 2) find deployed release. if current release has a lower version - skip

type TaskType

type TaskType int
const (
	Skip TaskType = iota
	Await
	Process
)

type WebhookData

type WebhookData struct {
	Subject       string            `json:"subject"`
	Version       string            `json:"version"`
	Requirements  map[string]string `json:"requirements,omitempty"`
	ChangelogLink string            `json:"changelogLink,omitempty"`

	ApplyTime string `json:"applyTime,omitempty"`
	Message   string `json:"message"`
}

Jump to

Keyboard shortcuts

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