helm

package
v0.0.0-...-a7b7215 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: UPL-1.0 Imports: 30 Imported by: 2

Documentation

Index

Constants

View Source
const ReleaseNotFound = "NotFound"

Helm chart status values: unknown, deployed, uninstalled, superseded, failed, uninstalling, pending-install, pending-upgrade or pending-rollback

View Source
const ReleaseStatusDeployed = "deployed"
View Source
const ReleaseStatusFailed = "failed"
View Source
const ReleaseStatusPendingInstall = "pending-install"
View Source
const ReleaseStatusUnknown = "unknown"

Variables

View Source
var Debug bool

Debug is set from a platform-operator arg and sets the helm --debug flag

Functions

func CreateActionConfig

func CreateActionConfig(includeRelease bool, releaseName string, releaseStatus release.Status, log vzlog.VerrazzanoLogger, createReleaseFn CreateReleaseFnType) (*action.Configuration, error)

func GetConfigMapOverrides

func GetConfigMapOverrides(log vzlog.VerrazzanoLogger, client client.Client, selector *v1.ConfigMapKeySelector,
	namespace string) (string, error)

GetConfigMapOverrides takes a ConfigMap selector and returns the YAML data and handles k8s api errors appropriately

func GetHelmReleaseStatus

func GetHelmReleaseStatus(releaseName string, namespace string) (string, error)

GetHelmReleaseStatus extracts the Helm deployment status of the specified chart from the JSON output as a string

func GetInstallOverridesYAML

func GetInstallOverridesYAML(log vzlog.VerrazzanoLogger, client client.Client, overrides []ValueOverrides,
	mlcNamespace string) ([]string, error)

GetInstallOverridesYAML takes the list of ValuesFrom and returns a string array of YAMLs

func GetRelease

func GetRelease(log vzlog.VerrazzanoLogger, releaseName string, namespace string) (*release.Release, error)

GetRelease will run 'helm get all' command and return the output from the command.

func GetReleaseAppVersion

func GetReleaseAppVersion(releaseName string, namespace string) (string, error)

GetReleaseAppVersion - public function to execute releaseAppVersionFn

func GetReleaseStatus

func GetReleaseStatus(log vzlog.VerrazzanoLogger, releaseName string, namespace string) (status string, err error)

GetReleaseStatus returns the helmRelease status

func GetReleaseStringValues

func GetReleaseStringValues(log vzlog.VerrazzanoLogger, valueKeys []string, releaseName string, namespace string) (map[string]string, error)

GetReleaseStringValues - Returns a subset of Helm helmRelease values as a map of strings

func GetReleaseValues

func GetReleaseValues(log vzlog.VerrazzanoLogger, valueKeys []string, releaseName string, namespace string) (map[string]interface{}, error)

GetReleaseValues - Returns a subset of Helm helmRelease values as a map of objects

func GetSecretOverrides

func GetSecretOverrides(log vzlog.VerrazzanoLogger, client client.Client, selector *v1.SecretKeySelector,
	namespace string) (string, error)

GetSecretOverrides takes a Secret selector and returns the YAML data and handles k8s api errors appropriately

func GetValues

func GetValues(log vzlog.VerrazzanoLogger, releaseName string, namespace string) ([]byte, error)

GetValues will run 'helm get values' command and return the output from the command.

func GetValuesMap

func GetValuesMap(log vzlog.VerrazzanoLogger, releaseName string, namespace string) (map[string]interface{}, error)

GetValuesMap will run 'helm get values' command and return the output from the command.

func HelmValueFileConstructor

func HelmValueFileConstructor(kvs []KeyValue) (string, error)

HelmValueFileConstructor creates a YAML file from a set of key value pairs

func IsReleaseDeployed

func IsReleaseDeployed(releaseName string, namespace string) (found bool, err error)

IsReleaseDeployed returns true if the helmRelease is deployed

func IsReleaseFailed

func IsReleaseFailed(releaseName string, namespace string) (bool, error)

IsReleaseFailed Returns true if the chart helmRelease state is marked 'failed'

func IsReleaseInstalled

func IsReleaseInstalled(releaseName string, namespace string) (found bool, err error)

IsReleaseInstalled returns true if the helmRelease is installed

func SetActionConfigFunction

