helm

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExportGetValuesForHelmChart     = getValuesForHelmChart
	ExportNewHelmAction             = newHelmAction
	ExportDiffAgainstLiveObjects    = diffAgainstLiveObjects
	ExportConfigureChartPathOptions = configureChartPathOptions
	ExportGreenhouseFieldManager    = greenhouseFieldManager
	ExportDiffAgainstRelease        = diffAgainstRelease
	ExportInstallHelmRelease        = installRelease
)
View Source
var (

	// IsHelmDebug is configured via a flag and enables extensive debug logging for Helm actions.
	IsHelmDebug bool
)

Functions

func CalculatePluginOptionChecksum

func CalculatePluginOptionChecksum(ctx context.Context, c client.Client, plugin *greenhousev1alpha1.Plugin) (string, error)

CalculatePluginOptionChecksum calculates a hash of plugin option values. Secret-type option values are extracted first and all values are sorted to ensure that order is not important when comparing checksums.

func ChartTest

func ChartTest(ctx context.Context, restClientGetter genericclioptions.RESTClientGetter, plugin *greenhousev1alpha1.Plugin) (hasTestHook bool, testPodLogs string, err error)

ChartTest executes Helm chart tests and logs test pod logs if a test fails.

func ConvertFlatValuesToHelmValues added in v0.6.0

func ConvertFlatValuesToHelmValues(values []greenhousev1alpha1.PluginOptionValue) (map[string]any, error)

ConvertFlatValuesToHelmValues shall converts flat values for a Helm chart yaml-compatible structure. Example: The input

global.image.registry=foobar

is transformed to

global:
  image:
    registry: foobar

func GetGreenhouseValues added in v0.6.0

GetGreenhouseValues generate values for greenhouse core resources in the form:

global:
  greenhouse:
    clusterNames:
	  - <name>
	teams:
	  - <name>

func GetHelmTimeout

func GetHelmTimeout() time.Duration

GetHelmTimeout gets a timeout duration for helm release install, upgrade and rollback actions. Tries to get the value from HELM_RELEASE_TIMEOUT evironment variable, otherwise gets the default value. Mainly used for E2E tests, because in deployment mode this should always be set to the default 5 minutes.

func GetReleaseForHelmChartFromPlugin

func GetReleaseForHelmChartFromPlugin(_ context.Context, restClientGetter genericclioptions.RESTClientGetter, plugin *greenhousev1alpha1.Plugin) (*release.Release, error)

GetReleaseForHelmChartFromPlugin returns the Helm release for the given Plugin or an error.

func InstallOrUpgradeHelmChartFromPlugin

func InstallOrUpgradeHelmChartFromPlugin(ctx context.Context, local client.Client, restClientGetter genericclioptions.RESTClientGetter, pluginDefinitionSpec greenhousev1alpha1.PluginDefinitionSpec, plugin *greenhousev1alpha1.Plugin) error

InstallOrUpgradeHelmChartFromPlugin installs a new or upgrades an existing Helm release for the given PluginDefinition and Plugin.

func MergeMaps added in v0.6.0

func MergeMaps(a, b map[string]any) map[string]any

Taken from: https://github.com/helm/helm/blob/v3.10.3/pkg/cli/values/options.go#L99-L116

func MergePluginAndPluginOptionValueSlice added in v0.6.0

func MergePluginAndPluginOptionValueSlice(pluginOptions []greenhousev1alpha1.PluginOption, pluginOptionValues []greenhousev1alpha1.PluginOptionValue) []greenhousev1alpha1.PluginOptionValue

func MergePluginOptionValues added in v0.6.0

func MergePluginOptionValues(dst, src []greenhousev1alpha1.PluginOptionValue) []greenhousev1alpha1.PluginOptionValue

MergePluginOptionValues merges the given src into the dst PluginOptionValue slice.

func ObjectMapFromLocalManifest added in v0.9.0

func ObjectMapFromLocalManifest(f ManifestFilter, manifest string) (map[ObjectKey]*ManifestObject, error)

func ObjectMapFromManifest

func ObjectMapFromManifest(restClientGetter genericclioptions.RESTClientGetter, namespace, manifest string, f ManifestFilter) (map[ObjectKey]*ManifestObject, error)

ObjectMapFromManifest returns a map of objects from the manifests matching the filter or an error.

func ObjectMapFromRelease

func ObjectMapFromRelease(restClientGetter genericclioptions.RESTClientGetter, r *release.Release, f ManifestFilter) (map[ObjectKey]*ManifestObject, error)

