v2

package
v2.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package v2 provides release handling for apiVersion v3 charts.

Index

Constants

View Source
const HookAnnotation = "helm.sh/hook"

HookAnnotation is the label name for a hook

View Source
const HookDeleteAnnotation = "helm.sh/hook-delete-policy"

HookDeleteAnnotation is the label name for the delete policy for a hook

View Source
const HookOutputLogAnnotation = "helm.sh/hook-output-log-policy"

HookOutputLogAnnotation is the label name for the output log policy for a hook

View Source
const HookWeightAnnotation = "helm.sh/hook-weight"

HookWeightAnnotation is the label name for a hook weight

Variables

View Source
var MockHookTemplate = `apiVersion: v1
kind: Job
metadata:
  annotations:
    "helm.sh/hook": pre-install
`

MockHookTemplate is the hook template used for all mock release objects.

View Source
var MockManifest = `apiVersion: v1
kind: Secret
metadata:
  name: fixture
`

MockManifest is the manifest used for all mock release objects.

Functions

This section is empty.

Types

type ApplyMethod

type ApplyMethod string
const ApplyMethodClientSideApply ApplyMethod = "csa"
const ApplyMethodServerSideApply ApplyMethod = "ssa"

type Hook

type Hook struct {
	Name string `json:"name,omitempty"`
	// Kind is the Kubernetes kind.
	Kind string `json:"kind,omitempty"`
	// Path is the chart-relative path to the template.
	Path string `json:"path,omitempty"`
	// Manifest is the manifest contents.
	Manifest string `json:"manifest,omitempty"`
	// Events are the events that this hook fires on.
	Events []HookEvent `json:"events,omitempty"`
	// LastRun indicates the date/time this was last run.
	LastRun HookExecution `json:"last_run"`
	// Weight indicates the sort order for execution among similar Hook type
	Weight int `json:"weight,omitempty"`
	// DeletePolicies are the policies that indicate when to delete the hook
	DeletePolicies []HookDeletePolicy `json:"delete_policies,omitempty"`
	// OutputLogPolicies defines whether we should copy hook logs back to main process
	OutputLogPolicies []HookOutputLogPolicy `json:"output_log_policies,omitempty"`
}

Hook defines a hook object.

type HookDeletePolicy

type HookDeletePolicy string

HookDeletePolicy specifies the hook delete policy

const (
	HookSucceeded          HookDeletePolicy = "hook-succeeded"
	HookFailed             HookDeletePolicy = "hook-failed"
	HookBeforeHookCreation HookDeletePolicy = "before-hook-creation"
)

Hook delete policy types

func (HookDeletePolicy) String

func (x HookDeletePolicy) String() string

type HookEvent

type HookEvent string

HookEvent specifies the hook event

const (
	HookPreInstall   HookEvent = "pre-install"
	HookPostInstall  HookEvent = "post-install"
	HookPreDelete    HookEvent = "pre-delete"
	HookPostDelete   HookEvent = "post-delete"
	HookPreUpgrade   HookEvent = "pre-upgrade"
	HookPostUpgrade  HookEvent = "post-upgrade"
	HookPreRollback  HookEvent = "pre-rollback"
	HookPostRollback HookEvent = "post-rollback"
	HookTest         HookEvent = "test"
)

Hook event types

func (HookEvent) String

func (x HookEvent) String() string

type HookExecution

type HookExecution struct {
	// StartedAt indicates the date/time this hook was started
	StartedAt time.Time `json:"started_at,omitzero"`
	// CompletedAt indicates the date/time this hook was completed.
	CompletedAt time.Time `json:"completed_at,omitzero"`
	// Phase indicates whether the hook completed successfully
	Phase HookPhase `json:"phase"`
}

A HookExecution records the result for the last execution of a hook for a given release.

func (HookExecution) MarshalJSON

func (h HookExecution) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It omits zero-value time fields from the JSON output.

func (*HookExecution) UnmarshalJSON

func (h *HookExecution) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It handles empty string time fields by treating them as zero values.

type HookOutputLogPolicy

