updater

package
v1.67.2 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManualApprovalRequired     = "manualApproval"
	DisruptionApprovalRequired = "disruptionApproval"
	RequirementsNotMet         = "requirementsNotMet"
	ReleaseQueueDepth          = "releaseQueueDepth"
	NotificationNotSent        = "notificationNotSent"
)
View Source
const (
	PhasePending    = "Pending"
	PhaseDeployed   = "Deployed"
	PhaseSuperseded = "Superseded"
	PhaseSuspended  = "Suspended"
	PhaseSkipped    = "Skipped"
)
View Source
const (
	SubjectDeckhouse = "Deckhouse"
	SubjectModule    = "Module"
)

Variables

View Source
var ErrDeployConditionsNotMet = NewNotReadyForDeployError("deploy conditions not met", 0)

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 DeckhouseReleaseData

type DeckhouseReleaseData struct {
	IsUpdating bool
	Notified   bool
}

type KubeAPI

type KubeAPI[R v1alpha1.Release] interface {
	UpdateReleaseStatus(ctx context.Context, release R, msg, phase string) error
	PatchReleaseAnnotations(ctx context.Context, release R, annotations map[string]interface{}) error
	PatchReleaseApplyAfter(release R, applyTime time.Time) error
	SaveReleaseData(ctx context.Context, release R, data DeckhouseReleaseData) error
	DeployRelease(ctx context.Context, release R) error
	IsKubernetesVersionAutomatic(ctx context.Context) (bool, error)
}

type MetricLabels added in v1.67.0

type MetricLabels map[string]string

func NewReleaseMetricLabels added in v1.67.0

func NewReleaseMetricLabels(release v1alpha1.Release) MetricLabels

type MetricsUpdater

type MetricsUpdater[R v1alpha1.Release] interface {
	UpdateReleaseMetric(string, MetricLabels)
	PurgeReleaseMetric(string)
}

type NotReadyForDeployError added in v1.65.0

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

func NewNotReadyForDeployError added in v1.65.0

func NewNotReadyForDeployError(message string, retryDelay time.Duration) *NotReadyForDeployError

func (*NotReadyForDeployError) Error added in v1.65.0

func (n *NotReadyForDeployError) Error() string

func (*NotReadyForDeployError) RetryDelay added in v1.65.0

func (n *NotReadyForDeployError) RetryDelay() time.Duration

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"`
}

type ReleaseType added in v1.64.0

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

type Settings

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

type UpdateMode added in v1.65.0

type UpdateMode string
const (
	// ModeAutoPatch is default mode for updater,
	// deckhouse automatically applies patch releases, but asks for approval of minor releases
	ModeAutoPatch UpdateMode = "AutoPatch"
	// ModeAuto is updater mode when deckhouse automatically applies all releases
	ModeAuto UpdateMode = "Auto"
	// ModeManual is updater mode when deckhouse downloads releases info, but does not apply them
	ModeManual UpdateMode = "Manual"
)

func ParseUpdateMode added in v1.65.0

func ParseUpdateMode(name string) UpdateMode

ParseUpdateMode attempts to convert a string to a UpdateMode.

AutoPatch used by default

func (UpdateMode) IsValid added in v1.65.0

func (x UpdateMode) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (UpdateMode) String added in v1.65.0

func (x UpdateMode) String() string

String implements the Stringer interface.

type Updater

type Updater[R v1alpha1.Release] struct {
	// contains filtered or unexported fields
}

func NewUpdater

func NewUpdater[R v1alpha1.Release](
	ctx context.Context,
	dc dependency.Container,
	logger *log.Logger,
	settings *Settings,
	data DeckhouseReleaseData,
	podIsReady, isBootstrapping bool,
	kubeAPI KubeAPI[R],
	metricsUpdater MetricsUpdater[R],
	webhookDataSource WebhookDataSource[R],
	enabledModules []string,
) *Updater[R]

func (*Updater[R]) ApplyForcedRelease

func (u *Updater[R]) ApplyForcedRelease(ctx context.Context) error

ApplyForcedRelease deploys forced release without any checks (windows, requirements, approvals and so on)

func (*Updater[R]) ApplyPredictedRelease

func (u *Updater[R]) ApplyPredictedRelease() (err error)

ApplyPredictedRelease applies predicted release, checks everything:

  • Deckhouse is ready (except patch)
  • Canary settings
  • Manual approving
  • Release requirements

In addition to the regular error, ErrDeployConditionsNotMet or NotReadyForDeployError is returned as appropriate.

func (*Updater[R]) ChangeUpdatingFlag

func (u *Updater[R]) ChangeUpdatingFlag(fl bool) error

func (*Updater[R]) CommitSkippedReleases added in v1.67.0

func (u *Updater[R]) CommitSkippedReleases() error

func (*Updater[R]) DeployedRelease added in v1.65.0

func (u *Updater[R]) DeployedRelease() *R

func (*Updater[R]) GetCurrentDeployedReleaseIndex

func (u *Updater[R]) GetCurrentDeployedReleaseIndex() int

func (*Updater[R]) GetPredictedRelease added in v1.63.0

func (u *Updater[R]) GetPredictedRelease() R

func (*Updater[R]) GetPredictedReleaseIndex

func (u *Updater[R]) GetPredictedReleaseIndex() int

func (*Updater[R]) GetSkippedPatchReleases added in v1.63.0

func (u *Updater[R]) GetSkippedPatchReleases() []R

func (*Updater[R]) GetSkippedPatchesIndexes

func (u *Updater[R]) GetSkippedPatchesIndexes() []int

func (*Updater[R]) HasForceRelease

func (u *Updater[R]) HasForceRelease() bool

HasForceRelease check the existence of the forced release

func (*Updater[R]) InManualMode

func (u *Updater[R]) InManualMode() bool

func (*Updater[R]) LastReleaseDeployed

func (u *Updater[R]) LastReleaseDeployed() bool

LastReleaseDeployed returns the equality of the latest existed release with the latest deployed

func (*Updater[R]) PredictNextRelease

func (u *Updater[R]) PredictNextRelease(release R)

PredictNextRelease runs prediction of the next release to deploy. It skips patch releases and saves only the latest one. Also, the metrics of the referenced release are updated.

func (*Updater[R]) PredictedReleaseIsPatch

func (u *Updater[R]) PredictedReleaseIsPatch() bool

PredictedReleaseIsPatch shows if the predicted release is a patch with respect to the Deployed one

func (*Updater[R]) ReleasesCount

func (u *Updater[R]) ReleasesCount() int

func (*Updater[R]) SetReleases added in v1.63.0

func (u *Updater[R]) SetReleases(releases []R)

SetReleases set and sort releases for updater

type WebhookData added in v1.64.0

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

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

type WebhookDataSource added in v1.64.0

type WebhookDataSource[R v1alpha1.Release] interface {
	Fill(output *WebhookData, release R, applyTime time.Time)
}

Jump to

Keyboard shortcuts

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