Commit Graph

91 Commits

Author SHA1 Message Date
Kumar Mallikarjuna 53578dd43f Update API docs and descriptions
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna.work@gmail.com>
2025-01-10 16:21:57 +05:30
Kumar Mallikarjuna 98622cd087 Add `disableTakeOwnership` to Helm install/upgrade actions
This change adds a new field called `disableTakeOwnership` to `.spec.install` and `.spec.upgrade`. The flag allows users to disable ignoring helm annotations and labels before taking ownership of existing resources during install and upgrade.

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna.work@gmail.com>
2025-01-08 23:26:05 +05:30
Stefan Prodan 9c58e02b62
Refactor values composition to use `pkg/chartutil`
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-12-10 12:04:54 +02:00
Stefan Prodan 54f0b42b34
Add `disableSchemaValidation` to Helm install/upgrade actions
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-09-20 22:28:51 +03:00
Stefan Prodan d909c31b5e
Fix: Allow upgrading from v2beta1 to v2 (GA)
Add `.spec.chartRef` placeholder to v2beta1 to allow upgrading to v2 GA.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-10 16:27:15 +03:00
Soule BA 4b6febf48c
Add test cases for Summarize() and DetermineReleaseState()
Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-05-07 23:13:47 +02:00
Soule BA 4069ad47e9
A better implementation for observing Postrenderers
This implementation update `.status.ObervedPostRenderersDigest` after a
successful reconciliation if `spec.postRenderers` is not nil.

Changes to `spec.postRenderers` are detected for `deployed` releases.
`Failed` and `Uninstalled` releases are detected earlier in the
reconciliation process.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-05-07 14:17:17 +02:00
Soule BA aa70ac2b31
fix: detect changes in spec.postRenderers
Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-05-07 11:57:52 +02:00
Stefan Prodan 863d3115f3
Add app version to CRD manifests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-07 12:18:20 +03:00
Stefan Prodan 7f78cdc368
Add the chart app version to events metadata
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-07 00:14:55 +03:00
Stefan Prodan 42fe4a39c1
Remove deprecated `patchesStrategicMerge` and `patchesJson6902` from v2 API
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-04 12:41:24 +03:00
Stefan Prodan 64d1236c17
Remove deprecated `.status.lastAppliedRevision` from v2 API
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-04 12:24:33 +03:00
Stefan Prodan 2cbd2bd944
Remove deprecated `.spec.valuesFile` from v2 API
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-04 12:24:32 +03:00
Stefan Prodan 23f2ebe86d
Update copyright year (GA API)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-03 17:35:01 +03:00
Stefan Prodan f76d6fe026
Update samples to GA APIs
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-03 17:12:22 +03:00
Stefan Prodan 00785fbfa3
Promote `HelmRelease` API to v2 (GA)
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2024-05-03 16:25:14 +03:00
Robin Breathe bca7983d77
feat(HelmChartTemplateSpec): optionally ignore missing valuesFiles
Signed-off-by: Robin Breathe <robin@isometry.net>
2024-05-03 14:01:20 +02:00
Soule BA edec322a3d
Take into account the oci-digest
This commit add the oci artifact digest into the release observed
snapshot. This is used to later to add that value as an annotation.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-04-18 13:07:41 +02:00
Soule BA aeac55dba9
Adding 12 first character of digest to chart version
This is needed for an OCIRepository source in order to detect change for
mutable tags.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-04-18 13:07:41 +02:00
Soule BA d1d2d0002e
adding an upgrade from ocirepo test
Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-04-18 13:07:40 +02:00
Soule BA 20e14fe304
This commit enable reusing an existing OCIRepo as chartRef.
It takes into account switching from a chart
template to a referenced source (garbage collection).

Signed-off-by: Soule BA <bah.soule@gmail.com>
2024-04-18 13:05:04 +02:00
Hidde Beydals 35e914d159
api: deprecate stragic merge and JSON 6902 patches
They have been deprecated for a long time, and should be scheduled for
removal to ensure they can be removed in the final `v2` release.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-12-07 17:37:00 +01:00
Hidde Beydals 7a15000b4c
api: introduce `forceAt` and `resetAt` annotations
This introduces two new annotations:

- `reconcile.fluxcd.io/resetAt`: to reset the failure counts for a
  `HelmRelease` object.
