Commit Graph

140 Commits

Author SHA1 Message Date
Hidde Beydals 1240f20183
Enable experimental drift detection
This enables experimental drift detection of cluster state compared to
the current manifest data from the Helm storage's manifest blob.

Drift detection works based on the already proven approach of the
kustomize-controller's SSA package, and utilizes the managed field
configured by the controller since `v0.12.2`.

This feature is planned to go out of experimental once the further
controller rewrite has been finished, and the state of the Helm storage
itself is more fault tolerant.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 09:36:43 +01:00
Hidde Beydals 8a9ba1c12c
helm: propagate context to install and upgrade
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-02-27 10:32:44 +01:00
Hidde Beydals 8b3edfd7b9 Support RFC-0005 revision format
This updates all the comparisons to make use of `HasRevision` which
supports the RFC-0005 and legacy revision formats.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2023-02-16 17:10:08 +01:00
Stefan Prodan 7b19e37eb8
Update dependencies
- helm.sh/helm/v3 v3.11.0
- k8s.io/* v0.26.1
- sigs.k8s.io/controller-runtime v0.14.2
- github.com/fluxcd/pkg/runtime v0.27.0

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2023-01-31 16:51:15 +02:00
Paulo Gomes 9f3150756d
build: Improve fuzz tests' reliability
Establish conventions which aligns with what is supported upstream
today, whilst expanding on documentation to ensure folks have
pointers on how to debug/check for issues going forwards.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-11-23 14:57:23 +00:00
Stefan Prodan f5d314c51a
Use Flux Event API v1beta1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-11-08 16:26:31 +02: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 5ce596c2dc
fuzz: Refactor Fuzz tests based on Go native fuzzing.
Moving into Go Native, the adhoc changes and on-demand build is no
longer necessary.

Previously calls to r.EventRecorder.AnnotatedEventf resulted in panic.
The new dummy recorder resolves the problem without impacting
resource consumption.

A new make target `fuzz-native` was introduced, to loop through all
fuzz tests for the duration of time specified via the environment
variable `FUZZ_TIME`.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-08-22 16:16:28 +01: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
Santosh Kaluskar d196698980 Enable RecoverPanic option on reconciler
Signed-off-by: Santosh Kaluskar <dtshbl@gmail.com>
2022-08-12 17:59:16 +05:30
Hidde Beydals 713f057ad8 tidy: remove obsolete append
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-06-07 14:23:54 +02:00
Hidde Beydals d19b470412 kube: configure proper account impersonation NS
Fixing a regression introduced in #480 which would always pick the
namespace of the release. In addition, historically seen the
configuration of the impersonation username while making use of a
KubeConfig has never worked correctly, this has been adressed as well.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-06-07 12:52:36 +02:00
Hidde Beydals 1bed542fe4 internal/kube: get REST config from runtime
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-12 12:55:36 +02:00
Hidde Beydals 5784f0644a kube: explicitly set ConfigFlags.CacheDir to nil
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-12 12:18:41 +02:00
Hidde Beydals 4371610e4b Cherry-pick kube changes from dev
This is a partial cherry-pick of commit ae4f499e87, including
changes around `kube`. This to include some of the changes around the
construction of the ConfigFlags RESTClientGetter, as an attempt to
solve token refresh issues.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-05-12 12:18:41 +02:00
Hidde Beydals 2c36cb5eda kubeconfig: err on missing declared SecretRef.Key
Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-04-29 21:46:11 +02: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
Alex Marston 42aaf61852 Add flags for exponential back-off retry
Signed-off-by: Alex Marston <alexander.marston@gmail.com>
2022-04-19 14:25:51 +02:00
Paulo Gomes 6f4ca28c9a
Add flags to control kubeconfig support
Two new flags were added to allow users to enable the
use of user.Exec and InsecureTLS in the kubeconfigs
provided remote apply reconciliations.

Breaking change: both functionalities are no longer
enabled by default.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2022-03-31 14:51:38 +01:00
Hidde Beydals 87ffcbcbf9 Prefix revision annotation with API Group FQDN
This to facilitate improvements on the notification-controller side,
where annotations prefixed with the FQDN of the Group of the Involved
Object will be transformed into "fields".

Signed-off-by: Hidde Beydals <hello@hidde.co>
2022-03-23 19:20:41 +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
Stefan Prodan 1410615554
Set QPS and Burst when impersonating service account
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-02-21 14:25:27 +02:00
Stefan Prodan 0173eaa0df
Allow setting a default service account for impersonation
Introduce the flag `--default-service-account` for allowing cluster admins to enforce impersonation for resources reconciliation.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2022-01-31 12:09:39 +02:00
Somtochi Onyekwere acf164c46e Add flag to disable cross namespace references
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2022-01-29 13:51:06 +01:00
Kingdon Barrett 0498e9e236 Use patch instead of update when adding finalizers
Signed-off-by: Kingdon Barrett <kingdon@weave.works>
2022-01-13 19:39:36 -05:00
Aurel Canciu 2c82071f6c
Update flux pkg components
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2022-01-07 17:53:07 +01:00
Paulo Gomes 0837f6f34a
Short-circuit event handling
When ExternalEventRecorder is nil, the helm release reference is not used
therefore the function can safely return early.

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2021-12-21 14:08:38 +00:00
Paulo Gomes c9b1a4f4f8
Check EventRecorder is not nil
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
2021-12-21 14:03:32 +00:00
Stefan Prodan 459984c33d
Verify artifacts integrity
After downloading an artifact, compute its checksum and verify that it matches the original checksum advertised by source-controller.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-11-12 14:35:42 +02:00
Dylan Arbour 42ec2fb0d1 Nit: update tests to use non-deprecated ValuesFiles
Signed-off-by: Dylan Arbour <arbourd@users.noreply.github.com>
2021-10-14 11:11:14 +02:00
Dylan Arbour b724dcafbb Update the chart if ReconcileStrategy changes
If the ReconcileStrategy is changed (from ChartVersion to Revision for
example), we should update the HelmChart.

Signed-off-by: Dylan Arbour <arbourd@users.noreply.github.com>
2021-10-09 21:50:54 -04:00
Hidde Beydals c079240190 Introduce ReconcileStrategy in HelmChartTemplateSpec
To allow configuring it within the `HelmRelease`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 13:19:55 +02:00
Stefan Prodan e9d31e9f1f
Make the kubeconfig secrets compatible with SOPS
Add `values.yaml` to the supported kubeconfig secret key names in order for SOPS to correctly detect the storage format based on the file extension.

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-04 16:22:09 +03:00
Sunny 91eb550b19
Remove old util ObjectKey
Replace old utility function ObjectKey with controller-runtime's
client.ObjectKeyFromObject.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2021-08-01 03:40:10 +05:30
Zhongcheng Lao 0ceec2d3fc
Add test case for set with boolean value and set-string behavior
Signed-off-by: Zhongcheng Lao <Zhongcheng.Lao@microsoft.com>
2021-07-23 08:30:47 +08:00
Zhongcheng Lao c0f72e1fc6
Treat quoted values as string when targetPath is set
Signed-off-by: Zhongcheng Lao <Zhongcheng.Lao@microsoft.com>
2021-07-17 16:42:32 +08:00
Dylan Arbour da3186716f Add `ValuesFiles` to HelmChart spec
Signed-off-by: Dylan Arbour <arbourd@users.noreply.github.com>
2021-04-19 10:50:17 -04:00
Hidde Beydals 314472efb7 Capture (debug) logs from Helm actions
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-03-25 16:08:52 +01:00
Somtochi Onyekwere a9e6820999 Record suspension metrics
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-03-17 14:30:09 +01:00
Hidde Beydals 39e6475822 Revert "Record suspend metrics"
https://github.com/fluxcd/helm-controller/pull/234#issuecomment-801000679

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-03-17 13:24:29 +01:00
Somtochi Onyekwere 8b2ba595bf Record suspend metrics
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
2021-03-16 23:45:50 +01:00
Max Jonas Werner 199636f27a
fix: log messages contain '%s'
Before:

{"level":"info","ts":"2021-03-03T12:45:41.305Z","logger":"controller.helmrelease","msg":"could not find optional %s '%s'","reconciler group":"helm.toolkit.fluxcd.io","reconciler kind":"HelmRelease","name":"cert-manager","namespace":"kommander","ConfigMap":{"namespace":"kommander","name":"cert-manager-overrides"}}

After:

{"level":"info","ts":"2021-03-03T13:56:46.365+0100","logger":"controller.helmrelease","msg":"could not find optional ConfigMap 'kommander/cert-manager-overrides'","reconciler group":"helm.toolkit.fluxcd.io","reconciler kind":"HelmRelease","name":"cert-manager","namespace":"kommander"}

Signed-off-by: Max Jonas Werner <mwerner@d2iq.com>
2021-03-03 13:57:51 +01:00
Stefan Prodan a8dcafaf2e
Retry with exponential backoff when fetching artifacts
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-26 13:37:45 +02:00
Dylan Arbour 368ca98306 Update pkg/runtime to v0.8.2
pkg/runtime v0.8.2 introduces runtime/transform which includes
`MergeMaps`:
https://github.com/fluxcd/pkg/pull/85

Signed-off-by: Dylan Arbour <arbourd@users.noreply.github.com>
2021-02-15 18:10:19 -05:00
Will Salt 7156abcadf Send specific events for install or upgrade
Signed-off-by: Will Salt <williamejsalt@gmail.com>
2021-02-15 17:20:54 +00:00
Will Salt fcd845c952 add a release deployment event when reconciling a release
Signed-off-by: Will Salt <williamejsalt@gmail.com>
2021-02-15 16:36:19 +00:00
Stefan Prodan 7873fe2022
Add contributing doc
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-15 15:18:24 +02:00
Stefan Prodan fc18a045a6
Allow the controller to be run locally
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-02-14 12:10:56 +02:00
Hidde Beydals dcf0d93e84 Add tests for Kustomize post renderer
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-04 09:34:56 +01:00
Hidde Beydals 622a87a663 Depend on the Kustomize API from `fluxcd/pkg`
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-02-03 20:02:19 +01:00