Files
cozystack/pkg
Andrey Kolkov 5795b5f658 feat(workloadmonitor): report failed Jobs that opt in as not operational
Some charts run work that matters to the workload in a Job outside the Helm
release, such as an index repair after an image upgrade. Once the release has
applied, Ready stays True whatever that Job does, so a failed run was visible
only to someone who went looking for the Job.

A Job that carries a monitor's selector labels and
workloads.cozystack.io/report-failure set to "true", and has Failed=True, now
makes the monitor not operational with reason JobFailed and a message naming
the Job and its failure, which the Application surfaces as
WorkloadsReady=False. The opt-in is explicit because the selector labels
alone are carried by Jobs that say nothing about the workload's health: Jobs
an operator labels by inheritance from the workload, such as CloudNativePG's
initdb and join Jobs under the postgres chart, and backup runs. Of the Jobs
one controller owns only the newest counts, because a CronJob keeps failed
runs in its history after a later run succeeds; a Job that is deleted or
replaced by a successful run clears the verdict.

A DataVolume verdict still comes first, since its stored value is kept across
restarts until the DataVolumes can be read again. A failed Job outranks an
unprovisioned BucketClaim: it stays failed until something replaces it, while a
claim is usually still being provisioned.

The manager caches only Jobs that carry the opt-in label, and of them only
their metadata and conditions. The controller's ClusterRole already grants
read on every resource.

Refs: #5459
Assisted-By: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-11-30 13:42:03 +07:00
..
2026-11-24 23:06:02 +01:00