Commit Graph

57 Commits

Author SHA1 Message Date
Sunny 74e33a70c4 Delete stale metrics on object delete
Use the metrics helper to record all the metrics. Metrics helpers
ensures that the metrics for deleted objects are deleted as well.

Move all the metrics recording to be performed at the very end of the
reconciliation. Realtime metrics for readiness is no longer recorded as
it will be removed in a future version for CRD metrics collected using
kube-state-metrics. Updating the object status with realtime readiness
should provide the readiness to CRD metrics watchers.

`HelmReleaseReconciler.reconcileDelete()` is modified to receive a
pointer HelmRelease object so that any modifications on the object is
reflected on the object instance that's passed to the metrics recorder.
This is not needed for `HelmReleaseReconciler.reconcile()` as it returns
a new copy of the object that's saved in the same object variable,
overwriting the object instance with the updates.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2023-08-15 02:42:09 +05:30
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
Carlos Sanchez ee3f232fd8
chore: fix typo reconcilation
Signed-off-by: Carlos Sanchez <carlos@apache.org>
2023-07-14 19:22:25 +02:00
Aurel Canciu 7c75fc4d3d
Fix HelmRelease reconciliation loop
Likely after the upgrade to controller-runtime v0.15.0 a regression
surfaced for long-running reconciliations of HelmRelease resources (e.g.
for charts having pre-upgrade hooks taking a few minutes to complete).
This regression would cause the controller to immediately re-run the
upgrade after a successful upgrade, thus entering an almost-endless
loop.

Apparently, the only fix to this issue is to ensure
`.Status.LastReleaseRevision` is updated as soon as possible in the
reconiliation cycle rather than wait for the update at the end of the
cycle.

Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2023-06-20 14:52:50 +03:00
Hidde Beydals 2ea7393629
Include revision and token in event metadata
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-31 13:01:50 +02:00
Hidde Beydals 4df753a1f1
Use last attempted values checksum as event metadata token
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-24 14:23:11 +02:00
Hidde Beydals d345af0e73
Rename controllers to controller
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-05-24 11:05:53 +02:00