- `reconcile.fluxcd.io/forceAt`: to allow a one-off Helm install or
  upgrade when the controller would otherwise do nothing (e.g. due to
  being out of retries, in-sync, in a failed state, etc.)

Both annotations require the `reconcile.fluxcd.io/requestedAt`
annotation to be set at the same time, with the same token value.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-30 10:22:48 +01:00
Hidde Beydals a5db99a88c
api: allow configuration of drift detection
This adds the option to enable drift detection for a specific
`HelmRelease` instance using `.spec.driftDetection.mode`.

Supported configurations are `enabled` (detect and correct), `warn`
(detect) and `disabled`.

In addition to this, it allows defining a set of ignore rules using
`.spec.driftDetection.ignore`. Which can be used to ignore (portions
of) a resource using JSON pointers and target selectors.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-24 13:33:32 +01:00
Hidde Beydals 580c72cd09
controller: adopt release based on v2beta1 state
This allows the controller to be updated from `v2beta1` to `v2beta2`
without triggering a release to settle state.

It does this by looking at the previous successful release as recorded
for the `v2beta1` object, and if found, recording a snapshot for it in
the new `History` field of the status.

This feature can be disabled by setting the `AdoptLegacyReleases`
feature flag to `false`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-22 23:14:17 +01:00
Hidde Beydals 9bb8f02495
api: continue to record `LastAppliedRevision`
This ensures that certain UIs can continue to display information to
their users while they work on making better use of the new data
available in `v2beta2`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-21 15:31:30 +01:00
Hidde Beydals 533589ce39
api: change `MaxHistory` default to `5`
As anything beyond ~3 releases has no real value to the controller
itself, while the time it takes to perform a release increases with
the number of releases kept in history.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-20 12:06:53 +01:00
Hidde Beydals c5a017cb76
api: record observed releases in `Status.History`
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-20 12:06:53 +01:00
Hidde Beydals 10277c7b26
api: add `LastAttemptedReleaseAction` to status
This can be used to reliable determine the active remediation strategy
which should be used. Including in edge cases where e.g. an uninstall
remediation is configured for upgrade failures.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-20 12:06:50 +01:00
Hidde Beydals 882da27a5d
api: move `Current` and `Previous` into `History`
The primary reason for this is the alphabetical ordering of `kubectl
describe`, which caused the fields to be listed in separate places
instead of a bundle.

From a programmatic perspective, it is also great because it is now much
easier to reset any previous state when e.g. uninstalling a release. As
we can simply write an empty struct to erase any memory of a previous
release, instead of having to deal with multiple fields.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-20 12:06:42 +01:00
Hidde Beydals 7dfce0c738
api: introduce `APIVersion` in `Snapshot`
This will allow the controller to pick the right method for digest
calculations when we for example add new data into the calculation.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-20 12:06:41 +01:00
Hidde Beydals 9df9b176d9
api: various naming improvements
- Rename `HelmReleaseInfo` to `Snapshot`.
- Rename `HelmReleaseTestHook` to `TestHookStatus`.
- Rename `ObservedRelease` to `Observation`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-20 12:06:41 +01:00
Hidde Beydals d802ba6cc1
controllers: roughly rewire HelmRelease reconciler
This adds the base wiring to get the controller to work with the
v2beta2 API and the newly introduced packages in `internal/`.

In essence, this means that from now on the controller will utilize all
new code for the reconciliation of the HelmRelease resource.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-20 12:06:35 +01:00
Hidde Beydals deb0b14e43
api: make v2beta2 storage version
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-11-20 12:06:33 +01:00
Jiri Tyr 8cefed19fd
Adding tests
Signed-off-by: Jiri Tyr <jiri.tyr@gmail.com>
2023-11-20 12:06:04 +01:00
Jiri Tyr 6db62ed507
Adding test filters
Signed-off-by: Jiri Tyr <jiri.tyr@gmail.com>
2023-11-20 12:06:02 +01:00
Hidde Beydals d76f3a355b
controller: jitter requeue interval
This adds a `--interval-jitter-percentage` flag to the controller to
add a +/- percentage jitter to the interval defined in a HelmRelease
(defaults to 5%).

Effectively, this results in a reconciliation every 9.5 - 10.5 minutes
for a resource with an interval of 10 minutes.

