updater

package
v1.63.6 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PhasePending    = "Pending"
	PhaseDeployed   = "Deployed"
	PhaseSuperseded = "Superseded"
	PhaseSuspended  = "Suspended"
	PhaseSkipped    = "Skipped"
)

Variables

This section is empty.

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 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 DeckhouseUpdateSettings added in v1.63.0

type DeckhouseUpdateSettings struct {
	NotificationConfig     *NotificationConfig
	DisruptionApprovalMode string
	Mode                   string
	ClusterUUID            string
}

type KubeAPI

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

type MetricsUpdater

type MetricsUpdater interface {
	ReleaseBlocked(name, reason string)
	WaitingManual(name string, totalPendingManualReleases float64)
}

type NotificationConfig

type NotificationConfig struct {
	WebhookURL              string          `json:"webhook"`
	SkipTLSVerify           bool            `json:"tlsSkipVerify"`
	MinimalNotificationTime libapi.Duration `json:"minimalNotificationTime"`
	Auth                    *Auth           `json:"auth,omitempty"`
}

type Release

type Release interface {
	GetName() string
	GetApplyAfter() *time.Time
	GetVersion() *semver.Version
	GetRequirements() map[string]string
	GetChangelogLink() string
	GetCooldownUntil() *time.Time
	GetDisruptions() []string
	GetDisruptionApproved() bool
	GetPhase() string
	GetForce() bool
	GetApplyNow() bool
	GetApprovedStatus() bool
	SetApprovedStatus(b bool)
	GetSuspend() bool
	GetManuallyApproved() bool
	GetMessage() string
}

type Settings

type Settings interface {
	GetDisruptionApprovalMode() (string, bool)
}

type Updater

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

func NewUpdater

func NewUpdater[R Release](logger logger.Logger, notificationConfig *NotificationConfig, mode string,
	data DeckhouseReleaseData, podIsReady, isBootstrapping bool, kubeAPI KubeAPI[R], metricsUpdater MetricsUpdater,
	settings Settings, webhookDataGetter WebhookDataGetter[R], enabledModules []string) *Updater[R]

func (*Updater[R]) ApplyForcedRelease

func (du *Updater[R]) ApplyForcedRelease() bool

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

func (*Updater[R]) ApplyPredictedRelease

func (du *Updater[R]) ApplyPredictedRelease(updateWindows update.Windows) bool

ApplyPredictedRelease applies predicted release, checks everything:

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

func (*Updater[R]) ChangeUpdatingFlag

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

func (*Updater[R]) GetCurrentDeployedReleaseIndex

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

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

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

func (*Updater[R]) GetPredictedReleaseIndex

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

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

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

func (*Updater[R]) GetSkippedPatchesIndexes

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

func (*Updater[R]) HasForceRelease

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

HasForceRelease check the existence of the forced release

func (*Updater[R]) InManualMode

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

func (*Updater[R]) LastReleaseDeployed

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

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

func (*Updater[R]) PredictNextRelease

func (du *Updater[R]) PredictNextRelease()

PredictNextRelease runs prediction of the next release to deploy. it skips patch releases and save only the latest one

func (*Updater[R]) PredictedReleaseIsPatch

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

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

func (*Updater[R]) ReleasesCount

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

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

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

SetReleases set and sort releases for updater

type WebhookDataGetter

type WebhookDataGetter[R Release] interface {
	GetMessage(release R, time time.Time) string
}

Jump to

Keyboard shortcuts

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