ObjectMapFromRelease returns a map of objects from the helm release manifest matching the filter or an error.

func ResetHelmReleaseStatusToDeployed

func ResetHelmReleaseStatusToDeployed(restClientGetter genericclioptions.RESTClientGetter, plugin *greenhousev1alpha1.Plugin) error

ResetHelmReleaseStatusToDeployed resets the status of the release to deployed using a rollback.

func TemplateHelmChartFromPlugin

func TemplateHelmChartFromPlugin(ctx context.Context, local client.Client, restClientGetter genericclioptions.RESTClientGetter, pluginDefinitionSpec greenhousev1alpha1.PluginDefinitionSpec, plugin *greenhousev1alpha1.Plugin) (*release.Release, error)

TemplateHelmChartFromPlugin returns the rendered manifest or an error.

func TemplateHelmChartFromPluginOptionValues added in v0.9.0

func TemplateHelmChartFromPluginOptionValues(ctx context.Context, local client.Client, restClientGetter genericclioptions.RESTClientGetter, pluginDefinitionSpec *greenhousev1alpha1.PluginDefinitionSpec, plugin *greenhousev1alpha1.Plugin, optionValues []greenhousev1alpha1.PluginOptionValue) (*release.Release, error)

TemplateHelmChartFromPluginOptionValues returns the rendered manifest or an error. This function

func UninstallHelmRelease

func UninstallHelmRelease(ctx context.Context, restClientGetter genericclioptions.RESTClientGetter, plugin *greenhousev1alpha1.Plugin) (releaseNotFound bool, err error)

UninstallHelmRelease removes the Helm release for the given Plugin.

Types

type CELResolver added in v0.9.0

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

func NewCELResolver added in v0.9.0

func NewCELResolver(optionValues []greenhousev1alpha1.PluginOptionValue) (*CELResolver, error)

NewCELResolver creates a new CELResolver for a given Plugin.

func (*CELResolver) ResolveExpression added in v0.9.0

func (c *CELResolver) ResolveExpression(optionValue greenhousev1alpha1.PluginOptionValue, expressionEvaluationEnabled bool) (*greenhousev1alpha1.PluginOptionValue, error)

type ChartLoaderFunc

type ChartLoaderFunc func(name string) (*chart.Chart, error)
var ChartLoader ChartLoaderFunc = loader.Load

type DiffObject

type DiffObject struct {
	// Name is the GVK and namespaced name of the involved Kubernetes object.
	Name,

	Diff string
}

DiffObject is a Kubernetes object where the deployed state differs from the one in the Helm chart manifest.

type DiffObjectList

type DiffObjectList []DiffObject

DiffObjectList is a list of DiffObjects.

func DiffChartToDeployedResources

func DiffChartToDeployedResources(ctx context.Context, local client.Client, restClientGetter genericclioptions.RESTClientGetter, pluginDefinitionSpec greenhousev1alpha1.PluginDefinitionSpec, plugin *greenhousev1alpha1.Plugin) (diffs DiffObjectList, isDrift bool, err error)

DiffChartToDeployedResources returns whether the Kubernetes objects, as specified in the Helm chart manifest, differ from the deployed state.

func (DiffObjectList) String

func (d DiffObjectList) String() string

String returns the string of the DiffObjectList.

type ManifestFilter

type ManifestFilter interface {
	Matches(obj *resource.Info) bool
}

type ManifestMultipleObjectFilter

type ManifestMultipleObjectFilter struct {
	Filters []ManifestObjectFilter
}

func (*ManifestMultipleObjectFilter) Matches

Matches returns true if the given object matches the filters.

type ManifestObject

type ManifestObject struct {
	Namespace,
	Name string
	Object runtime.Object
}

ManifestObject represents an object in a Helm manifest.

type ManifestObjectFilter

type ManifestObjectFilter struct {
	APIVersion, Kind, Name string
	Annotations            map[string]string
}

ManifestObjectFilter is used to filter for objects in a Helm manifest.

func (*ManifestObjectFilter) Matches

func (o *ManifestObjectFilter) Matches(obj *resource.Info) bool

Matches returns true if the given object matches the filter.

type ObjectKey

type ObjectKey struct {
	GVK       schema.GroupVersionKind
	Namespace string
	Name      string
}

ObjectKey is a unique key for a ManifestObject.

type ObjectList

type ObjectList struct {
	ObjectKey
	*ManifestObject
}

Jump to

Keyboard shortcuts

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