Main reason to add this change is to mitigate spikes in memory and
CPU usage caused by many resources being configured with the same
interval.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-08-09 17:50:43 +02:00
Max Jonas Werner 726edec9a6
Align docs structure with other controllers
In some controller we already support multiple API versions at the
same time. In order to streamline the docs structure, the necessary
changes to do the same in this repo are applied here as well.

refs fluxcd/website#1577

Signed-off-by: Max Jonas Werner <mail@makk.es>
2023-07-21 17:04:33 +02:00
Martin Hoffmann 79e4b9a099 Set deletion propagation for helm uninstall
Signed-off-by: Martin Hoffmann <martin.hoffmann01@sap.com>
Signed-off-by: Martin Hoffmann <hoffimar@gmail.com>
2023-06-30 19:30:57 +02:00
Hidde Beydals 3f65b45e4a
api: add `PersistentClient` flag to allow control
This adds a `PersistentClient` flag which should be consumed by the
controller while initializing the Kubernetes client used by Helm
actions.

This to allow the controller to work with certain charts which do
require a client which does not persist, as they create Custom Resource
Definitions on demand during e.g. install, which then later aren't
observed by Helm as it does not reset the REST mapper between successive
action steps.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-30 16:14:15 +02:00
Hidde Beydals a72a2fc6ca
misc: tidy HelmChart annotation and labels feat
- Assing `ObjectMeta` field in Helm chart template.
- Ensure things are at least lightly mentioned in spec documentation.
- Add two simple test cases.
- Fix broken links to Kubernetes documentation.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-29 14:32:13 +02:00
Raffael Sahli 2cc2fee410 feat: manage label and annotations for a helmchart
Signed-off-by: Raffael Sahli <raffael.sahli@doodle.com>
2023-03-29 14:18:40 +02:00
Hidde Beydals 16ce900b20
api: switch to `meta.KubeConfigReference`
This is backwards compatible, as it only changes the type without the
further requirements around the YAML declaration.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 09:36:43 +01:00
Soule BA 2b0e35559c
Add cosign verification to the chart Template
If implemented users can reconcile charts with cosign verification
enabled.

Signed-off-by: Soule BA <bah.soule@gmail.com>
2022-10-21 16:18:02 +02:00
Paulo Gomes 3cd330cc53
Add validation to TargetPath and ValuesKey
Formalises the API requirements around TargetPath and ValuesKey,
which were the two fields missing validation within ValuesReference.
In both cases the validation was introduced at CRD level, so that
the apiserver will enforce it.

ValuesKey must be a valid Data Key. Therefore the same logic used by
upstream Kubernetes is reused here to ensure a valid key is being used.

For TargetPath a loose regex is being used to largely represent the
expected format. A max length of 250 is now being enforced.

This is a breaking change, as invalid TargetPath and ValuesKey will now
be rejected by the apiserver, instead of being accepted and potentially
failing at reconciliation time.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-08-17 14:30:35 +01:00
Nick Stogner 9f60433550 Add .spec.kubeConfig.secretRef.key
Signed-off-by: Nick Stogner <nicholas.stogner@gmail.com>
2022-04-28 13:19:22 +02:00
Paulo Gomes 86a8d26985
Update KubeConfig documentation
When the flag --default-service-account was added it changed
slightly the behaviour of the spec.KubeConfig field. It forces
the impersonation to always take place, either via the contents
of spec.ServiceAccountName or its fallback at controller level.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-04-04 16:30:07 +01:00
Sunny 6bd29a729d Use new standardized runtime and meta package
This includes an update of the source-controller to v0.22.0, to pull in
the v1beta2 API which makes use of the same packages.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2022-03-18 13:10:32 +01:00
Tomek Rękawek 5b1b1ce642 Support targeted Patches in the PostRenderer specification.
Signed-off-by: Tomek Rękawek <rekawek@adobe.com>
2022-03-11 14:34:28 +01:00
Samuel Torres 7d6c0f7c47 Add disableWait property on Helm uninstall
This commit changes the default behavior of the Helm uninstall action
to wait for all resources to be deleted, and introduces a
`.spec.uninstall.disableWait` flag to disable this behavior.

Signed-off-by: Samuel Torres <samuelpirestorres@gmail.com>
2022-02-16 12:09:29 +01:00