Documentation
¶
Index ¶
- Variables
- func CalculatePluginOptionChecksum(ctx context.Context, c client.Client, plugin *greenhousev1alpha1.Plugin) (string, error)
- func ChartTest(ctx context.Context, restClientGetter genericclioptions.RESTClientGetter, ...) (hasTestHook bool, testPodLogs string, err error)
- func ConvertFlatValuesToHelmValues(values []greenhousev1alpha1.PluginOptionValue) (map[string]any, error)
- func GetGreenhouseValues(ctx context.Context, c client.Client, p greenhousev1alpha1.Plugin) ([]greenhousev1alpha1.PluginOptionValue, error)
- func GetHelmTimeout() time.Duration
- func GetPluginOptionValuesForPlugin(ctx context.Context, c client.Client, plugin *greenhousev1alpha1.Plugin) ([]greenhousev1alpha1.PluginOptionValue, error)
- func GetReleaseForHelmChartFromPlugin(_ context.Context, restClientGetter genericclioptions.RESTClientGetter, ...) (*release.Release, error)
- func InstallOrUpgradeHelmChartFromPlugin(ctx context.Context, local client.Client, ...) error
- func MergeMaps(a, b map[string]any) map[string]any
- func MergePluginAndPluginOptionValueSlice(pluginOptions []greenhousev1alpha1.PluginOption, ...) []greenhousev1alpha1.PluginOptionValue
- func MergePluginOptionValues(dst, src []greenhousev1alpha1.PluginOptionValue) []greenhousev1alpha1.PluginOptionValue
- func ObjectMapFromLocalManifest(f ManifestFilter, manifest string) (map[ObjectKey]*ManifestObject, error)
- func ObjectMapFromManifest(restClientGetter genericclioptions.RESTClientGetter, ...) (map[ObjectKey]*ManifestObject, error)
- func ObjectMapFromRelease(restClientGetter genericclioptions.RESTClientGetter, r *release.Release, ...) (map[ObjectKey]*ManifestObject, error)
- func ResetHelmReleaseStatusToDeployed(restClientGetter genericclioptions.RESTClientGetter, ...) error
- func TemplateHelmChartFromPlugin(ctx context.Context, local client.Client, ...) (*release.Release, error)
- func TemplateHelmChartFromPluginOptionValues(ctx context.Context, local client.Client, ...) (*release.Release, error)
- func UninstallHelmRelease(ctx context.Context, restClientGetter genericclioptions.RESTClientGetter, ...) (releaseNotFound bool, err error)
- type CELResolver
- type ChartLoaderFunc
- type DiffObject
- type DiffObjectList
- type ManifestFilter
- type ManifestMultipleObjectFilter
- type ManifestObject
- type ManifestObjectFilter
- type ObjectKey
- type ObjectList
Constants ¶
This section is empty.
Variables ¶
var ( ExportGetValuesForHelmChart = getValuesForHelmChart ExportNewHelmAction = newHelmAction ExportDiffAgainstLiveObjects = diffAgainstLiveObjects ExportConfigureChartPathOptions = configureChartPathOptions ExportGreenhouseFieldManager = greenhouseFieldManager ExportDiffAgainstRelease = diffAgainstRelease ExportInstallHelmRelease = installRelease )
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
func GetGreenhouseValues(ctx context.Context, c client.Client, p greenhousev1alpha1.Plugin) ([]greenhousev1alpha1.PluginOptionValue, error)
GetGreenhouseValues generate values for greenhouse core resources in the form:
global:
greenhouse:
clusterNames:
- <name>
teams:
- <name>
func GetHelmTimeout ¶
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 GetPluginOptionValuesForPlugin ¶
func GetPluginOptionValuesForPlugin(ctx context.Context, c client.Client, plugin *greenhousev1alpha1.Plugin) ([]greenhousev1alpha1.PluginOptionValue, error)
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
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 ¶
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 ManifestMultipleObjectFilter ¶
type ManifestMultipleObjectFilter struct {
Filters []ManifestObjectFilter
}
type ManifestObject ¶
ManifestObject represents an object in a Helm manifest.
type ManifestObjectFilter ¶
ManifestObjectFilter is used to filter for objects in a Helm manifest.
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
}