type HookOutputLogPolicy string

HookOutputLogPolicy specifies the hook output log policy

const (
	HookOutputOnSucceeded HookOutputLogPolicy = "hook-succeeded"
	HookOutputOnFailed    HookOutputLogPolicy = "hook-failed"
)

Hook output log policy types

func (HookOutputLogPolicy) String

func (x HookOutputLogPolicy) String() string

type HookPhase

type HookPhase string

A HookPhase indicates the state of a hook execution

const (
	// HookPhaseUnknown indicates that a hook is in an unknown state
	HookPhaseUnknown HookPhase = "Unknown"
	// HookPhaseRunning indicates that a hook is currently executing
	HookPhaseRunning HookPhase = "Running"
	// HookPhaseSucceeded indicates that hook execution succeeded
	HookPhaseSucceeded HookPhase = "Succeeded"
	// HookPhaseFailed indicates that hook execution failed
	HookPhaseFailed HookPhase = "Failed"
)

func (HookPhase) String

func (x HookPhase) String() string

String converts a hook phase to a printable string

type Info

type Info struct {
	// FirstDeployed is when the release was first deployed.
	FirstDeployed time.Time `json:"first_deployed,omitzero"`
	// LastDeployed is when the release was last deployed.
	LastDeployed time.Time `json:"last_deployed,omitzero"`
	// Deleted tracks when this object was deleted.
	Deleted time.Time `json:"deleted,omitzero"`
	// Description is human-friendly "log entry" about this release.
	Description string `json:"description,omitempty"`
	// Status is the current state of the release
	Status common.Status `json:"status,omitempty"`
	// Contains the rendered templates/NOTES.txt if available
	Notes string `json:"notes,omitempty"`
	// Contains the deployed resources information
	Resources   map[string][]runtime.Object `json:"resources,omitempty"`
	Annotations map[string]string           `json:"annotations,omitempty"`
}

Info describes release information.

func (Info) MarshalJSON

func (i Info) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It omits zero-value time fields from the JSON output.

func (*Info) UnmarshalJSON

func (i *Info) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. It handles empty string time fields by treating them as zero values.

type MockReleaseOptions

type MockReleaseOptions struct {
	Name      string
	Version   int
	Chart     *v3.Chart
	Status    rcommon.Status
	Namespace string
	Labels    map[string]string
}

MockReleaseOptions allows for user-configurable options on mock release objects.

type Release

type Release struct {
	// Name is the name of the release
	Name string `json:"name,omitempty"`
	// Info provides information about a release
	Info *Info `json:"info,omitempty"`
	// Chart is the chart that was released.
	Chart *chart.Chart `json:"chart,omitempty"`
	// Config is the set of extra Values added to the chart.
	// These values override the default values inside of the chart.
	Config map[string]any `json:"config,omitempty"`
	// Manifest is the string representation of the rendered template.
	Manifest string `json:"manifest,omitempty"`
	// Hooks are all of the hooks declared for this release.
	Hooks []*Hook `json:"hooks,omitempty"`
	// Version is an int which represents the revision of the release.
	Version int `json:"version,omitempty"`
	// Namespace is the kubernetes namespace of the release.
	Namespace string `json:"namespace,omitempty"`
	// Labels of the release.
	// Disabled encoding into Json cause labels are stored in storage driver metadata field.
	Labels map[string]string `json:"-"`
	// ApplyMethod stores whether server-side or client-side apply was used for the release
	// Unset (empty string) should be treated as the default of client-side apply
	ApplyMethod      string `json:"apply_method,omitempty"` // "ssa" | "csa"
	UnstoredManifest string `json:"unstored_manifest,omitempty"`
}

Release describes a deployment of a chart, together with the chart and the variables used to deploy that chart.

func Mock

func Mock(opts *MockReleaseOptions) *Release

Mock creates a mock release object based on options set by MockReleaseOptions. This function should typically not be used outside of testing.

func (*Release) SetStatus

func (r *Release) SetStatus(status common.Status, msg string)

SetStatus is a helper for setting the status on a release.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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