release

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReleaseVersionV1 = "v1"
	ReleaseVersionV2 = "v2"
)

Variables

View Source
var (
	ErrReleaseExists      = errors.New("release: already exists")
	ErrReleaseNotFound    = errors.New("release: not found")
	ErrReleaseUndecodable = errors.New("release: stored body cannot be decoded")
)

Functions

func NewRelease

func NewRelease(name, namespace string, revision int, deployType common.DeployType, resources []*spec.ResourceSpec, chrt chart.Accessor, releaseConfig map[string]interface{}, opts ReleaseOptions) (helmrel.Accessor, error)

Construct Helm release.

func ReleaseToResourceSpecs

func ReleaseToResourceSpecs(ctx context.Context, rel helmrel.Accessor, releaseNamespace string) ([]*spec.ResourceSpec, error)

Constructs ResourceSpecs from a Release object.

func ReleaserToV1Release

func ReleaserToV1Release(releaser helmrel.Releaser) (*helmrelease.Release, error)

func ReleaserVersion

func ReleaserVersion(releaser helmrel.Releaser) string

Types

type Historier

type Historier interface {
	CreateRelease(ctx context.Context, rel helmrel.Accessor) error
	UpdateRelease(ctx context.Context, rel helmrel.Accessor) error
	DeleteRelease(ctx context.Context, name string, revision int) error
}

type History

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

func BuildHistory

func BuildHistory(ctx context.Context, releaseName string, historyStorage ReleaseStorager) (*History, error)

func (*History) CreateRelease

func (h *History) CreateRelease(ctx context.Context, rel helmrel.Accessor) error

func (*History) DeleteRelease

func (h *History) DeleteRelease(ctx context.Context, name string, revision int) error

func (*History) Release

func (h *History) Release(ctx context.Context, version int) (helmrel.Accessor, error)

func (*History) Revisions

func (h *History) Revisions() []Revision

func (*History) UpdateRelease

func (h *History) UpdateRelease(ctx context.Context, rel helmrel.Accessor) error

type IsReleaseUpToDateResult

type IsReleaseUpToDateResult struct {
	Reason   ReleaseOutdatedReason
	UpToDate bool
}

func IsReleaseUpToDate

func IsReleaseUpToDate(oldRel, newRel helmrel.Accessor) (IsReleaseUpToDateResult, error)

Check if the new Release is up-to-date compared to the old Release. It doesn't check any resources of the release in the cluster, just compares Release objects.

type LatestRevisionsOptions

type LatestRevisionsOptions struct {
	// LabelSelector is applied before choosing the latest revision.
	LabelSelector string
	// SkipAnnotations omits annotations from returned revisions.
	SkipAnnotations bool
}

type ListLatestSummariesOptions

type ListLatestSummariesOptions struct {
	// LabelSelector is applied before choosing the latest revision.
	LabelSelector string
}

type ListRevisionSummariesOptions

type ListRevisionSummariesOptions struct {
	// Limit reads only the newest revisions; 0 means all.
	Limit int
}

type ReleaseOptions

type ReleaseOptions struct {
	InfoAnnotations map[string]string
	Labels          map[string]string
	Notes           string
}

type ReleaseOutdatedReason

type ReleaseOutdatedReason string
const (
	ReleaseOutdatedReasonNone                     ReleaseOutdatedReason = ""
	ReleaseOutdatedReasonNoPreviousRelease        ReleaseOutdatedReason = "there is no previously deployed release"
	ReleaseOutdatedReasonReleaseStatusNotDeployed ReleaseOutdatedReason = "the previously deployed release was not successful"
	ReleaseOutdatedReasonNotesChanged             ReleaseOutdatedReason = "the release notes changed"
	ReleaseOutdatedReasonValuesChanged            ReleaseOutdatedReason = "the release values changed"
	ReleaseOutdatedReasonHooksChanged             ReleaseOutdatedReason = "the release hooks changed"
	ReleaseOutdatedReasonManifestsChanged         ReleaseOutdatedReason = "the release manifests changed"
)

type ReleaseStorageOptions

type ReleaseStorageOptions struct {
	HistoryLimit  int
	SQLConnection string
}

type ReleaseStorager

type ReleaseStorager interface {
	Create(ctx context.Context, rel helmrel.Accessor) error
	Update(ctx context.Context, rel helmrel.Accessor) error
	UpdateLabels(ctx context.Context, name string, version int, labels map[string]string) error
	Delete(ctx context.Context, name string, version int) error
	// GetRelease returns the decoded revision; version 0 means the latest one.
	GetRelease(ctx context.Context, name string, version int) (helmrel.Accessor, error)
	LoadRevision(ctx context.Context, revision Revision) (helmrel.Accessor, error)
	// LoadRevisionSummary fails with ErrReleaseUndecodable on an undecodable body.
	LoadRevisionSummary(ctx context.Context, revision Revision) (*ReleaseSummary, error)
	// Revisions reads no bodies; sorted by version.
	Revisions(ctx context.Context, name string) ([]Revision, error)
	// LatestRevisions reads no bodies; sorted by namespace and name.
	LatestRevisions(ctx context.Context, opts LatestRevisionsOptions) ([]Revision, error)
	// ListLatestSummaries streams bodies and keeps only summaries; sorted by namespace and name.
	ListLatestSummaries(ctx context.Context, opts ListLatestSummariesOptions) ([]RevisionSummary, error)
	// ListRevisionSummaries streams bodies and keeps only summaries; sorted by version.
	ListRevisionSummaries(ctx context.Context, name string, opts ListRevisionSummariesOptions) ([]RevisionSummary, error)
}

ReleaseStorager stores releases in the Helm format. Methods taking a release name require a namespace. Objects with an unparseable version label are skipped on reads but fail Revisions.

func NewReleaseStorage

func NewReleaseStorage(ctx context.Context, namespace, storageDriver string, clientFactory kube.ClientFactorier, opts ReleaseStorageOptions) (ReleaseStorager, error)

type ReleaseSummary

type ReleaseSummary struct {
	Annotations map[string]string
	// Chart is nil without chart metadata.
	Chart      *ReleaseSummaryChart
	DeployedAt time.Time
}

ReleaseSummary is the part of a release body that listings show.

type ReleaseSummaryChart

type ReleaseSummaryChart struct {
	AppVersion string `json:"appVersion"`
	Name       string `json:"name"`
	Version    string `json:"version"`
}

type Revision

type Revision struct {
	// Annotations is nil when they must be read from the body.
	Annotations map[string]string `json:"annotations,omitempty"`
	Name        string            `json:"name"`
	Namespace   string            `json:"namespace"`
	Status      string            `json:"status"`
	Version     int               `json:"version"`
}

func DeployedRevisions

func DeployedRevisions(revisions []Revision) []Revision

DeployedRevisions expects revisions sorted by ascending Version.

func NewRevisionFromAccessor

func NewRevisionFromAccessor(rel helmrel.Accessor) Revision

type RevisionSummary

type RevisionSummary struct {
	DecodeErr error
	Revision  Revision
	Summary   *ReleaseSummary
}

RevisionSummary has either Summary or DecodeErr wrapping ErrReleaseUndecodable.

type VersionedRelease

type VersionedRelease struct {
	Accessor helmrel.Accessor
}

func (*VersionedRelease) MarshalJSON

func (r *VersionedRelease) MarshalJSON() ([]byte, error)

func (*VersionedRelease) UnmarshalJSON

func (r *VersionedRelease) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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