Documentation ¶
Index ¶
- type Option
- func SkipDependentWatches(skip bool) Option
- func WithActionClientGetter(actionClientGetter helmclient.ActionClientGetter) Option
- func WithChart(chrt chart.Chart) Option
- func WithClient(cl client.Client) Option
- func WithEventRecorder(er record.EventRecorder) Option
- func WithGroupVersionKind(gvk schema.GroupVersionKind) Option
- func WithInstallAnnotations(as ...annotation.Install) Option
- func WithLog(log logr.Logger) Option
- func WithMaxConcurrentReconciles(max int) Option
- func WithOverrideValues(overrides map[string]string) Option
- func WithPostHook(h hook.PostHook) Option
- func WithPreHook(h hook.PreHook) Option
- func WithReconcilePeriod(rp time.Duration) Option
- func WithUninstallAnnotations(as ...annotation.Uninstall) Option
- func WithUpgradeAnnotations(as ...annotation.Upgrade) Option
- func WithValueMapper(m values.Mapper) Option
- type Reconciler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(r *Reconciler) error
Option is a function that configures the helm Reconciler.
func SkipDependentWatches ¶
WithDependentWatchesEnabled is an Option that configures whether the Reconciler will register watches for dependent objects in releases and trigger reconciliations when they change.
By default, dependent watches are enabled.
func WithActionClientGetter ¶
func WithActionClientGetter(actionClientGetter helmclient.ActionClientGetter) Option
WithActionClientGetter is an Option that configures a Reconciler's ActionClientGetter.
A default ActionClientGetter is used if this option is not configured.
func WithChart ¶
WithChart is an Option that configures a Reconciler's helm chart.
This option is required.
func WithClient ¶
WithClient is an Option that configures a Reconciler's client.
By default, manager.GetClient() is used if this option is not configured.
func WithEventRecorder ¶
func WithEventRecorder(er record.EventRecorder) Option
WithEventRecorder is an Option that configures a Reconciler's EventRecorder.
By default, manager.GetEventRecorderFor() is used if this option is not configured.
func WithGroupVersionKind ¶
func WithGroupVersionKind(gvk schema.GroupVersionKind) Option
WithGroupVersionKind is an Option that configures a Reconciler's GroupVersionKind.
This option is required.
func WithInstallAnnotations ¶
func WithInstallAnnotations(as ...annotation.Install) Option
WithInstallAnnotations is an Option that configures Install annotations to enable custom action.Install fields to be set based on the value of annotations found in the custom resource watched by this reconciler. Duplicate annotation names will result in an error.
func WithLog ¶
WithLog is an Option that configures a Reconciler's logger.
A default logger is used if this option is not configured.
func WithMaxConcurrentReconciles ¶
WithMaxConcurrentReconciles is an Option that configures the number of concurrent reconciles that the controller will run.
The default is 1.
func WithOverrideValues ¶
WithOverrideValues is an Option that configures a Reconciler's override values.
Override values can be used to enforce that certain values provided by the chart's default values.yaml or by a CR spec are always overridden when rendering the chart. If a value in overrides is set by a CR, it is overridden by the override value. The override value can be static but can also refer to an environment variable.
If an environment variable reference is listed in override values but is not present in the environment when this function runs, it will resolve to an empty string and override all other values. Therefore, when using environment variable expansion, ensure that the environment variable is set.
func WithPostHook ¶
WithPostHook is an Option that configures the reconciler to run the given PostHook just after performing any non-uninstall release actions.
func WithPreHook ¶
WithPreHook is an Option that configures the reconciler to run the given PreHook just before performing any actions (e.g. install, upgrade, uninstall, or reconciliation).
func WithReconcilePeriod ¶
WithReconcilePeriod is an Option that configures the reconcile period of the controller. This will cause the controller to reconcile CRs at least once every period. By default, the reconcile period is set to 0, which means no time-based reconciliations will occur.
func WithUninstallAnnotations ¶
func WithUninstallAnnotations(as ...annotation.Uninstall) Option
WithUninstallAnnotations is an Option that configures Uninstall annotations to enable custom action.Uninstall fields to be set based on the value of annotations found in the custom resource watched by this reconciler. Duplicate annotation names will result in an error.
func WithUpgradeAnnotations ¶
func WithUpgradeAnnotations(as ...annotation.Upgrade) Option
WithUpgradeAnnotations is an Option that configures Upgrade annotations to enable custom action.Upgrade fields to be set based on the value of annotations found in the custom resource watched by this reconciler. Duplicate annotation names will result in an error.
func WithValueMapper ¶
WithValueMapper is an Option that configures a function that maps values from a custom resource spec to the values passed to Helm
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler reconciles a Helm object
func New ¶
func New(opts ...Option) (*Reconciler, error)
New creates a new Reconciler that reconciles custom resources that define a Helm release. New takes variadic Option arguments that are used to configure the Reconciler.
Required options are:
- WithGroupVersionKind
- WithChart
Other options are defaulted to sane defaults when SetupWithManager is called.
If an error occurs configuring or validating the Reconciler, it is returned.
func (*Reconciler) Reconcile ¶
Reconcile reconciles a CR that defines a Helm v3 release.
- If a release does not exist for this CR, a new release is installed.
- If a release exists and the CR spec has changed since the last, reconciliation, the release is upgraded.
- If a release exists and the CR spec has not changed since the last reconciliation, the release is reconciled. Any dependent resources that have diverged from the release manifest are re-created or patched so that they are re-aligned with the release.
- If the CR has been deleted, the release will be uninstalled. The Reconciler uses a finalizer to ensure the release uninstall succeeds before CR deletion occurs.
If an error occurs during release installation or upgrade, the change will be rolled back to restore the previous state.
Reconcile also manages the status field of the custom resource. It includes the release name and manifest in `status.deployedRelease`, and it updates `status.conditions` based on reconciliation progress and success. Condition types include:
- Deployed - a release for this CR is deployed (but not necessarily ready).
- ReleaseFailed - an installation or upgrade failed.
- Irreconcilable - an error occurred during reconciliation
func (*Reconciler) SetupWithManager ¶
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager configures a controller for the Reconciler and registers watches. It also uses the passed Manager to initialize default values for the Reconciler and sets up the manager's scheme with the Reconciler's configured GroupVersionKind.
If an error occurs setting up the Reconciler with the manager, it is returned.