updater

package
v1.60.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 17 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 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"`
}

func ParseNotificationConfigFromValues

func ParseNotificationConfigFromValues(input *go_hook.HookInput) (*NotificationConfig, error)

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]) *Updater[R]

func (*Updater[R]) ApplyForcedRelease

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

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]) GetPredictedReleaseIndex

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

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]) PrepareReleases

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

PrepareReleases fetches releases from snapshot and then:

  • patch releases with empty status (just created)
  • handle suspended releases (patch status and remove annotation)
  • patch manual releases (change status)

func (*Updater[R]) ReleasesCount

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

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