func SetActionConfigFunction(f ActionConfigFnType)

func SetChartInfoFunction

func SetChartInfoFunction(f ChartInfoFnType)

SetChartInfoFunction Override the chart info function for unit testing

func SetDefaultActionConfigFunction

func SetDefaultActionConfigFunction()

SetDefaultActionConfigFunction Resets the action config function

func SetDefaultChartInfoFunction

func SetDefaultChartInfoFunction()

SetDefaultChartInfoFunction Reset the chart info function

func SetDefaultLoadChartFunction

func SetDefaultLoadChartFunction()

func SetLoadChartFunction

func SetLoadChartFunction(f LoadChartFnType)

func Uninstall

func Uninstall(log vzlog.VerrazzanoLogger, releaseName string, namespace string, dryRun bool) (err error)

Uninstall will uninstall the helmRelease in the specified namespace using helm uninstall

func Upgrade

func Upgrade(log vzlog.VerrazzanoLogger, releaseName string, namespace string, chartDir string, wait bool, dryRun bool, overrides []HelmOverrides) (*release.Release, error)

Upgrade will upgrade a Helm helmRelease with the specified charts. The override files array are in order with the first files in the array have lower precedence than latter files.

func UpgradeRelease

func UpgradeRelease(log vzlog.VerrazzanoLogger, releaseOpts *HelmReleaseOpts, wait bool, dryRun bool) (*release.Release, error)

Types

type ActionConfigFnType

type ActionConfigFnType func(log vzlog.VerrazzanoLogger, settings *cli.EnvSettings, namespace string) (*action.Configuration, error)

type ChartInfo

type ChartInfo struct {
	APIVersion  string
	Description string
	Name        string
	Version     string
	AppVersion  string
}

ChartInfo contains Helm Chart.yaml data

func GetChartInfo

func GetChartInfo(chartDir string) (ChartInfo, error)

GetChartInfo - public entry point

type ChartInfoFnType

type ChartInfoFnType func(chartDir string) (ChartInfo, error)

ChartInfoFnType - Package-level var and functions to allow overriding getReleaseState for unit test purposes

type ChartStatusFnType

type ChartStatusFnType func(releaseName string, namespace string) (string, error)

ChartStatusFnType - Package-level var and functions to allow overriding GetChartStatus for unit test purposes

type CreateReleaseFnType

type CreateReleaseFnType func(name string, releaseStatus release.Status) *release.Release

type HelmOverrides

type HelmOverrides struct {
	SetOverrides       string // for --set
	SetStringOverrides string // for --set-string
	SetFileOverrides   string // for --set-file
	FileOverride       string // for -f
}

HelmOverrides contains all the overrides that gets passed to the helm cli runner

func LoadOverrideFiles

func LoadOverrideFiles(log vzlog.VerrazzanoLogger, client ctrlclient.Client, releaseName string, mlcNamespace string, moduleOverrides []ValueOverrides) ([]HelmOverrides, error)

LoadOverrideFiles loads the helm overrides into a set of files for a release. Return a list of Helm overrides which contain the filenames

type HelmReleaseOpts

type HelmReleaseOpts struct {
	RepoURL      string
	ReleaseName  string
	Namespace    string
	ChartPath    string
	ChartVersion string
	Overrides    []HelmOverrides

	Username string
	Password string
}

type KeyValue

type KeyValue struct {
	Key       string
	Value     string
	SetString bool // for --set-string
	SetFile   bool // for --set-file
	IsFile    bool // for -f
}

keyVal defines the Key, Value pair used to override a single helm Value

type LoadChartFnType

type LoadChartFnType func(chartDir string) (*chart.Chart, error)

type ValueOverrides

type ValueOverrides struct {
	// Selector for ConfigMap containing override data.
	// +optional
	ConfigMapRef *corev1.ConfigMapKeySelector `json:"configMapRef,omitempty"`
	// Selector for Secret containing override data.
	// +optional
	SecretRef *corev1.SecretKeySelector `json:"secretRef,omitempty"`
	// Configure overrides using inline YAML.
	// +optional
	Values *apiextensionsv1.JSON `json:"values,omitempty"`
}

ValueOverrides identifies overrides for a Helm release.

Jump to

Keyboard shortcuts

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