Commit Graph
5676 Commits
Author SHA1 Message Date
Aleksei Sviridkin fd1c38e195 fix(postgres): run the collation repair outside the Helm hook (#5479)
Refs #5459 (item 3: "Waiting for rollout eats Job budget").

**Depends on #5505.** Merge #5505 first or together with this PR. Here a
failed repair no longer fails the HelmRelease. #5505 makes the
WorkloadMonitor report the failed repair Job as `WorkloadsReady=False`
with reason `JobFailed`. Without it the failure shows only on the Job
itself.

Moving tenant PostgreSQL to another image (for example bullseye `17.7`
to `17.12-standard-trixie`) fails the first Helm upgrade of every
release whose clients keep sessions open. The collation repair at the
end of the post-upgrade init-job waits for CNPG to move the primary to
the new image. CNPG rolls the primary last, and every instance spends up
to `smartShutdownTimeout` (180 s) in smart shutdown, so the wait uses up
the init-job's 540 s deadline and the HelmRelease goes `UpgradeFailed`
until Flux retries. When the repair instead meets the primary restart,
psql fails with `FATAL: the database system is shutting down` and the
upgrade fails the same way.

The one commit moves the repair out of the hook. A short
post-install/post-upgrade hook, run after the init-job, creates a
`<release>-collation-repair` Job through the API (outside the release,
so helm-controller does not wait for it) and returns. That Job keeps the
OID mark / fingerprint resume and the in-place attempt records. It waits
for the new image whenever the image changes, not only when an index
already depends on a versioned collation: a plan built on the previous
primary would miss an index created meanwhile, which the release
recorded at the end would then claim as repaired. In the hook that wait
was too expensive to make unconditional. The Job gets an hour, is owned
by the Cluster, and its fixed name keeps two repairs from running at
once. It carries the WorkloadMonitor's selector labels plus the opt-in
`workloads.cozystack.io/report-failure: "true"` from #5505, and has no
`ttlSecondsAfterFinished`, so a failed repair stays until the next
upgrade replaces it (see the proposal in #5459). Both Jobs now rerun
their idempotent script on psql exit status 2 (connection refused or
dropped) with backoff instead of failing.

Decisions for reviewers:

- **Repair failures no longer fail the HelmRelease.** A repair that
cannot finish (for example duplicates under a UNIQUE index) shows up as
a Failed `<release>-collation-repair` Job and its log, kept until the
next upgrade starts a new run. The next upgrade retries it. Before, it
showed up as `UpgradeFailed`.
- **The repair also runs after install.** The install-time init-job used
to record which Debian release each database starts on. Without that
record, a cluster whose first upgrade moves the image would have its C.*
indexes rebuilt only if the repair reached the primary before it
restarted. On a fresh cluster the run only writes that record. The Job
sets `PGCONNECT_TIMEOUT=10`.
- **A failed rebuild no longer holds back the PostGIS update.** The
update runs after the collation pass whatever it found, and the Job
still fails at the end if a rebuild failed.
- **The e2e upgrades twice.** The second upgrade finds the first repair
Job complete on the same image, and the test waits for its replacement
to complete.
- **Lock waits are bounded by the Job's remaining hour, not about 8
minutes.** This is harmless for `REINDEX CONCURRENTLY`. For the in-place
rebuild of an exclusion-constraint index, writers to that table can
queue behind its lock wait for longer. Capping it separately means
touching the per-index code that the parallel PRs on #5459 also edit, so
I left it out.
- **The hook's Role** has `get`/`delete` on the repair Job and `get` on
the release's Cluster, both by `resourceNames`. It also has `create` on
jobs, which RBAC cannot narrow by name. The SA, Role and RoleBinding are
deleted once the hooks succeed.
- **Verified under Flux.** helm-controller v1.5.0 runs the post-upgrade
hooks about a second after it patches the Cluster, without waiting for
the rollout. The rollout therefore no longer counts against the release
timeout. Details in the PR thread.

Rebased onto main after #5477 and #5485. The PostGIS extension update
from #5477 waits for the same rollout, so it moves into `repair.sh`
after the collation pass; left in the init-job, it would bring the
hook-budget problem back for postgis clusters. Every message about a
repair or update that did not finish says that the next upgrade of the
release starts it again. The starter and the repair Job take their names
from one base, which stays distinct and within 63 characters for any
release name.

- `helm unittest packages/apps/postgres`: 32 suites, 257 tests pass,
including a new `collation_repair_test.yaml`. It checks gating (upgrade
only, skipped while bootstrap is on), hook order after the init-job, the
Role rules, RBAC removal on success, name length, and the init-job
command.
- Docker, with the rendered `run.sh` + `repair.sh` against
`postgres:17-bullseye` and stale ICU / en_US collations:
- Killing the `REINDEX INDEX CONCURRENTLY` backend mid-rebuild made the
pass exit 2. `run.sh` reran it, the already rebuilt index was skipped by
the OID mark, and the other index was rebuilt. amcheck was clean and the
versions were refreshed.
- With the server stopped before the first connection, the script
retried with 5 s and 10 s pauses and finished once the server came back.
  - An SQL error exits 1 and is not retried.
- dev7 (cozystack v1.7.0): two 3-instance v17 releases installed from
v1.7.1 (bullseye `17.7`), with ICU and en_US UNIQUE indexes on 200k rows
and `pg_sleep(3600)` sessions held on `-rw` and `-ro`. Both were
upgraded with `helm upgrade --timeout 10m`:
- origin/main: the init-job waited for `PostgreSQL 17.12 pgdg13`, hit
`DeadlineExceeded`, and the command failed with `UPGRADE FAILED:
post-upgrade hooks failed: resource Job/tenant-root/rr-main-init-job not
ready. status: Failed` (exit 1 after 611 s).
- This branch: exit 0 after 70 s (init-job 9 s, starter 10 s, starter
RBAC removed afterwards). The repair Job waited out the rollout and
rebuilt `t_u` and `t_k`. Collation versions were refreshed to `2.41` /
`153.128`, `bt_index_check(..., true)` passed on all three instances,
and the resume mark was reset.
- A second upgrade replaced the finished repair Job, and the rerun found
nothing to do.
- The rebuild sat in `waiting for old snapshots` behind the test
client's open transaction. That is expected for `REINDEX CONCURRENTLY`;
I ended that session to finish the run.

Walked against the diff (the new template, test and init-script/init-job
changes in `packages/apps/postgres`). The diff changes no values,
schema, `ApplicationDefinition`, Secret or Service names, package
layout, or tooling. The only new objects are a hook-scoped
ServiceAccount/Role/RoleBinding/Job and a Job created at runtime, which
no listed repository refers to.

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

- Flux (dev cluster, helm-controller v1.5.0): a tenant app on the v1.7.0
chart (bullseye `17.7`, 3 instances, sessions held on `-rw`/`-ro`) was
upgraded by switching the platform's postgres chart.
- With this PR, the HelmRelease reached `UpgradeSucceeded` in 21 s, and
the repair Job finished after the rollout with `bt_index_check` clean on
all instances.
  - With main, the upgrade took 7 min 06 s of the 10-minute timeout.
- Docker: the rendered `repair.sh` for the postgis flavor moved PostGIS
3.6.1 → 3.7.0 after the collation pass. A tenant trigger on
`spatial_ref_sys` did not run.

```release-note
[postgres] An image change of a tenant PostgreSQL no longer fails the Helm upgrade while CNPG rolls the instances. The collation repair now runs in a separate `<release>-collation-repair` Job, started after each upgrade, which waits for the new image and retries after connection drops. Check that Job's status and log to confirm the repair finished.
```

release-1.6 has no postgis flavor, so the PostGIS extension update that
follows the collation pass in repair.sh on main is not carried over, and
repair.sh ends with the collation pass's own exit status; nothing in the
chart reads .Values.flavor. It has no adopted-restore record either, so
the step that writes one, which the split moved to the end of init.sh on
main, is not carried over. The init-job comment no longer describes the
collation pass, which left that Job here, and says what JOB_DEADLINE
bounds there now: the reruns of run.sh.

(cherry picked from commit c8ffc87717)
Assisted-By: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-12-02 15:31:46 +07:00
Aleksei Sviridkin 7c55a5e5fe feat(workloadmonitor): report failed Jobs that opt in as not operational (#5505)
## What this PR does

Refs #5459

A chart that runs workload-critical work in a Job outside its Helm
release has no way to report a failed run on the Application today:
`Ready` mirrors the HelmRelease, which is already applied, and
`WorkloadsReady` only looks at pods, PVCs, Services, BucketClaims and
DataVolumes. The immediate case is #5479, where the postgres collation
repair and PostGIS update move out of a blocking hook into a Job started
outside the release. If that Job fails (duplicates under a UNIQUE index,
a PostGIS update that does not go through), the indexes stay wrong while
the Application shows `Ready=True` and `WorkloadsReady=True`.

This PR implements the proposal in
https://github.com/cozystack/cozystack/issues/5459#issuecomment-7268007229
by adding a generic rule to the WorkloadMonitor controller: a `batch/v1`
Job in the monitor's namespace that carries the monitor's selector
labels plus `workloads.cozystack.io/report-failure: "true"`, and has
`Failed=True`, makes the monitor not operational, with reason
`JobFailed` and a message such as `Job postgres-x-collation-repair
failed: BackoffLimitExceeded: Job has reached the specified backoff
limit`. cozystack-api passes it through unchanged as
`WorkloadsReady=False` with that reason and message. The rule knows
nothing about postgres: a chart opts a Job in explicitly with that
label. A Job with only the selector labels, which every chart and every
operator inheriting labels from the workload may carry, never affects
the monitor. The postgres side (the labels on the repair Job, no
`ttlSecondsAfterFinished`) lands on #5479.

Behaviour:

- A Job that is deleted, or replaced by a run that does not fail, clears
the verdict. Of the Jobs one controller owns, only the newest counts, so
a CronJob's failed run that stays in its history after a later success
does not keep the monitor down.
- The message lists failed Jobs sorted by name, at most three, then `N
more Jobs failed`.
- Precedence: a DataVolume verdict comes first (unchanged; its stored
value is kept while DataVolumes cannot be read), then `JobFailed`, then
`BucketClaimNotReady`. `minReplicas` still sets `Operational=false`
without a reason, so a failed Job beside too few replicas reports
`JobFailed`.
- Jobs are watched and mapped to monitors the same way pods are. The
manager caches only Jobs that carry the opt-in label, with a transform
that keeps only metadata (labels, owners, timestamps) and conditions.
- RBAC: a `+kubebuilder:rbac` marker for `jobs.batch` get/list/watch
documents the need. The markers under `internal/controller` do not
generate YAML, and the cozystack-controller ClusterRole in
`packages/system/cozystack-controller/templates/rbac.yaml` already
grants get/list/watch on every resource, as it does for pods, PVCs,
BucketClaims and DataVolumes, so the chart needs no change.

No chart sets the opt-in label yet, so nothing reports until a chart
adopts it. The postgres chart sets the selector labels in the Cluster's
`inheritedMetadata`, so CNPG's initdb and join Jobs carry them; without
the opt-in they are ignored, as are backup CronJob runs and any other
labelled Job.

### Testing

- `go build ./...`, `go vet` on `./internal/controller/`,
`./cmd/cozystack-controller/`, `./api/v1alpha1/`: clean.
- `go test ./internal/controller/... ./pkg/registry/apps/application/...
./api/...`: pass.
- New unit tests (fake client): a failed Job sets `Operational=false`,
reason `JobFailed` and the message; a succeeded, running, `Failed=False`
or other-selector Job, and a failed Job without the opt-in label or with
it set to anything but `"true"`, has no effect; a failed Job deleted or
replaced by a successful run clears the verdict; a stale `JobFailed` is
cleared before the DataVolume reader is installed; precedence against
`minReplicas`, an unprovisioned BucketClaim and a DataVolume verdict;
message sorting, the three-Job bound, newest-run-per-controller and Jobs
being deleted; the cache transform keeps what the rule reads.
cozystack-api: a monitor with `JobFailed` yields `WorkloadsReady=False`
with that reason and message.
- `make generate`: no changes.
- Not run against a cluster: the Job watch and the transformed cache
were not exercised end to end.

### Downstream repositories

Walked the trigger map against the diff
(`api/v1alpha1/workloadmonitor_types.go` constant only, no CRD schema
change; `internal/controller`; `cmd/cozystack-controller`; tests). No
package, platform values, ApplicationDefinition, installer, hack
tooling, telemetry or commit-convention change.

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
feat(workloadmonitor): a failed Job that carries a WorkloadMonitor's selector labels and `workloads.cozystack.io/report-failure: "true"` now makes the workload not operational, so the Application reports `WorkloadsReady=False` with reason `JobFailed` and a message naming the Job and its failure. Deleting the Job, or a later run that does not fail, clears it.
```

On release-1.6 the WorkloadMonitor status has only operational, with no
reason or message, and adding them is a CRD change a patch release does
not take. Only the rule is ported: a Job in the monitor's namespace that
carries the monitor's selector labels and
workloads.cozystack.io/report-failure: "true" and has Failed=True makes
the monitor not operational, counting only the newest Job per
controller owner, with the Job cache filtered by that label and
stripped by the transform. The application then shows
WorkloadsReady=False with the generic WorkloadMonitorCheck reason
instead of JobFailed; the failed Jobs are named in the controller log.
The JobFailed reason constant, the status precedence against BucketClaim
and DataVolume verdicts (1.6 has neither as a status cause) and the
registry test are not carried over, and the tests assert operational
instead of reason and message.

(cherry picked from commit 23b94d6d1a)
Assisted-By: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-12-02 15:31:45 +07:00
Aleksei Sviridkin 653d29f1a2 fix(postgres): rebuild indexes on C.UTF-8 when the Debian release changes (#5478)
Refs #5459 (item 1: `C.UTF-8` is not repaired and nobody is warned).

After the move to the `-standard-trixie` operand images, an index on a
`COLLATE "C.UTF-8"` column, or any text index in a database created with
`LC_COLLATE 'C.UTF-8'`, is silently corrupt: Debian bullseye's patched
`C.UTF-8` and the glibc 2.35+ `C.UTF-8` order characters differently,
but PostgreSQL records no collation version for `C.*` locales, so the
collation repair in the init Job never selected those indexes. On
PostgreSQL 15+ there was not even a warning. Lookups through such an
index miss rows, and a unique index on it stops seeing duplicates.

One commit. The repair pass now treats libc `C.<codeset>` collations,
and a libc `C.<codeset>` database default, as versioned by the Debian
release of the server's build (the `pgdgNN` suffix of `server_version`).
Their indexes then go through the existing resumable rebuild path (OID
mark, in-place handling for exclusion constraints, `_ccnew` leftovers,
unique-duplicate failure reporting), which this PR leaves unchanged.
Because PostgreSQL stores nothing to compare with, the release each
database was last repaired for is stored in a new per-database setting,
`cozystack.collation_release`, next to the existing
`cozystack.collation_repair`:

- a database without the setting gets the release of the server the pass
first sees it on. The pass looks before it waits for the rollout, so the
old release is persisted even if that run fails, and a retry that runs
after the primary restarted still rebuilds;
- if the server already runs the new glibc when the pass first sees the
database, a libc collation whose recorded version differs from the
server's (`en_US.utf8` 2.31 vs 2.41, present in every database created
from these images) marks it as not repaired for any release;
- otherwise (a new cluster, a database added later) the current release
is recorded and nothing is rebuilt;
- the setting is updated to the current release only when the database
is repaired without failures.

The PG<15 warning `database ... uses the locale C.UTF-8, for which this
PostgreSQL major records no collation version ...` no longer fires for
`C.*` locales, since those are now repaired. The range-partition warning
says for a `C.*` key that it is reported only once, instead of claiming
that a collation version was left as recorded.

The e2e postgres suite now also sets another release on its database,
creates a unique `C.utf8` column, and checks that the upgrade rebuilds
that index, that amcheck passes on it, and that the setting ends at the
server's release.

The change stays inside the `== refresh collation versions` SQL prelude
and its final block. It does not touch the rollout wait, the per-index
rebuild session or the extension section, which other open fixes for

A cluster where a pass without this change already ran on the new glibc
(v1.7.2-rc.1, or `main` since #5405) has already refreshed its libc
collation versions, so no trace of the move is left. This pass then
records the current release for it and does not rebuild its `C.*`
indexes. Rebuild those by hand with `REINDEX INDEX CONCURRENTLY` (or
`REINDEX DATABASE`), as the release note says.

description to rebuild indexes on `C.UTF-8` by hand. This PR merges
second, so it drops that sentence from `values.yaml`, `types.go`, the
README, the schema and the cozyrd: the init Job now rebuilds those
indexes itself.

Docker, no Kubernetes: data written on
`ghcr.io/cloudnative-pg/postgresql:17.7` / `13.22` (bullseye, glibc
2.31, `pgdg11`), then the same data directory started on
`17.12-standard-trixie` / `13.22-standard-trixie` (glibc 2.41,
`pgdg13`). The repair section was rendered with `helm template`,
extracted from the init-script Secret, and run from a container of the
trixie image with the env the Job sets (`PGHOST`, `PGUSER`,
`JOB_DEADLINE`). Data: 200,000 distinct keys mixing ASCII punctuation,
`é`, U+FFFD, U+FFFF, U+1D400 and U+1F600. Tables: a `UNIQUE` column
`COLLATE "C.UTF-8"`, an `en_US.utf8` column, a plain `C` column, and a
`cutf8db` database with `LC_COLLATE 'C.UTF-8'`.

| Scenario | Result |
| --- | --- |
| Pass from `main`, PG17 and PG13 | rebuilds only the `en_US.utf8`
index; `t_c_k_key`: `item order invariant violated`, 178,162 of 200,000
keys not found; `cutf8db.t_d_k`: 179,426 not found |
| This PR, Job starts on bullseye, server then restarts on trixie (PG17,
PG13) | `pgdg11` recorded while waiting; `C.UTF-8` column index,
`C.UTF-8` database default index and `en_US.utf8` index rebuilt; amcheck
ok, 0 misses; plain `C` index keeps its OID |
| This PR, first run times out waiting for the rollout, retry after the
restart (libc versions refreshed by hand in between so only the
persisted release can trigger) | retry rebuilds both `C.*` indexes;
amcheck ok, 0 misses |
| This PR, server already on trixie at first run | detected through the
stale libc collation versions; both `C.*` indexes rebuilt |
| Second and third run | nothing rebuilt, setting stays `pgdg13` |
| New cluster created on trixie | nothing rebuilt, `pgdg13` recorded |
| Range partitions on `C.UTF-8` and on `en_US.utf8` | partition indexes
rebuilt once; the `C.*` partition warned once; later runs rebuild
nothing |

`helm unittest packages/apps/postgres`: 31 suites, 247 tests passed.

Dev cluster (cozystack v1.7.0):

- Setup: an app installed from the v1.7.1 chart (`postgresql:17.7`,
bullseye, 2 instances). In `appdb`, a `UNIQUE` column `COLLATE
"C.UTF-8"` with 50,000 keys built from ASCII letters and punctuation,
`é`, U+FFFD, U+1D400 and U+1F600.
- `helm upgrade` to this branch passed on the first attempt. The init
Job logged `rebuilding index public.t_c_k_key in database appdb: its
collation changed version`.
- Afterwards:
  - the Cluster runs `17.12-standard-trixie`;
  - the index OID changed (16424 → 16507);
- `bt_index_check(t_c_k_key, true)` is clean on the primary, on the
replica and through `-ro`, with 0 lookup misses;
  - `cozystack.collation_release` is `pgdg13`.
- A second upgrade rebuilt nothing.

The extended chainsaw e2e step has not run yet, so CI will be its first
run.

Docker, with the rendered repair pass run against
`17.12-standard-trixie` and `UNIQUE` columns `COLLATE "C.utf8"`:

- A database with no recorded release and a stale libc collation
(`CREATE COLLATION ... (provider = libc, locale = 'en_US.utf8', version
= '0')`): the index is rebuilt and `pgdg13` is recorded.
- A database whose only stale piece is its libc default collation
(`datcollversion` changed): the index is rebuilt, and `pgdg13` is
recorded.
- A fresh database: nothing is rebuilt, and `pgdg13` is recorded.
- A second run rebuilds nothing.

The e2e suite now also covers a database with no recorded release, the
state every existing cluster starts from. That database holds a stale
`en_US.utf8` libc collation and a `UNIQUE` column on `C.utf8`, and the
test asserts the new index OID, `bt_index_check`, and the recorded
release. A libc collation on locale `C` with an explicit version cannot
serve as the probe: `ALTER COLLATION ... REFRESH VERSION` refuses to
move it to the NULL version of a `C` locale.

- [ ] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

The diff touches only
`packages/apps/postgres/templates/init-script.yaml` and the postgres e2e
test. No values, schema, README, API or CRD change, so none of the
generated reference docs move. Boxes are left empty for a maintainer to
decide: the website may describe the trixie move and its collation
repair in upgrade notes, and if it lists which collations get repaired,
`C.UTF-8` should be added there. I did not check that.

```release-note
[postgres] The init Job now also rebuilds indexes on libc `C.UTF-8` (and other `C.<codeset>`) collations, and on databases whose default collation is such a locale, when the server moves to an image built on another Debian release. PostgreSQL records no version for these collations, so before this fix such indexes stayed corrupt after the move to the standard-trixie images, with no warning. The Debian release each database was repaired for is kept in the `cozystack.collation_release` database setting. A cluster that already ran the previous repair on a trixie image (v1.7.2-rc.1 or a `main` build since the move) is not recognised: rebuild its indexes on `C.*` collations by hand with `REINDEX`.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

* **Bug Fixes**
* PostgreSQL collation repair now detects changes affecting
`C.<codeset>` collations across PostgreSQL build releases, including
cases where PostgreSQL does not record collation versions. Affected
indexes are identified and rebuilt during repair.
* Partition-related warnings clarify when collation changes can or
cannot be detected. After repair, the process records the PostgreSQL
release to help identify when a later repair may be needed.
* **Documentation**
* Updated `allowCollationChange` guidance to explain that the
initialization process rebuilds indexes for `C.UTF-8` and other `C.*`
locales, removing the instruction to rebuild those indexes manually.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

(cherry picked from commit 0f84f1c8dc)
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-12-02 15:31:45 +07:00
Aleksei Sviridkin df12079583 fix(postgres): keep bullseye clusters on their image until a clean locale check (#5472)
## What this PR does

Refs #5459. Part of bringing #5405 (standard-trixie images) back to
release-1.7, which #5461 reverted. This PR covers the `C.UTF-8` item of
#5459 by keeping such clusters off the new image. The other items are
fixed separately: the repair racing the rollout and the Job budget, the
repair skipping `C.UTF-8`, the double REINDEX, and the postgis extension
update.

### Why

Clusters created before #5405 run a bare tag, the system variant on
Debian bullseye. Moving them to `standard-trixie` changes glibc and ICU
under the data directory. The collation repair pass from #5405 cannot
see every case. A libc `C.*` locale such as `C.UTF-8` carries no
collation version in any PostgreSQL major, yet Debian bullseye's
`C.UTF-8` and the one in glibc 2.35+ sort differently. Until the indexes
are rebuilt, replicas return wrong results through `-ro` and unique
indexes accept duplicates. PostgreSQL ([Locale data
changes](https://wiki.postgresql.org/wiki/Locale_data_changes)) and
CloudNativePG
([postgres-containers](https://github.com/cloudnative-pg/postgres-containers):
switching the Debian base "is a manual operation because of PostgreSQL
locale-data implications") both treat this as a deliberate, owner-driven
step.

### What it does

A cluster on one of the bare bullseye tags the chart shipped (13.22,
14.20, 15.15, 16.11, 17.7, 18.1) stays on its image until a check finds
it clean. The check fails closed: a cluster not checked yet, one the
check could not finish on, and one it found affected all stay.

- **The check.** A `pre-upgrade` hook (`locale-check-<release>-<hash>`)
runs before every upgrade of such a cluster, from the cluster's current
image.
- It looks in every database for columns, indexes, composite or range
types, and `jsonb` indexes that depend on a collation other than C,
POSIX or builtin, and for a database default (collate or ctype) outside
those.
- It records `clean`, `affected` or `unknown` in the
`postgres.cozystack.io/locale-data` annotation of the Cluster, and the
first objects found in `postgres.cozystack.io/locale-data-objects`.
  - Its Role can only `get`/`patch` that one Cluster.
- **What the chart renders.** The chart reads the recorded answer
through `lookup`. Helm renders before hooks run, so the hook fails an
attempt only when the new answer contradicts that render, before the
Cluster is patched. The HelmRelease retry then renders according to the
new answer:
- A cluster not checked before, or found `affected` or `unknown`, is
rendered on its current image. The upgrade passes, and every other value
of the app still applies.
- A cluster found `clean` fails that attempt once, and the retry moves
it to `standard-trixie` with the existing repair.
- **Opt-in.** `allowCollationChange: true` moves a held cluster on the
next upgrade, in a window the owner picks.
- **Version changes.** A held cluster refuses a change of `version` with
an explicit render error, since new majors are built only on the new
images.
- **Restore.** The CNPG backup driver copies the source Cluster's
`spec.imageName` into the backup snapshot verbatim, passes it to the
restore as `bootstrap.sourceImageName`, and clears it with
`bootstrap.enabled`. The core controller knows nothing about the chart's
hold rules.
- The chart decides: a backup taken on one of the bullseye tags restores
onto that image, so the data keeps the library that built it.
- The next upgrade then checks the restored data like any other bullseye
cluster.
- Any other value is ignored, so a tenant cannot choose an image through
it.
- The driver also reads the major from that image tag when the backup
recorded none, and refuses a mismatch with `spec.version` before the
purge.

### What a held cluster is left with

- It keeps running its bare bullseye tag. Upstream builds new PostgreSQL
minors only on bookworm and trixie, so a held cluster gets **no further
minors and none of their security fixes; CVE-2026-116331 stays open on
it** for as long as it is held.
- The tenant sees only that the image did not change. The answer and the
objects found are on the cnpg.io Cluster, which only an administrator
can read.
- There is no deadline. The hold lasts until the owner takes one of the
ways out below.

### How a held cluster leaves that state

1. **Remove the dependency.** Move the listed columns and indexes to
`C`, or to the builtin `pg_c_utf8` on PostgreSQL 17 and later, or drop
them. The next upgrade checks again, finds the cluster `clean` and moves
it.
2. **Move explicitly.** In a maintenance window, set
`allowCollationChange: true`. The next upgrade moves the cluster and the
init Job's repair rebuilds indexes on versioned collations (ICU, libc
locales other than `C.*`). Until the separate `C.UTF-8` repair fix
lands, rebuild indexes on `C.UTF-8` or another `C.*` locale by hand with
`REINDEX INDEX CONCURRENTLY`. Range partitions, CHECK constraints and
materialized views on such text are not fixed by a rebuild and need a
logical move (pg_dump/restore or logical replication). During the move,
replicas restart on the new image first, so reads through `-ro` can be
wrong and unique indexes can accept duplicates until the primary's
rebuild is done.

### Testing

- `helm unittest packages/apps/postgres`: 276 passed, including
`tests/locale_guard_test.yaml`. It covers:
- holding on `affected`, `unknown` and a missing result, and moving on
`clean`;
  - the opt-in and the version refusal;
- restores from bullseye and trixie backups, hand-set recoveries, and
leftover values;
- ignoring foreign images, postgis, hook gating, naming and the Role
scope.
- `go test ./internal/backupcontroller/...` passes, including
`cnpg_source_image_test.go` and the restore reconcile cases for passing
the image on and refusing the held major before the purge.
- The check script was run in Docker against `postgres:13-bullseye` and
`postgres:18-bookworm`:
- It flags `C.UTF-8`/`C.utf8` columns and defaults, ICU indexes, `en_US`
defaults with text, a `C`-collate / `en_US`-ctype database with a
`lower()` index, composite and range types over text, and `jsonb`
indexes under a non-C default.
- It reports `clean` for `C`, `POSIX`, `pg_c_utf8` and `ucs_basic`, and
when another database is `default_transaction_read_only`.
- It reports `unknown` on an authentication failure or when a database
accepts no connections.
- The record step was run with a stub `kubectl` for each render (held or
moving) and answer:
- held + `clean` fails the attempt; held + `affected`/`unknown` passes;
- moving + `clean` passes; moving + `affected`/`unknown` fails the
attempt;
  - every answer is recorded.
- Dev cluster: apps installed from the v1.7.1 chart (`postgresql:17.7`,
bullseye) and upgraded to this branch (results in the PR thread).

### Screenshots

### Downstream repositories

The trigger map hits `cozystack/terraform-provider-cozystack`, because
this adds `allowCollationChange` and `bootstrap.sourceImageName` to the
postgres `values.schema.json`. The follow-up is
cozystack/terraform-provider-cozystack#91.

- [ ] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [x]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up: cozystack/terraform-provider-cozystack#91
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
[postgres] A cluster still on a Debian bullseye image now stays on that image until a pre-upgrade check finds nothing in it that depends on a collation other than C, POSIX or builtin (an ICU or libc locale, or C.UTF-8), or until `allowCollationChange` is set. A held cluster gets no further PostgreSQL minors or their security fixes. The `postgres.cozystack.io/locale-data` annotation of the cnpg.io Cluster shows the result of the check.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

- **New Features**
- PostgreSQL upgrades from older Debian Bullseye images now check for
collation-dependent data and hold the current image when results are
affected or unknown.
- Added an opt-in setting to allow the image change despite the
collation check. Review collation and index-rebuild considerations
before enabling it.
- PostgreSQL restores retain source-image information to support image
selection and compatibility checks.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

On release-1.6 the CNPG backup driver predates the backup destination,
artifact-size, flavor and major-version changes this builds on on main,
so only the image handling is ported: the live Cluster's spec.imageName
goes into the backup snapshot and the restore passes it to the chart as
bootstrap.sourceImageName. The 1.6 driver never patches bootstrap.enabled
back to false after a restore and has no check of the backup's major
against spec.version, so there is nowhere to clear the value or to read
the major from the image; the next restore sets or clears it, and the
chart uses it only while no live Cluster exists. The cnpgtypes Cluster
spec gains the read-only imageName field, which main added with the
flavor record, and the unmarshal helper returns the snapshot struct, as
on main, so the restore can read the image. The tests for the destination and artifact size, and those for
the bootstrap clearing and the major, are not part of this line.

release-1.6 has no postgis flavor, so the flavor conditions in the hold
rules, the flavor guard, the postgis branch of the target image, the
flavor value and the postgis test case are not carried over.

(cherry picked from commit 9cf93b8535)
Assisted-By: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-12-02 15:31:37 +07:00
Aleksei Sviridkin 4ea048e466 fix(postgres): skip a stale index while another session builds on its table (#5485)
## What this PR does

Refs #5459 (item 4)

The collation repair pass in the postgres init Job rebuilds each stale
index in its own psql session: it picks the index by OID, takes its name
and runs `REINDEX INDEX CONCURRENTLY <name>`. A rebuild started by a run
that hit its Job deadline keeps going, because its backend only notices
the lost client when the rebuild ends. The next run then lines up behind
that orphaned rebuild on the table lock. Once the orphan swaps in the
new index, the name resolves to the new, already rebuilt index and the
run rebuilds it a second time, holding its table until the new run's own
deadline. On PostgreSQL 17 the waiting run can also deadlock with the
orphan in its final phase, and the deadlock detector then throws away
the orphan's finished build.

This PR skips an index while `pg_stat_progress_create_index` shows
another backend building an index of its table (same database, other
pid). The skip is reported the same way as a failed rebuild, so the run
exits non-zero and the next run carries on. That next run finds the new
index above the resume mark and treats it as done.

The check is the first statement of the session. It runs before the
index is looked up by OID and its name taken, with the table taken from
`pg_index` by that OID. A rebuild that ended before the check has
already removed the index the session looks for, so `present` skips it.
An orphaned backend never starts another statement after the check, so
it cannot swap the index in between. As a result the check also runs
before:
- the `_ccnew` leftover count, which a build in progress would otherwise
inflate (it owns one invalid `_ccnew` index);
- the in-place attempt record of an exclusion constraint's index, so a
skip never counts towards leaving that index to an operator.

The resume mark, the fingerprint, the `_ccnew` leftover rule and the
`lock_timeout`/`statement_timeout` bounds are unchanged.

A build that a live session starts after the check, in the moment before
REINDEX takes its lock, is not covered: SQL has no way to REINDEX by
OID. Only an operator or a tenant racing the Job could hit that window,
because an orphaned rebuild cannot start a new statement.

### Screenshots

Not a UI change.

### Testing

- `helm unittest packages/apps/postgres`: 31 suites, 247 tests passed.
- `helm template` renders. The only change in the rendered `init.sh`
compared with `main` is the new check.
- Ran the repair section of the rendered `init.sh` from `main` and from
this branch in Docker (`postgres:17-trixie`). Each init-job run was a
separate container on the same network as the database, the way the Job
pod and the Cluster are. A run "hit its deadline" by having its
container removed while its `REINDEX INDEX CONCURRENTLY` was in the
`building index` phase. The index was made stale by setting `collversion
= '0'` for `en-x-icu`. The build was slowed deterministically with an
expression index over an ICU column through an immutable function that
sleeps 1 ms per row (about 2.5 minutes per build).
- `main`: run 2 logged `rebuilding index public.t_k` and waited behind
the orphaned build. The deadlock detector then cancelled the orphan
after its full build (`Process 135 waits for ShareLock on virtual
transaction ...; blocked by process 175`), and run 2 rebuilt the index
from scratch, so the index was built twice. In the field report on
PostgreSQL 18 the orphan finished instead, and the waiting run rebuilt
the fresh index a second time.
- this branch (check first in the session): run 2 failed at once with
`index public.t_k in database postgres was skipped: another session is
building an index of its table ...` and exit 1. The orphan finished
alone and the index got a new OID. Run 3 rebuilt nothing, refreshed the
collation version, reset the repair setting and exited 0, with no
invalid indexes left.
- Exclusion constraint index (in-place path) on this branch: while
another session ran `CREATE INDEX CONCURRENTLY` on the same table, the
run skipped the index without recording an in-place attempt. The next
run rebuilt it in place (same OID, new relfilenode) and exited 0.

- Dev cluster (cozystack v1.7.0): this branch's chart with
`17.12-standard-trixie` and 2 instances. A table of 300k rows with the
slow expression index over `en-x-icu`, so a `REINDEX INDEX CONCURRENTLY`
took about 12 minutes. `en-x-icu` was marked stale with `collversion =
'0'`.
- Upgrade 1 started the rebuild (`rebuilding index public.t_k ...`). Its
init Job was deleted mid-build, and the backend kept building after the
Job was gone.
- Upgrade 2 while that build ran: the init Job failed at once with
`index public.t_k in database postgres was skipped: another session is
building an index of its table ...`, without queueing behind the lock.
  - The orphaned build finished alone (index OID 16453 → 16464).
- Upgrade 3: the init Job completed in 10 s with no `rebuilding` line.
The OID stayed 16464, the collation version was refreshed,
`cozystack.collation_repair` was reset, and no invalid indexes were
left.

### Downstream repositories

Walked the trigger map against the diff. The PR changes only
`packages/apps/postgres/templates/init-script.yaml` (SQL inside the init
Job script). It touches no values, schema, README,
ApplicationDefinition, package layout, `hack/`, platform keys or names
that any listed repository mirrors.

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
[postgres] The init Job's collation repair no longer rebuilds an index a second time, or deadlocks with a rebuild left running by an earlier run that hit its deadline; it skips an index while another session builds an index of its table, and the next run of the Job carries on.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Collation repair now detects when another session is building a
planned index and reports an error identifying the index and database.
The database’s repair failure is recorded, rather than proceeding to
inspect or rebuild the index during the concurrent operation. This makes
the conflict visible in the repair results.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

(cherry picked from commit 36af0b0110)
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-12-01 12:54:21 +07:00
Andrey Kolkov eaecde82ad fix(postgres): move tenant PostgreSQL to patched standard-trixie images
The chart pinned bare image tags, which are the system variant on Debian
bullseye. Upstream stopped building that variant, so the minors that fix
CVE-2026-116331 (18.7, 17.12, 16.16, 15.20, 14.25) are published for
bookworm and trixie only. The CVE is a type confusion in the min/max
aggregate optimisation that lets a role able to create objects run code
as the operating system user of the server, and tenants hold such roles.

Pin the patched minors on standard-trixie. The standard variant, because
backups go through the barman-cloud plugin and need none of the barman
binaries the system variant adds. trixie, because main is on it and
release-1.7 moves to it with the backport batch that carries this
change, so a 1.6 cluster that upgrades to such a 1.7 release does not
move its Debian release a second time. PostgreSQL 13 has no patched
release: it keeps 13.22 and moves to trixie with the rest.

For a running cluster this changes the Debian release under the data
directory. The init Job rebuilds the indexes that depend on a collation
whose library version changed.

release-1.6 has no postgis flavor, so its version map, its unit test and
the flavor guard are not carried over, and postgres.imageName has only
the postgresql branch.

(cherry picked from commit b40be51a6b)
Assisted-By: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-12-01 12:54:21 +07:00
Andrey Kolkov 34a50b6bfa fix(postgres): rebuild indexes whose collation changed version
An operand image built on another Debian release ships another glibc and
ICU. An index ordered by a collation of either library is then ordered by
rules the server no longer applies: lookups through it miss rows, and a
unique index stops seeing duplicates. PostgreSQL only logs a warning.

The init Job compares the library version each collation was created with
against the one the server reports, rebuilds the indexes that depend on a
collation whose version changed, and refreshes the recorded versions once
every rebuild in the database succeeded. A database on the C or POSIX
collation with no explicitly collated index, which is what the chart
creates by default, has nothing to rebuild and is not delayed.

The pass has to hold on a hook that starts while the instances are still
rolling, runs as the superuser in databases tenants own, and is retried
after a failure:

- It runs after the passes that manage roles and databases, so that a
  rebuild that fails costs none of them, and it waits for the server to
  report the PostgreSQL version and Debian release of its own image when
  an index depends on a versioned collation. The rebuild counter of the
  package is left out of that comparison, because a tag is rebuilt in
  place.
- Every session pins search_path to pg_catalog, so that a function or an
  operator a tenant defined in public cannot stand in for a built-in.
- A retry continues where the last run stopped. REINDEX CONCURRENTLY gives
  an index a new OID, so the highest OID seen when a repair begins marks
  what is left; an index rebuilt in place keeps its OID and is told apart
  by its storage file. Both live in a setting of the database.
- A rebuild that cannot finish is not started for ever: after two
  attempts the index is left to an operator, the pass says how to clear
  it, and the release stays failed until then. Lock waits and in-place
  rebuilds are bounded by what is left of the Job.
- A collation that a range partition key depends on keeps its recorded
  version, because rebuilding an index moves no row between partitions.

PostgreSQL records a collation for an index only where it orders a key,
so the collations of the columns an index reads in its expressions and
predicate count as well. Before PostgreSQL 15 the server records no
version for a database's default collation, and the libc collation of the
same locale stands in for it.

The e2e suite creates a collation with a stale version and checks that an
upgrade rebuilds a unique index and an exclusion constraint's index on it,
refreshes the version and removes the repair setting.

On release-1.6 the init Job had no deadline. It gets activeDeadlineSeconds,
backoffLimit 0 and a JOB_DEADLINE env that the pass bounds its waits by,
and the e2e lib gains HELMRELEASE_HISTORY_JSONPATH, which the new step
reads and main defines there.

(cherry picked from commit a10e449a56)
Assisted-By: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-12-01 12:54:21 +07:00
Aleksei Sviridkin d314cdb428 [Backport release-1.6] fix(ingress-nginx): pick up the nginx rebuild with the CVE fixes (#5506)
## What this PR does

Hand port of #5377 and #5436 to `release-1.6`. 1.6 still runs v1.11.2
controller, and its nginx has none of the fixes these two brought to
main and v1.7.2 (HTTP/2 CVE-2026-123633 and CVE-2026-123007, plus other
nginx CVEs the controller can reach, CVE-2026-97629 among them).
Backport batch parks both on this line because they build on #4549, the
v1.11.6 bump that never comes to 1.6 (see record in #5312), so this PR
switches the controller to the same image directly:
`v1.11.6-cozystack.3@sha256:059a75d56e567cbf12b4c5df440bfa06f7ed59b7404a0efd8c74e923b340a5cc`.

Controller jumps from v1.11.2 to v1.11.6 while chart stays on 4.11.2,
this is the part to look at:

- Templates that build controller pod and its access (deployment,
daemonset, `_params.tpl`, controller ConfigMaps, Service,
ServiceAccount, Roles, ClusterRoles and bindings) are identical between
4.11.2 here and 4.11.6 on release-1.7, where this image already runs.
Rest of template diff is ServiceMonitor, default backend and templated
webhook port (default stays 443, this package doesn't override it), plus
one comment and a renamed PrometheusRule file. `helm template` of the
package differs from line tip only in controller image line, both for
root ingress and for tenant ingress with webhook off.
- `Chart.yaml` keeps `appVersion: 1.11.2`, so
`app.kubernetes.io/version` label on controller still says 1.11.2.
Nothing in the tree reads it and it is not in selector, fixing it means
re-vendoring 4.11.6 chart, which is too much for a patch release.
- Upstream 1.11.3 to 1.11.6 are bug fixes plus CVE-2025-1974 set in
1.11.5. #720 already put v1.11.2 build with those patches backported on
this line, so the only behaviour change among them (admission webhook no
longer tests generated nginx config) is not new here.
- Segfault of the first v1.11.5 rebuild (#4012, the reason #4017 skipped
this line) is fixed in the fork by
cozystack/ingress-nginx-with-protobuf-exporter#7, which is an ancestor
of `v1.11.6-cozystack.3` tag.
- protobuf-exporter sidecar stays at v1.11.2. Main bumps it together
with controller, but `pbmetrics.lua` and template hooks calling it are
identical between fork `v1.11.2` and `v1.11.6-cozystack.3`, exporter
only changed how it is built (multi-arch, Go version).

No merge order needed, release-1.7 has this image since v1.7.2.

### Testing

- Tag resolves to pinned digest, an index with linux/amd64 and
linux/arm64.
- `helm unittest --with-subchart=false packages/system/ingress-nginx`
passes 2 of 2. Vendored upstream chart suites fail 5 of 76 on this line
with or without the change, package has no `test` target here so CI
doesn't run them.
- `make unit-tests` passes.
- [Live check on
v1.6.5](https://github.com/cozystack/cozystack/pull/5377#issuecomment-7086384344)
swapped only controller image to `cozystack.1` on stock 1.6 chart:
rolling update under HTTP/2 load, `nginx -t`, admission webhook server
dry-run, no restarts. `cozystack.3` itself was not run on a 1.6 cluster,
on 1.7 it runs since v1.7.2.

### Screenshots

N/A, no UI changes.

### Downstream repositories

Walked the trigger map against the diff: an image tag and digest in
`packages/system/ingress-nginx/values.yaml`. No package, values key,
schema or app README changes.

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:

### Release note

```release-note
fix(ingress-nginx): the ingress-nginx controller moves to v1.11.6-cozystack.3, nginx 1.25.5 rebuilt with the fixes for CVE-2026-123633, CVE-2026-123007 and the other nginx CVEs the controller can reach. The controller goes from v1.11.2 to v1.11.6 and its pods roll on upgrade. nginx still reports version 1.25.5, so scanners that match on the version will keep flagging it. From this release, upgrade to v1.7.2 or later: v1.7.0 and v1.7.1 run a controller build without these fixes.
```
v1.6.7-rc.1
2026-11-30 17:08:11 +03:00
Myasnikov Daniil 7e1444a3a2 fix(ingress-nginx): pick up the nginx rebuild with the CVE fixes
release-1.6 runs the v1.11.2 controller, whose nginx carries none of
the fixes main and release-1.7 got by moving to v1.11.6-cozystack.3
(#5377, #5436): the two HTTP/2 flaws CVE-2026-123633 and
CVE-2026-123007, and the rest the controller can reach, CVE-2026-97629
among them. The backport batch cannot bring those pins over, because
both build on the v1.11.6 bump that never reaches this line, so the
line takes the same image directly.

The controller moves from v1.11.2 to v1.11.6 under the 4.11.2 chart.
The templates that build the controller pod and its access
(controller-deployment, controller-daemonset, _params.tpl, the
controller ConfigMaps, Service and ServiceAccount, the Roles,
ClusterRoles and their bindings) are identical between 4.11.2 here and
4.11.6 on release-1.7, which ships this image since v1.7.2. Besides a
comment and a renamed PrometheusRule file, the rest of the template
diff is the ServiceMonitor, the default backend and a templated
admission webhook port whose default stays 443, which this package
does not override; the chart defaults differ only in image tags.
Chart.yaml keeps appVersion 1.11.2, so the controller's
app.kubernetes.io/version label still reads 1.11.2: nothing in the
tree reads it, and changing it means re-vendoring the 4.11.6 chart.

The protobuf-exporter sidecar stays at v1.11.2: the fork's
pbmetrics.lua and the template hooks that call it are unchanged
between v1.11.2 and v1.11.6-cozystack.3, and the exporter changed only
in how it is built.

The tag resolves to the pinned digest, an index with linux/amd64 and
linux/arm64. helm template of the package with its own values differs
from the line's tip in the controller image line only.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-30 08:09:23 +00:00
myasnikovdaniil a7bf3ce172 chore(release): promote v1.6.6-rc.3 -> v1.6.6 (#5495)
Promotes `v1.6.6-rc.3` to stable `v1.6.6` without rebuilding containers.
Their digests remain bit-for-bit what passed rc e2e; the tag-rewritten
packages tree is re-serialized as a temporary OCI candidate and pinned
here by digest. On merge, pull-requests-release.yaml verifies that
candidate against this tree before creating the write-once `v1.6.6` tag,
retagging the candidate and container digests to `v1.6.6` (+`:latest`
when this is the newest stable), publishing the stable cozy-installer
chart, and publishing the release. Do NOT squash-merge (decision B): the
stable tag must attach to a real merge commit.

✅ RC full e2e was verified for `v1.6.6-rc.3` before promotion.

ℹ️ E2E already ran against the immutable rc, so this promote PR does not
run E2E by default. A maintainer may add the `full-e2e` label to run the
full suite again.

✅ Includes `docs/changelogs/v1.6.6.md`, which finalize uses verbatim as
the published release body.

✅ Website docs PR opened/refreshed on `cozystack/website` (branch
`update-docs-v1.6.6`), generated from the `release-1.6.6` staging
branch. **Do NOT merge that PR until `v1.6.6` is published** — merging
it early flips the site's latest-version pointer to an unpublished
version and 404s its docs/API links (see the PR body).
api/apps/v1alpha1/v1.6.6 v1.6.6
2026-11-28 13:48:21 +05:00
Myasnikov Daniil f9eafe6c73 docs(release): keep the v1.6.6 changelog to the advisory wording
Finalize publishes this file as the v1.6.6 release body while the five
security advisories it carries fixes for are still drafts. The generated
notes named the affected components, described how each issue could be
exploited and cited advisory IDs, in the summary, the Security section
and the upgrade notes, so they would disclose the advisories before they
are published.

Each fix is now one line that names only its package and the severity
of its draft advisory and says details follow in an advisory,
attributed to the merge it came in with. The
upgrade notes keep what an operator has to do without the cause: the
monitoring web UI login, sign-in and rotation steps, the Harbor roll, the
bucket and Info behavior changes.

The upgrade test from v1.6.5 to v1.6.6-rc.3 added three notes: the
first backup of a Postgres with a platform backup rolls its instances
and fails, the SeaweedFS metadata database restart can lose S3 writes
confirmed just before a failover, and a MariaDB restore picks the
newest dump. The system PostgreSQL note no longer says the primary
always restarts in place, since the test saw it fail over. The #5087
and #4893 entries are corrected for this line, which sets no
healthCheckExprs and ships SeaweedFS 4.31.

Assisted-By: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-27 20:26:05 +00:00
cozystack-ci[bot] ad7a5d5ea1 docs: add changelog for v1.6.6
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-27 20:13:10 +00:00
cozystack-ci[bot] 18a4ab2f46 Pin promoted packages artifact for v1.6.6
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-27 20:02:31 +00:00
cozystack-ci[bot] ddab559341 Prepare release v1.6.6 (promoted from v1.6.6-rc.3)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-27 20:02:26 +00:00
Aleksei Sviridkin 321e9d8785 [Backport release-1.6] fix(ci): push the stable chart once, so a re-run keeps cozy-installer:X.Y.Z (#5488)
## What this PR does

Port of #5486 to release-1.6, finalize runs from base branch copy of the
workflow. Cherry-picked with `-x`, docs edit goes to `docs/release.md`.

The test went to `hack/promote-gate-contract.bats`, this line has no
`promote-packages-contract.bats`. It runs through `cozytest.sh` and
passes under dash, the helper prints `ok` or `failed` because the
translator makes every function there return 0.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:

### Release note

```release-note
fix(ci): a re-run of finalize no longer pushes the stable cozy-installer chart again
```
2026-11-27 17:57:21 +03:00
cozystack-ci[bot] 6fb5a194ce Prepare release v1.6.6-rc.3
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-27 14:44:21 +00:00
Myasnikov Daniil c14998e86f fix(ci): push the stable chart once, so a re-run keeps cozy-installer:X.Y.Z
Since finalize publishes the release page last, a run that fails in
Publish draft release is re-run after the chart is already pushed. The
re-run packaged and pushed the chart again, and helm package does not
give the same bytes twice (two packagings of the same tree with
different file times give two digests), so cozy-installer:X.Y.Z moved
to another digest.

The chart step now pushes only when the registry answers that cozy-
installer:X.Y.Z is missing, read as manifest_digest in hack/promote-
retag.sh reads it; any other lookup error fails the step instead of
being taken for a missing tag. cozy-installer:latest still follows the
latest decision on every run.

A bats test runs the step against stub skopeo, helm and yq: the first
run pushes once, a re-run pushes nothing, an older patch leaves latest
alone, a failed push fails the step, and a failed lookup fails it
without packaging or pushing.

Fixes: e1472e58de ("fix(ci): publish the release only after the stable images and chart exist")
Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
(cherry picked from commit e99a15dbee)
2026-11-27 13:52:31 +00:00
myasnikovdaniil ffdd851bab Merge commit from fork
[Backport release-1.6] security(info): do not render the tenant ServiceAccount token under OIDC
v1.6.6-rc.3
2026-11-27 18:34:40 +05:00
myasnikovdaniil 37e10d82d5 Merge commit from fork
[Backport release-1.6] fix(backups): confine Velero restore-copy to the tenant namespace subtree
2026-11-27 18:31:07 +05:00
myasnikovdaniil 87d62af925 Merge commit from fork
[Backport release-1.6] fix(bucket): refuse COSI classes of another SeaweedFS instance
2026-11-27 18:22:11 +05:00
Andrei Kvapil cd77b124e9 Merge commit from fork
[Backport release-1.6] security(harbor): give the inner registry its own credential and port policy
2026-11-27 13:50:54 +01:00
Myasnikov Daniil ec5c5474a3 security(info): bind the real tenant ServiceAccount without OIDC
The RoleBinding subject was built as tenant-<namespace> in namespace
tenant-<namespace>, but the release namespace already starts with
tenant-, so the binding did not name the tenant's own ServiceAccount.
The name it did form is one another tenant can claim: a child named
root of a tenant named tenant owns the ServiceAccount
tenant-tenant-root, which would then be granted the token Secret of
tenant-root. Bind the tenant's own ServiceAccount instead.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2026-11-27 13:48:47 +01:00
Myasnikov Daniil 9c9958a4ca security(info): do not render the tenant ServiceAccount token under OIDC
The Info application selects the ServiceAccount token Secret for the
tenantsecrets API, and the use tier can read tenantsecrets, so the token
and the rights bound to its ServiceAccount were readable by every use
member of the tenant.

With OIDC enabled the dashboard signs in with the user's own ID token and
nothing consumes the token, so the Secret is no longer rendered. Removing
it also invalidates tokens that were already read.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
(cherry picked from commit 5674d01c95)
2026-11-27 13:48:47 +01:00
Aleksei Sviridkin b3c99ae913 [Backport release-1.6] fix(ci): publish the release only after the stable images and chart exist (#5481)
## What this PR does

Port of #5169 to release-1.6. Closed-PR finalize runs from base branch
copy of `pull-requests-release.yaml`, so patch releases on this line
keep publishing release page before stable images and chart exist until
the line has the change itself.

Finalize on this line differs from main (release body only from
changelog, no release notes file and no size limit, single toolchain
step), so on top of cherry-pick I rebuilt the steps by hand from line's
own file: draft lookup and `latest` decision moved to `Resolve draft
release` before retag, release page published last with line's own body
selection, same concurrency group as on main. Docs edits go to
`docs/release.md`.

`hack/promote-packages-contract.bats` and
`hack/release-changelog-behaviour.bats` don't exist here, so order,
failure and concurrency checks went to
`hack/promote-gate-contract.bats`. It runs through `cozytest.sh`, passes
under dash and fails against current line workflow. Line has no harness
for github-script steps, so I ran `Resolve draft release` and `Publish
draft release` by hand against stubbed API (missing draft, orphaned
draft, older patch after newer minor, newest stable, rc, empty and
missing changelog), this is not in the suite.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:

### Release note

```release-note
fix(ci): finalize publishes the release page last, after the stable image tags and the cozy-installer chart exist, and finalizes one release at a time
```
2026-11-27 15:33:14 +03:00
Myasnikov Daniil a7866066cb fix(ci): publish the release only after the stable images and chart exist
Finalize undrafted the release before it retagged the images and
published the cozy-installer chart, so for the length of the retag the
release page announced a version whose images and chart returned
manifest unknown. The retag took 80-95 seconds on the 1.6.x patches and
several minutes on v1.7.0. A failure in either step also left a public
release that a re-run could not repair, because the re-run looked for a
draft and found none.

Move the draft lookup and the latest decision into their own step that
runs before any registry write, hand the decision to the retag, the
chart and the release page as step outputs, and undraft last. A missing
draft now fails while no stable name exists, and a failed retag leaves
the draft in place for a re-run. The comments and docs that took the
release to be public by the time finalize pushes the stable tag now say
when it is published.

Deciding latest before the retag opens minutes in which two release PRs
merged close together would both decide they are the newest, leaving
latest on the older line on the page, the image aliases and the chart.
Finalize therefore runs one release at a time, in a concurrency group
that only release PRs join and that queues every merged release rather
than cancelling the one waiting.

On this line hack/promote-gate-contract.bats fails on a release page
published before the registry steps, a registry step allowed to fail, a
publish step that runs after a failure, a `latest` that moves without
the decision, or finalize runs that may overlap. The line has no harness
for its github-script steps, so both were run by hand against a stubbed
API: a missing draft, an orphaned draft, an older patch after a newer
minor, a newest stable, an rc, and an empty or missing changelog.

Assisted-by: LLM
(cherry picked from commit e1472e58de)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-27 11:25:25 +00:00
myasnikovdaniil 45f3f74240 Merge commit from fork
[Backport release-1.6] security(monitoring): give Alerta a real signing key and its own admin password
v1.6.6-rc.2
2026-11-27 14:47:20 +05:00
myasnikovdaniil 7214c8ab90 fix(backport): batch for release-1.6, 2026-11-13 (#5312)
## What this PR does

Backports to `release-1.6` from `main`, picked by the rules of the
[backport
policy](https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md)
in merge order. A merged pull request comes as its own commits, picked
with `git cherry-pick -x` so each keeps its author, message and
sign-offs, and a merge commit that carries the original's merge message
with a `Backported-from:` trailer naming it; a squash-merged one comes
as one pick. `backport-batch verify` checks that shape. A pick listed as
changed differs from the commit it came from, and its release note waits
under Check these notes. A conflict or a failing check here is a
[backport
task](https://github.com/cozystack/cozystack/blob/main/docs/release/backport-tasks/README.md).

- [#3633](https://github.com/cozystack/cozystack/pull/3633)
`fix(tenant): retry failed monitoring and gateway installs in place`, 1
commit
- [#4095](https://github.com/cozystack/cozystack/pull/4095)
`fix(harbor): give the nginx proxy explicit resources so it survives the
tenant LimitRange`, 1 commit
- [#4289](https://github.com/cozystack/cozystack/pull/4289)
`fix(bucket): stop the ACME cleanup hook from talking to localhost, and
gate the class`, 1 commit
- [#4427](https://github.com/cozystack/cozystack/pull/4427)
`fix(monitoring): give kube-apiserver its own scrape size limit`, 3
commits
- [#4537](https://github.com/cozystack/cozystack/pull/4537)
`fix(mariadb): correct webhook cert-manager override key path`, 1 commit
- [#4673](https://github.com/cozystack/cozystack/pull/4673)
`fix(backups): create no driver object for a job that already finished`,
2 commits, changed in the pick: `c7dc37258041`
- [#5025](https://github.com/cozystack/cozystack/pull/5025)
`test(harbor): pin the resources of the nginx proxy and the portal`, 2
commits
- [#4985](https://github.com/cozystack/cozystack/pull/4985) `fix(etcd):
stop counting canceled watch streams as failed gRPC requests`, 1 commit
- [#5005](https://github.com/cozystack/cozystack/pull/5005)
`fix(tcp-balancer): cap HAProxy fds and threads by the pod's own
limits`, 1 commit
- [#5086](https://github.com/cozystack/cozystack/pull/5086)
`fix(tenant): stop the gateway release waiting on TenantGateway
listeners and certificates`, 1 commit
- [#5087](https://github.com/cozystack/cozystack/pull/5087)
`fix(controller): carry healthCheckExprs and waitStrategy to existing
releases`, 1 commit
- [#4004](https://github.com/cozystack/cozystack/pull/4004)
`fix(dashboard): link a tenant row to its detail page`, 2 commits,
changed in the pick: `663cf9edf85f`
- [#5212](https://github.com/cozystack/cozystack/pull/5212)
`fix(cilium): pass the CiliumNode list to jq on stdin in the IPAM hook`,
1 commit
- [#5213](https://github.com/cozystack/cozystack/pull/5213)
`fix(kubernetes): move the OIDC users out of the bootstrap Job's
script`, 1 commit
- [#5208](https://github.com/cozystack/cozystack/pull/5208)
`fix(clickhouse): restore the archive a Backup was taken as`, 3 commits
- [#5091](https://github.com/cozystack/cozystack/pull/5091)
`fix(postgres): render the declared databases in a stable order`, 1
commit
- [#5123](https://github.com/cozystack/cozystack/pull/5123)
`fix(mariadb-operator): derive the cluster name from the platform
domain`, 2 commits
- [#5124](https://github.com/cozystack/cozystack/pull/5124)
`fix(lineage, kubernetes): resolve CAPK node VMs to their cluster`, 2
commits, changed in the pick: `9ca427589e57`
- [#5184](https://github.com/cozystack/cozystack/pull/5184) `fix(api):
read pool usage under the quota key the controller counts`, 1 commit
- [#5190](https://github.com/cozystack/cozystack/pull/5190)
`fix(platform): remove the dead registries value and patch-containerd
Secret`, 2 commits
- [#5207](https://github.com/cozystack/cozystack/pull/5207)
`fix(mariadb): fail backup and restore jobs whose operator Job failed`,
5 commits
- [#5024](https://github.com/cozystack/cozystack/pull/5024)
`fix(kubernetes, monitoring): send tenant cluster metrics to the
tenant's vminsert`, 1 commit
- [#5284](https://github.com/cozystack/cozystack/pull/5284)
`fix(seaweedfs): bump the COSI driver to v0.4.0 for the lost-grant fix`,
1 commit
- [#5152](https://github.com/cozystack/cozystack/pull/5152)
`fix(monitoring-agents): let the release uninstall when the
VictoriaMetrics operator is gone first`, 1 commit
- [#5270](https://github.com/cozystack/cozystack/pull/5270)
`fix(vm-instance): keep an external PortList VM valid with no ports`, 1
commit
- [#5280](https://github.com/cozystack/cozystack/pull/5280)
`fix(backups): give the barman-cloud sidecar an explicit CPU limit`, 1
commit
- [#5100](https://github.com/cozystack/cozystack/pull/5100) `fix(etcd):
size the defrag job for the client it runs`, 1 commit
- [#5094](https://github.com/cozystack/cozystack/pull/5094)
`fix(monitoring): select the vmalert Service the operator creates`, 1
commit
- [#5250](https://github.com/cozystack/cozystack/pull/5250)
`fix(ingress-nginx): raise client keepalive_time above the 1h default`,
1 commit
- [#5102](https://github.com/cozystack/cozystack/pull/5102)
`fix(monitoring-agents): make a silent Watchdog an alarm in Alerta`, 1
commit
- [#4948](https://github.com/cozystack/cozystack/pull/4948)
`fix(monitoring): route InfoInhibitor to the blackhole receiver`, 2
commits
- [#5098](https://github.com/cozystack/cozystack/pull/5098)
`fix(vertical-pod-autoscaler): run two admission controllers spread over
nodes`, 2 commits
- [#5119](https://github.com/cozystack/cozystack/pull/5119)
`fix(postgres): accept a standard five-field backup schedule`, 2
commits, changed in the pick: `600a268351c7`
- [#4993](https://github.com/cozystack/cozystack/pull/4993)
`feat(monitoring): alert when pods of one workload share a node`, 1
commit
- [#5114](https://github.com/cozystack/cozystack/pull/5114)
`fix(kubevirt): let tenant admins upload a VMDisk image with virtctl`, 1
commit
- [#4963](https://github.com/cozystack/cozystack/pull/4963)
`fix(piraeus-operator): keep the LINSTOR error-report alerts quiet when
the controller pod moves`, 1 commit
- [#4946](https://github.com/cozystack/cozystack/pull/4946)
`fix(keycloak, foundationdb): apply operator CRD updates on upgrade`, 2
commits
- [#4965](https://github.com/cozystack/cozystack/pull/4965)
`fix(tcp-balancer): render the kubernetes and talos Service ports only
with kubernetesAndTalos`, 1 commit
- [#5242](https://github.com/cozystack/cozystack/pull/5242) `fix(vpa):
shorten the admission webhook timeout to 5s`, 2 commits
- [#5265](https://github.com/cozystack/cozystack/pull/5265)
`fix(controller, platform): give unbounded pool members the root's
LimitRange`, 3 commits
- [#5183](https://github.com/cozystack/cozystack/pull/5183) `fix(etcd):
scope tenant alerts to their scrape job`, 1 commit
- [#5189](https://github.com/cozystack/cozystack/pull/5189)
`fix(cozy-lib): render tenant hugepages quota only as requests`, 1
commit
- [#4893](https://github.com/cozystack/cozystack/pull/4893)
`fix(seaweedfs): keep Object Lock working for COSI credentials on
SeaweedFS 4.48`, 2 commits
- [#4915](https://github.com/cozystack/cozystack/pull/4915)
`fix(seaweedfs): remove identities left behind by deleted
BucketAccesses`, 1 commit, changed in the pick: `9d15a98369ec`
- [#4896](https://github.com/cozystack/cozystack/pull/4896)
`fix(kamaji): drop kubelet config fields older tenants do not know`, 1
commit
- [#5364](https://github.com/cozystack/cozystack/pull/5364)
`fix(backups): delete the Velero backup of a failed BackupJob`, 4
commits, changed in the pick: `9967676a6841`
- [#5373](https://github.com/cozystack/cozystack/pull/5373)
`fix(opensearch): disable the Base64 intrinsics hit by CVE-2026-114938`,
1 commit, changed in the pick: `330e8c516fb8`
- [#5340](https://github.com/cozystack/cozystack/pull/5340)
`fix(qdrant): scrape TLS metrics over HTTPS`, 1 commit
- [#5331](https://github.com/cozystack/cozystack/pull/5331)
`fix(kubernetes): remove cilium dependency from coredns HelmRelease`, 1
commit
- [#5134](https://github.com/cozystack/cozystack/pull/5134)
`fix(securitygroups): reject port ranges and malformed FQDNs on the
SecurityGroup path`, 2 commits
- [#4984](https://github.com/cozystack/cozystack/pull/4984)
`fix(postgres): keep users.app's password across pod restarts`, 1 commit
- [#5160](https://github.com/cozystack/cozystack/pull/5160)
`fix(linstor): roll affinity controller and scheduler on client cert
rotation`, 1 commit
- [#5358](https://github.com/cozystack/cozystack/pull/5358)
`fix(linstor): run the NFS server wait init container on the platform
CSI image`, 1 commit
- [#5326](https://github.com/cozystack/cozystack/pull/5326) `fix(api):
make monitor watch versions usable as delete preconditions`, 4 commits
- [#5348](https://github.com/cozystack/cozystack/pull/5348) `fix(api):
validate workload memory before storing an application`, 1 commit
- [#5392](https://github.com/cozystack/cozystack/pull/5392)
`fix(harbor): meter the registry bucket under the registry
WorkloadMonitor`, 1 commit
- [#5403](https://github.com/cozystack/cozystack/pull/5403)
`fix(platform): bump system PostgreSQL to 17.12`, 1 commit
- [#4797](https://github.com/cozystack/cozystack/pull/4797)
`fix(cozystack-basics): make the tenant super-admin VirtualMachine grant
read-only`, 1 commit
- [#5407](https://github.com/cozystack/cozystack/pull/5407)
`fix(ingress-nginx): turn off TLS session tickets for CVE-2026-97629`, 1
commit
- [#5210](https://github.com/cozystack/cozystack/pull/5210)
`fix(platform): do not gate cert-manager-issuers on ClusterIssuer
readiness`, 1 commit, changed in the pick: `9061f9a5e1a1`
- [#5443](https://github.com/cozystack/cozystack/pull/5443)
`fix(ingress): restore visitor IPs through SSL passthrough`, 2 commits

### Check these notes

These picks differ from their originals, so their release notes are left
out of the release-note block until someone checks that each still holds
for this line. Each comes with what to compare: every pick that differs
against the commit it came from, and the original's change against the
unit's.

[#4673](https://github.com/cozystack/cozystack/pull/4673) `fix(backups):
create no driver object for a job that already finished`, carried by
`4eb480d83bbf`:

```text
fix(backups): a BackupJob or RestoreJob that the controller has just marked Failed no longer gets a driver object created for it by the next reconcile, which could start on a cache that had not yet seen the Failed status and retry the step that failed — leaving, for instance, an untracked Velero Backup behind a Failed BackupJob, or a restore that halts the VM after its RestoreJob failed.
```

- `git range-diff --creation-factor=999 eafa441b9c36^! c7dc37258041^!`
- `git diff b1192bfcbcf4^1 b1192bfcbcf4`
- `git diff 4eb480d83bbf^1 4eb480d83bbf`

[#4004](https://github.com/cozystack/cozystack/pull/4004)
`fix(dashboard): link a tenant row to its detail page`, carried by
`19693538013e`:

```text
fix(dashboard): tenant name in the tenant list links to its detail page now (where Delete is), and top level tenants get their Edit button back.
```

- `git range-diff --creation-factor=999 7f55ff5d85fd^! 663cf9edf85f^!`
- `git diff a2cc9a30168f^1 a2cc9a30168f`
- `git diff 19693538013e^1 19693538013e`

[#5124](https://github.com/cozystack/cozystack/pull/5124) `fix(lineage,
kubernetes): resolve CAPK node VMs to their cluster`, carried by
`529b3b67295e`:

```text
fix(lineage, kubernetes): the virt-launcher pods of Kubernetes worker nodes are now resolved to their Kubernetes application and marked as managed by Cozystack, so a SecurityGroup attached to a Kubernetes cluster now applies to its worker nodes, not only to its control plane.
```

- `git range-diff --creation-factor=999 93faa7a8620d^! 9ca427589e57^!`
- `git diff 1f35c26ece02^1 1f35c26ece02`
- `git diff 529b3b67295e^1 529b3b67295e`

[#5119](https://github.com/cozystack/cozystack/pull/5119)
`fix(postgres): accept a standard five-field backup schedule`, carried
by `d54b11f14f0c`:

```text
fix(postgres): backup.schedule accepts a standard five-field cron such as 0 2 * * *, and the chart prepends a 0 seconds field before handing it to CloudNativePG, which reads the first field as seconds. Six-field values and descriptors render as before, and any other field count fails the render. A release that already sets five fields gets the standard meaning on upgrade, so 0 2 * * * moves from hourly to daily.
```

- `git range-diff --creation-factor=999 982db83dd22d^! 600a268351c7^!`
- `git diff 5fe356f57e8a^1 5fe356f57e8a`
- `git diff d54b11f14f0c^1 d54b11f14f0c`

[#4915](https://github.com/cozystack/cozystack/pull/4915)
`fix(seaweedfs): remove identities left behind by deleted
BucketAccesses`, carried by `ccdaa7779174`:

```text
fix(seaweedfs): remove S3 identities left behind by deleted BucketAccesses on install and upgrade. The new cosi.orphanIdentities value (auto, report, delete) controls it; auto only reports on a filer published to Client-topology clusters.
```

- `git range-diff --creation-factor=999 045f1a9bbc64^! 9d15a98369ec^!`
- `git diff 15e87fdbeaa1^1 15e87fdbeaa1`
- `git diff ccdaa7779174^1 ccdaa7779174`

[#5364](https://github.com/cozystack/cozystack/pull/5364) `fix(backups):
delete the Velero backup of a failed BackupJob`, carried by
`6b310132a6e1`:

```text
fix(backups): a BackupJob whose Velero backup ends Failed, PartiallyFailed or FailedValidation now asks Velero to delete that backup and its data in the bucket, instead of leaving them until Velero's TTL expires. A Velero backup that completed is never deleted this way. If Velero cannot carry out the deletion (for example, the backup storage location is missing, read-only or unavailable), the BackupJob gets a `VeleroBackupDeletionFailed` Warning event with Velero's errors, and the deletion is retried at a growing interval of up to one hour. After upgrading, the Velero backups of BackupJobs that already failed are deleted as well; to keep one for a manual `velero restore`, copy it before the upgrade. The backupstrategy-controller ClusterRole gains `delete` on `deletebackuprequests`.
```

- `git range-diff --creation-factor=999 5fbf7e9a3806^! 9967676a6841^!`
- `git diff 7f31011b99a2^1 7f31011b99a2`
- `git diff 6b310132a6e1^1 6b310132a6e1`

[#5373](https://github.com/cozystack/cozystack/pull/5373)
`fix(opensearch): disable the Base64 intrinsics hit by CVE-2026-114938`,
carried by `2fab06097342`:

```text
fix(opensearch): mitigate CVE-2026-114938 (Java4Shell) by starting OpenSearch nodes with -XX:-UseBASE64Intrinsics, which disables the vulnerable OpenJDK Base64 decoder. Every OpenSearch cluster restarts once on upgrade.
```

- `git range-diff --creation-factor=999 65f094371015^! 330e8c516fb8^!`
- `git diff 026b0156355a^1 026b0156355a`
- `git diff 2fab06097342^1 2fab06097342`

[#5210](https://github.com/cozystack/cozystack/pull/5210)
`fix(platform): do not gate cert-manager-issuers on ClusterIssuer
readiness`, carried by `150d36e0f65c`:

```text
fix(platform): the cert-manager-issuers release no longer waits for ClusterIssuers to become Ready, so an unreachable ACME endpoint (staging included) does not hold other platform packages in DependencyNotReady.
```

- `git range-diff --creation-factor=999 13fefcedda13^! 9061f9a5e1a1^!`
- `git diff a1be486fb6fd^1 a1be486fb6fd`
- `git diff 150d36e0f65c^1 150d36e0f65c`

### Parked

These cannot land on `release-1.6` whole, so the batch does not pick
them: each would leave part of it without effect there, or builds on a
change that never reaches the line. A maintainer ports what applies as a
pull request of its own, or drops the original with `backport-batch run
--drop`; `backport/include` does not lift a park.

- [#5071](https://github.com/cozystack/cozystack/pull/5071)
`fix(marketplace): do not install a connected repository's components on
connect`: builds on
[#3940](https://github.com/cozystack/cozystack/pull/3940),
[#4308](https://github.com/cozystack/cozystack/pull/4308), which never
reaches this line
- [#5088](https://github.com/cozystack/cozystack/pull/5088)
`fix(ingress-nginx): drop the admission-webhook policy a rebase brought
back`: only part of it applies; it would leave
`packages/system/ingress-nginx/templates/admission-webhook-networkpolicy.yaml`,
`packages/system/ingress-nginx/tests/admission_webhook_networkpolicy_test.yaml`
without effect
- [#4917](https://github.com/cozystack/cozystack/pull/4917)
`fix(kubernetes): run Proxmox CCM v0.16.1 and pin the Proxmox images by
digest`: builds on
[#4089](https://github.com/cozystack/cozystack/pull/4089), which never
reaches this line
- [#4974](https://github.com/cozystack/cozystack/pull/4974)
`fix(kubernetes-nodes): plan autoscaler capacity on the cores the VM
actually gets`: builds on
[#3315](https://github.com/cozystack/cozystack/pull/3315),
[#4386](https://github.com/cozystack/cozystack/pull/4386), which never
reaches this line
- [#4971](https://github.com/cozystack/cozystack/pull/4971) `fix(e2e):
keep the Proxmox tenant kubeconfig per run and remove it`: builds on
[#4089](https://github.com/cozystack/cozystack/pull/4089), which never
reaches this line
- [#4970](https://github.com/cozystack/cozystack/pull/4970) `fix(e2e):
read the KubernetesNodes pool release in the HelmRelease guard`: builds
on [#3594](https://github.com/cozystack/cozystack/pull/3594), which
never reaches this line
- [#4972](https://github.com/cozystack/cozystack/pull/4972) `fix(e2e):
validate the leak allowlist against every suite layout`: builds on
[#4492](https://github.com/cozystack/cozystack/pull/4492),
[#4658](https://github.com/cozystack/cozystack/pull/4658),
[#4713](https://github.com/cozystack/cozystack/pull/4713), which never
reaches this line
- [#5082](https://github.com/cozystack/cozystack/pull/5082)
`fix(marketplace): pin a tapped repository to a digest instead of a
mutable tag`: builds on
[#3940](https://github.com/cozystack/cozystack/pull/3940), which never
reaches this line
- [#5230](https://github.com/cozystack/cozystack/pull/5230)
`fix(backups): re-render the default backup objects when the S3 endpoint
changes`: builds on
[#3562](https://github.com/cozystack/cozystack/pull/3562),
[#3990](https://github.com/cozystack/cozystack/pull/3990),
[#3992](https://github.com/cozystack/cozystack/pull/3992),
[#4000](https://github.com/cozystack/cozystack/pull/4000),
[#4929](https://github.com/cozystack/cozystack/pull/4929), which never
reaches this line
- [#5133](https://github.com/cozystack/cozystack/pull/5133)
`fix(securitygroups): project a membership-only group to a policy Cilium
accepts`: builds on
[#4447](https://github.com/cozystack/cozystack/pull/4447), which never
reaches this line
- [#5151](https://github.com/cozystack/cozystack/pull/5151) `fix(redis):
run one Sentinel when Redis runs a single pod`: builds on
[#4832](https://github.com/cozystack/cozystack/pull/4832), which never
reaches this line
- [#5211](https://github.com/cozystack/cozystack/pull/5211)
`fix(postgres): fail a backup job as soon as its cnpg Backup fails`:
builds on [#4674](https://github.com/cozystack/cozystack/pull/4674),
which never reaches this line
- [#5226](https://github.com/cozystack/cozystack/pull/5226)
`fix(platform): leave tenant-root's ingress empty when the root tenant
has none`: builds on
[#3280](https://github.com/cozystack/cozystack/pull/3280), which never
reaches this line
- [#5228](https://github.com/cozystack/cozystack/pull/5228)
`fix(seaweedfs): enforce S3 bucket lifecycle rules`: builds on
[#3562](https://github.com/cozystack/cozystack/pull/3562),
[#3580](https://github.com/cozystack/cozystack/pull/3580), which never
reaches this line
- [#5308](https://github.com/cozystack/cozystack/pull/5308)
`fix(seaweedfs): stop the master crashing on the crowded volume map`:
builds on [#4819](https://github.com/cozystack/cozystack/pull/4819),
which never reaches this line
- [#4986](https://github.com/cozystack/cozystack/pull/4986) `fix(etcd):
require an even spread of members over nodes by default`: builds on
[#3962](https://github.com/cozystack/cozystack/pull/3962),
[#3964](https://github.com/cozystack/cozystack/pull/3964), which never
reaches this line
- [#5249](https://github.com/cozystack/cozystack/pull/5249)
`fix(kubernetes): detach volumes when the infra PVC is missing`: builds
on [#4447](https://github.com/cozystack/cozystack/pull/4447), which
never reaches this line
- [#4234](https://github.com/cozystack/cozystack/pull/4234)
`fix(seaweedfs, cozy-lib): cap the Go heap so components survive their
memory limit`: builds on
[#5228](https://github.com/cozystack/cozystack/pull/5228), which never
reaches this line
- [#5096](https://github.com/cozystack/cozystack/pull/5096)
`fix(workloadmonitor): report a bucket's workloads not ready until its
claim is provisioned`: builds on
[#4380](https://github.com/cozystack/cozystack/pull/4380), which never
reaches this line
- [#4945](https://github.com/cozystack/cozystack/pull/4945) `fix(apps):
keep Job and CronJob names within the Kubernetes limits`: builds on
[#2352](https://github.com/cozystack/cozystack/pull/2352), which never
reaches this line
- [#5011](https://github.com/cozystack/cozystack/pull/5011)
`fix(cozystack-basics): refuse a direct delete of a tenant namespace`:
builds on [#4639](https://github.com/cozystack/cozystack/pull/4639),
which never reaches this line
- [#5329](https://github.com/cozystack/cozystack/pull/5329) `fix(ci):
take main's ref for a bare first-party image ref in a drifted file`:
builds on [#4261](https://github.com/cozystack/cozystack/pull/4261),
[#4756](https://github.com/cozystack/cozystack/pull/4756), which never
reaches this line
- [#5153](https://github.com/cozystack/cozystack/pull/5153)
`fix(kubernetes): bring up a replacement worker before draining the old
one`: builds on
[#3280](https://github.com/cozystack/cozystack/pull/3280),
[#3315](https://github.com/cozystack/cozystack/pull/3315),
[#4713](https://github.com/cozystack/cozystack/pull/4713), which never
reaches this line
- [#5175](https://github.com/cozystack/cozystack/pull/5175) `fix(tests):
reject matcher failures in negative file assertions`: builds on
[#3548](https://github.com/cozystack/cozystack/pull/3548),
[#3637](https://github.com/cozystack/cozystack/pull/3637),
[#3676](https://github.com/cozystack/cozystack/pull/3676),
[#3723](https://github.com/cozystack/cozystack/pull/3723),
[#3804](https://github.com/cozystack/cozystack/pull/3804),
[#3836](https://github.com/cozystack/cozystack/pull/3836),
[#3843](https://github.com/cozystack/cozystack/pull/3843),
[#3886](https://github.com/cozystack/cozystack/pull/3886),
[#3888](https://github.com/cozystack/cozystack/pull/3888),
[#3889](https://github.com/cozystack/cozystack/pull/3889),
[#3890](https://github.com/cozystack/cozystack/pull/3890),
[#3919](https://github.com/cozystack/cozystack/pull/3919), which never
reaches this line
- [#5377](https://github.com/cozystack/cozystack/pull/5377)
`fix(ingress-nginx): pick up the nginx rebuild with the HTTP/2 CVE
fixes`: builds on
[#4549](https://github.com/cozystack/cozystack/pull/4549), which never
reaches this line
- [#5354](https://github.com/cozystack/cozystack/pull/5354)
`fix(platform): honour a bool false in ingress-enabled and
monitoring-enabled`: builds on
[#5226](https://github.com/cozystack/cozystack/pull/5226), which never
reaches this line
- [#5045](https://github.com/cozystack/cozystack/pull/5045) `fix(talos):
bump Talos to v1.14.4 (CVE-2026-99999)`: builds on
[#4552](https://github.com/cozystack/cozystack/pull/4552),
[#4598](https://github.com/cozystack/cozystack/pull/4598), which never
reaches this line
- [#5352](https://github.com/cozystack/cozystack/pull/5352)
`docs(gateway): stop saying the route-hostname policy admits
hostname-less routes`: builds on
[#3861](https://github.com/cozystack/cozystack/pull/3861), which never
reaches this line
- [#5356](https://github.com/cozystack/cozystack/pull/5356)
`fix(seaweedfs): point the Lance catalog consumers at the renamed s3
Service`: builds on
[#4079](https://github.com/cozystack/cozystack/pull/4079), which never
reaches this line
- [#5357](https://github.com/cozystack/cozystack/pull/5357) `fix(api):
skip an invalid ApplicationDefinition instead of failing startup`:
builds on [#4424](https://github.com/cozystack/cozystack/pull/4424),
which never reaches this line
- [#5148](https://github.com/cozystack/cozystack/pull/5148)
`fix(gateway): skip a child apex the wildcard certificate already
covers`: builds on
[#3342](https://github.com/cozystack/cozystack/pull/3342), which never
reaches this line
- [#4167](https://github.com/cozystack/cozystack/pull/4167)
`fix(gateway): copy allowed routes for the edge listener`: builds on
[#3861](https://github.com/cozystack/cozystack/pull/3861), which never
reaches this line
- [#4954](https://github.com/cozystack/cozystack/pull/4954)
`fix(tenant): render the LimitRange only under a compute quota`: builds
on [#3494](https://github.com/cozystack/cozystack/pull/3494), which
never reaches this line
- [#5399](https://github.com/cozystack/cozystack/pull/5399)
`fix(kubernetes-nodes): surge one worker at a time during a pool
rollout`: builds on
[#3315](https://github.com/cozystack/cozystack/pull/3315),
[#5153](https://github.com/cozystack/cozystack/pull/5153), which never
reaches this line
- [#5436](https://github.com/cozystack/cozystack/pull/5436)
`fix(ingress-nginx): pick up the nginx rebuild with the remaining CVE
fixes`: builds on
[#5377](https://github.com/cozystack/cozystack/pull/5377), which never
reaches this line
- [#5236](https://github.com/cozystack/cozystack/pull/5236)
`fix(kubernetes): include the namespace in the kubevirt-csi ClusterRole
name`: builds on
[#4563](https://github.com/cozystack/cozystack/pull/4563), which never
reaches this line

### Maintainer overrides

- [#3633](https://github.com/cozystack/cozystack/pull/3633)
`fix(tenant): retry failed monitoring and gateway installs in place`:
`backport/include`, on this branch
- [#4095](https://github.com/cozystack/cozystack/pull/4095)
`fix(harbor): give the nginx proxy explicit resources so it survives the
tenant LimitRange`: `backport/include`, on this branch
- [#4289](https://github.com/cozystack/cozystack/pull/4289)
`fix(bucket): stop the ACME cleanup hook from talking to localhost, and
gate the class`: `backport/include`, on this branch
- [#4427](https://github.com/cozystack/cozystack/pull/4427)
`fix(monitoring): give kube-apiserver its own scrape size limit`:
`backport/include`, on this branch
- [#4537](https://github.com/cozystack/cozystack/pull/4537)
`fix(mariadb): correct webhook cert-manager override key path`:
`backport/include`, on this branch
- [#4673](https://github.com/cozystack/cozystack/pull/4673)
`fix(backups): create no driver object for a job that already finished`:
`backport/include`, on this branch
- [#5025](https://github.com/cozystack/cozystack/pull/5025)
`test(harbor): pin the resources of the nginx proxy and the portal`:
`backport/include`, on this branch
- [#4985](https://github.com/cozystack/cozystack/pull/4985) `fix(etcd):
stop counting canceled watch streams as failed gRPC requests`:
`backport/include`, on this branch
- [#5005](https://github.com/cozystack/cozystack/pull/5005)
`fix(tcp-balancer): cap HAProxy fds and threads by the pod's own
limits`: `backport/include`, on this branch
- [#5083](https://github.com/cozystack/cozystack/pull/5083)
`fix(workloadmonitor): stop doubling the bucket- prefix in bucket
Workload names`: `backport/skip`, left out
- [#4973](https://github.com/cozystack/cozystack/pull/4973)
`fix(kubernetes-nodes): refuse a partial resources spec on every pool`:
`backport/skip`, left out
- [#5180](https://github.com/cozystack/cozystack/pull/5180) `fix(tests):
keep two unit tests green after the release image restamp`:
`backport/skip`, left out
- [#4993](https://github.com/cozystack/cozystack/pull/4993)
`feat(monitoring): alert when pods of one workload share a node`:
`backport/include`, on this branch
- [#5352](https://github.com/cozystack/cozystack/pull/5352)
`docs(gateway): stop saying the route-hostname policy admits
hostname-less routes`: `backport/include`, parked: builds on
[#3861](https://github.com/cozystack/cozystack/pull/3861), which never
reaches this line
- [#4990](https://github.com/cozystack/cozystack/pull/4990) `fix(redis,
valkey, harbor): spread sentinels and data pods over nodes`:
`backport/skip`, left out
- [#4989](https://github.com/cozystack/cozystack/pull/4989)
`fix(monitoring): spread monitoring replicas over nodes`:
`backport/skip`, left out
- [#5393](https://github.com/cozystack/cozystack/pull/5393)
`fix(kubernetes-nodes): label worker disks with the WorkloadMonitor
selector`: `backport/skip`, left out
- [#4817](https://github.com/cozystack/cozystack/pull/4817)
`feat(kubernetes): give each tenant Kubernetes cluster its own etcd`:
`backport/skip`, left out
- [#5407](https://github.com/cozystack/cozystack/pull/5407)
`fix(ingress-nginx): turn off TLS session tickets for CVE-2026-97629`:
`backport/include`, on this branch
- [#5156](https://github.com/cozystack/cozystack/pull/5156)
`fix(kafka)!: require SCRAM-SHA-512 on the external listener`:
`backport/skip`, left out
- [#5186](https://github.com/cozystack/cozystack/pull/5186)
`ci(workflows): run push and schedule workflows only in
cozystack/cozystack`: `backport/skip`, left out
- [#4921](https://github.com/cozystack/cozystack/pull/4921) `feat(api):
add the credentials API with mint and revoke subresources`:
`backport/skip`, left out
- [#5163](https://github.com/cozystack/cozystack/pull/5163)
`docs(release): add the v1.7.0 release notes`: `backport/skip`, left out
- [#5337](https://github.com/cozystack/cozystack/pull/5337)
`feat(kubernetes): run tenant clusters inside a cozyplane VPC`:
`backport/skip`, left out

### Skipped

- Rule 1, merged before `release-1.6` started under the policy on
2026-10-26: 553, too many to list here; the run's output lists them
- Rule 2, the title type is not `fix` or `security`, or the scope is
`deps`: 80, too many to list here; the run's output lists them
- Rule 3, a breaking change: 6
- Rule 4, touches platform migrations, `targetVersion` or a CRD, or
makes a sizeable API change: 3
- Rule 6, not on `release-1.7` yet: 16
- Dropped from `release-1.6` by a maintainer: 5

<details><summary>Rule 3, a breaking change</summary>

- [#5085](https://github.com/cozystack/cozystack/pull/5085)
`fix(kubernetes, opensearch, foundationdb)!: restrict managed
application images`, `! in the title`
- [#4818](https://github.com/cozystack/cozystack/pull/4818)
`fix(keycloak)!: make the KMS proxy keep its keys across restarts`, `!
in the title`
- [#5167](https://github.com/cozystack/cozystack/pull/5167)
`fix(monitoring-agents)!: isolate merged log payload under
log_processed`, `! in the title`
- [#5009](https://github.com/cozystack/cozystack/pull/5009)
`fix(cozy-lib)!: refuse memory below 1Mi instead of rendering a few
bytes`, `! in the title`
- [#5191](https://github.com/cozystack/cozystack/pull/5191)
`fix(kubernetes)!: remove the talos block and other leftovers of the
worker pool split`, `! in the title`
- [#4802](https://github.com/cozystack/cozystack/pull/4802)
`fix(vm-disk, kubernetes-nodes)!: refuse golden images whose import
keeps failing`, `! in the title`

</details>

<details><summary>Rule 4, touches platform migrations, `targetVersion`
or a CRD, or makes a sizeable API change</summary>

- [#5223](https://github.com/cozystack/cozystack/pull/5223)
`fix(backups): report sizeBytes for MariaDB and CNPG backup artifacts`,
`a CRD`
- [#5166](https://github.com/cozystack/cozystack/pull/5166)
`fix(linstor): update piraeus-operator to v2.12.1`, `a CRD`
- [#5430](https://github.com/cozystack/cozystack/pull/5430)
`fix(linstor): gate group snapshots on the v1 group snapshot API`,
`platform migrations`

</details>

<details><summary>Rule 6, not on `release-1.7` yet</summary>

- [#5232](https://github.com/cozystack/cozystack/pull/5232)
`fix(clickhouse): let a running backup sidecar pick up system-bucket
credentials`, `not on release-1.7 yet`
- [#5229](https://github.com/cozystack/cozystack/pull/5229)
`fix(clickhouse): keep failed backup attempts out of the bucket`, `not
on release-1.7 yet`
- [#5221](https://github.com/cozystack/cozystack/pull/5221)
`fix(postgres): stop backup jobs from fighting over the WAL archive
destination`, `not on release-1.7 yet`
- [#5227](https://github.com/cozystack/cozystack/pull/5227)
`fix(mariadb): restore the dump a Backup was taken as`, `not on
release-1.7 yet`
- [#5309](https://github.com/cozystack/cozystack/pull/5309)
`fix(linstor): restore snapshots on a schedulable node`, `not on
release-1.7 yet`
- [#5294](https://github.com/cozystack/cozystack/pull/5294)
`fix(postgres): hold the WAL archive destination for backups no job
tracks`, `not on release-1.7 yet`
- [#5295](https://github.com/cozystack/cozystack/pull/5295)
`fix(postgres): restore from an archive with the access it was written
with`, `not on release-1.7 yet`
- [#5344](https://github.com/cozystack/cozystack/pull/5344)
`fix(backups): stop leaking MariaDB dumps of stuck runs and torn-down
namespaces`, `not on release-1.7 yet`
- [#5375](https://github.com/cozystack/cozystack/pull/5375)
`fix(kubernetes): apply addons.monitoringAgents.valuesOverride`, `not on
release-1.7 yet`
- [#5224](https://github.com/cozystack/cozystack/pull/5224)
`fix(clickhouse): delete the archive when its Backup is deleted`, `not
on release-1.7 yet`
- [#5398](https://github.com/cozystack/cozystack/pull/5398)
`fix(cluster-api): name the kubeconfig the upgrade hook runs with`, `not
on release-1.7 yet`
- [#5415](https://github.com/cozystack/cozystack/pull/5415)
`fix(clickhouse): keep a quota-held archive delete and count a failed
one once`, `not on release-1.7 yet`
- [#5049](https://github.com/cozystack/cozystack/pull/5049)
`fix(kubernetes): bump tenant worker Talos to v1.13.12
(CVE-2026-99999)`, `not on release-1.7 yet`
- [#5426](https://github.com/cozystack/cozystack/pull/5426)
`fix(seaweedfs): stop reserving storage pool name suffixes`, `not on
release-1.7 yet`
- [#5427](https://github.com/cozystack/cozystack/pull/5427)
`fix(kubernetes): stop refusing extraOutputs hooks monitoring-agents
accepts`, `not on release-1.7 yet`
- [#5320](https://github.com/cozystack/cozystack/pull/5320)
`fix(postgres): bound a backup whose cnpg Backup stalls in pending`,
`not on release-1.7 yet`

</details>

<details><summary>Dropped from `release-1.6` by a maintainer</summary>

- [#5142](https://github.com/cozystack/cozystack/pull/5142)
`fix(release): keep release bodies within GitHub's size limit`, `dropped
on #5312: not needed on release-1.6, it ships only patches now and their
changelogs are 8-22 KB, far below release body limit`
- [#5155](https://github.com/cozystack/cozystack/pull/5155)
`fix(postgres): refuse system databases and never drop them`, `dropped
on #5312: builds on init script passes from #4078 and #4574, release-1.6
doesn't have them and #4078 is breaking`
- [#4960](https://github.com/cozystack/cozystack/pull/4960)
`fix(vm-disk): refuse a disk smaller than the golden image it clones`,
`dropped on #5312: builds on golden image checks of #4796, which is
breaking and won't reach release-1.6`
- [#4920](https://github.com/cozystack/cozystack/pull/4920)
`fix(lineage-webhook): keep an explicit tenantresource false`, `dropped
on #5312: its test needs newHandleTestWebhook from #4447, which never
reaches release-1.6`
- [#5405](https://github.com/cozystack/cozystack/pull/5405)
`fix(postgres): move tenant PostgreSQL to patched standard-trixie
images`, `dropped on #5312: reverted on release-1.7 in #5461, comes to
release-1.6 only as the hand port #5433 after #5459 is fixed`

</details>

```backport-batch
{"version":3,"line":"release-1.6","built":{"main":"a2b341e31be2fc4d7c044a4f5ad5239d5f342af6","line":"5de32a56267d6fb8e8c858af0e3b022e2dad0ec0","newer":"d096e1006921674455330a1b498a30a8b1309a67","policy":"a2b341e31be2fc4d7c044a4f5ad5239d5f342af6","batch":"6b310132a6e13e0f7df0fca067e6816e9a660fc1","tool":"fba9fa8278a08150215670406c7e6e63832c9dee","run":"","at":"2026-11-26T16:35:08Z","options":{"noWorkflowFiles":true,"mode":"drop"}},"report":"09ba042bd04aab5f5fe57b593a4959c24b9eee7dac2ab6acaca60a4e61c37759","closing":null,"deferred":[],"dropped":[{"original":4920,"merge":"65cb73e38098a127d9c09bca3cf16d431222696e","reason":"its test needs newHandleTestWebhook from #4447, which never reaches release-1.6","on":5312,"date":"2026-11-26"},{"original":4960,"merge":"a5c58e5e985399a687e5f676a7321f828eda5ff7","reason":"builds on golden image checks of #4796, which is breaking and won't reach release-1.6","on":5312,"date":"2026-11-26"},{"original":5142,"merge":"5c564f9154ddc03387fd4cd6b7a9185b11b0bdb3","reason":"not needed on release-1.6, it ships only patches now and their changelogs are 8-22 KB, far below release body limit","on":5312,"date":"2026-11-25"},{"original":5155,"merge":"b53ca1fedebcc6288856995ada2629c06c9e4ae7","reason":"builds on init script passes from #4078 and #4574, release-1.6 doesn't have them and #4078 is breaking","on":5312,"date":"2026-11-26"},{"original":5405,"merge":"30ce2a3cb1de5b64e629780ef70349608d5cd05d","reason":"reverted on release-1.7 in #5461, comes to release-1.6 only as the hand port #5433 after #5459 is fixed","on":5312,"date":"2026-11-26"}],"stale":[],"parked":[{"original":4167,"merge":"2af1e21299e161041e87d07d21fbfa4d81f97903","kind":"dependency","needs":[3861],"announced":true},{"original":4234,"merge":"df42104b13ff01ca23a5a9f0835530b38824af16","kind":"dependency","needs":[5228],"announced":true},{"original":4917,"merge":"44848b9c9d08f529bbef6e1347c2533a24121406","kind":"dependency","needs":[4089],"announced":true},{"original":4945,"merge":"ea4968cf4613f696cd955bb1f66a7cfd877529ce","kind":"dependency","needs":[2352],"announced":true},{"original":4954,"merge":"94d710e50fe728827cb34c0ff7023c772984d1d0","kind":"dependency","needs":[3494],"announced":true},{"original":4970,"merge":"013b166967e72cdd441e3efde58a4bc1ef75192c","kind":"dependency","needs":[3594],"announced":true},{"original":4971,"merge":"048c029e29607a0b4c5b9e3d9e3b70c76e53bb51","kind":"dependency","needs":[4089],"announced":true},{"original":4972,"merge":"ba0b1ac6ef250048dd33657ff0aca9934900d612","kind":"dependency","needs":[4492,4658,4713],"announced":true},{"original":4974,"merge":"60d1f53e82419ad2138807a54d1045007921d986","kind":"dependency","needs":[3315,4386],"announced":true},{"original":4986,"merge":"e4d059ceddfee96d30dabe3c1a4fade5e18c55cf","kind":"dependency","needs":[3962,3964],"announced":true},{"original":5011,"merge":"29e8522f4b8d2fdef964a8e3f60e1af44fcd08e9","kind":"dependency","needs":[4639],"announced":true},{"original":5045,"merge":"382169be52d15f1a0ae4f3500039e0e8a9beb7fb","kind":"dependency","needs":[4552,4598],"announced":true},{"original":5071,"merge":"7dc5c0b5e63e1a7b7308f8d18adf42cfb900148e","kind":"dependency","needs":[3940,4308],"announced":true},{"original":5082,"merge":"94ada11eefdccc9040db71b710334c878f6bed83","kind":"dependency","needs":[3940],"announced":true},{"original":5088,"merge":"b36628661f60d8076a1122487356406c6d5b86b9","kind":"partial","files":["packages/system/ingress-nginx/templates/admission-webhook-networkpolicy.yaml","packages/system/ingress-nginx/tests/admission_webhook_networkpolicy_test.yaml"],"announced":true},{"original":5096,"merge":"6f8171db8990e5a0c12b216c37877abd0798213e","kind":"dependency","needs":[4380],"announced":true},{"original":5133,"merge":"72ff22dc9ebd51c899f024ebefec111d8a36b7b1","kind":"dependency","needs":[4447],"announced":true},{"original":5148,"merge":"b7e72840f92b15241f8dc451819f3a054e70d84a","kind":"dependency","needs":[3342],"announced":true},{"original":5151,"merge":"23461e065d0fa210c2990122663e7f084f7b2a50","kind":"dependency","needs":[4832],"announced":true},{"original":5153,"merge":"da17254bbc2c739c33c06139e7c2cfb280ae60c5","kind":"dependency","needs":[3280,3315,4713],"announced":true},{"original":5175,"merge":"5a5d5cd3d85fec610516651ab9bc5623a83f62cf","kind":"dependency","needs":[3548,3637,3676,3723,3804,3836,3843,3886,3888,3889,3890,3919]},{"original":5211,"merge":"10e0ef9ece2b7a527c5c2c3fed9bdbecacdb668f","kind":"dependency","needs":[4674],"announced":true},{"original":5226,"merge":"aa97451bc2cec98e9ac04131b9efd2a065983fff","kind":"dependency","needs":[3280],"announced":true},{"original":5228,"merge":"238b3ee491f513302722972b50060e689292f826","kind":"dependency","needs":[3562,3580],"announced":true},{"original":5230,"merge":"9e8e10c307584061f497e9b6506765c0e87b6c91","kind":"dependency","needs":[3562,3990,3992,4000,4929],"announced":true},{"original":5236,"merge":"a2b341e31be2fc4d7c044a4f5ad5239d5f342af6","kind":"dependency","needs":[4563]},{"original":5249,"merge":"e5ab1d6a7e09ff10d92c497a3468c3f9800cff5b","kind":"dependency","needs":[4447],"announced":true},{"original":5308,"merge":"30c4232be19bc1b887228d66e5e0fb8dc508547a","kind":"dependency","needs":[4819],"announced":true},{"original":5329,"merge":"90797d9de977d791d32d16acf7286c848fa6aab2","kind":"dependency","needs":[4261,4756],"announced":true},{"original":5352,"merge":"dec14c736d32cd12798de9af23363469986c7ed4","kind":"dependency","needs":[3861],"announced":true},{"original":5354,"merge":"18a9530b873e557d0198c1b6f2bfeddead746445","kind":"dependency","needs":[5226],"announced":true},{"original":5356,"merge":"4190aa82f5ef93a2bd4edd59a7e1db3f75bc8d01","kind":"dependency","needs":[4079],"announced":true},{"original":5357,"merge":"ec8088e54c719be89fff58fcd17f88950a6cb1a0","kind":"dependency","needs":[4424],"announced":true},{"original":5377,"merge":"d7573c009c482aacfc957954b9c1ae228c844ce7","kind":"dependency","needs":[4549],"announced":true},{"original":5399,"merge":"22843c5c5c204249cf2599ad23abef203d492948","kind":"dependency","needs":[3315,5153],"announced":true},{"original":5436,"merge":"40b4fc6ad4f39d3c449beee2a492fbd7f621b8ba","kind":"dependency","needs":[5377],"announced":true}],"changed":[4004,4673,4915,5119,5124,5210,5364,5373]}
```

```backport-batch-report
{"format":2,"id":"09ba042bd04aab5f5fe57b593a4959c24b9eee7dac2ab6acaca60a4e61c37759","line":"release-1.6","built":{"main":"a2b341e31be2fc4d7c044a4f5ad5239d5f342af6","line":"5de32a56267d6fb8e8c858af0e3b022e2dad0ec0","newer":"d096e1006921674455330a1b498a30a8b1309a67","policy":"a2b341e31be2fc4d7c044a4f5ad5239d5f342af6","batch":"6b310132a6e13e0f7df0fca067e6816e9a660fc1","tool":"fba9fa8278a08150215670406c7e6e63832c9dee","run":"","at":"2026-11-26T16:35:08Z","options":{"noWorkflowFiles":true,"mode":"drop"}},"overrides":{"backport/include":[3633,4095,4289,4427,4537,4673,4985,4993,5005,5025,5352,5407],"backport/skip":[4817,4921,4973,4989,4990,5083,5156,5163,5180,5186,5337,5393]},"primary":{"picked":[3633,4004,4095,4289,4427,4537,4673,4797,4893,4896,4915,4946,4948,4963,4965,4984,4985,4993,5005,5024,5025,5086,5087,5091,5094,5098,5100,5102,5114,5119,5123,5124,5134,5152,5160,5183,5184,5189,5190,5207,5208,5210,5212,5213,5242,5250,5265,5270,5280,5284,5326,5331,5340,5348,5358,5364,5373,5392,5403,5407,5443],"missing":[],"deferred":[],"parked":[{"original":4167,"merge":"2af1e21299e161041e87d07d21fbfa4d81f97903","kind":"dependency","needs":[3861]},{"original":4234,"merge":"df42104b13ff01ca23a5a9f0835530b38824af16","kind":"dependency","needs":[5228]},{"original":4917,"merge":"44848b9c9d08f529bbef6e1347c2533a24121406","kind":"dependency","needs":[4089]},{"original":4945,"merge":"ea4968cf4613f696cd955bb1f66a7cfd877529ce","kind":"dependency","needs":[2352]},{"original":4954,"merge":"94d710e50fe728827cb34c0ff7023c772984d1d0","kind":"dependency","needs":[3494]},{"original":4970,"merge":"013b166967e72cdd441e3efde58a4bc1ef75192c","kind":"dependency","needs":[3594]},{"original":4971,"merge":"048c029e29607a0b4c5b9e3d9e3b70c76e53bb51","kind":"dependency","needs":[4089]},{"original":4972,"merge":"ba0b1ac6ef250048dd33657ff0aca9934900d612","kind":"dependency","needs":[4492,4658,4713]},{"original":4974,"merge":"60d1f53e82419ad2138807a54d1045007921d986","kind":"dependency","needs":[3315,4386]},{"original":4986,"merge":"e4d059ceddfee96d30dabe3c1a4fade5e18c55cf","kind":"dependency","needs":[3962,3964]},{"original":5011,"merge":"29e8522f4b8d2fdef964a8e3f60e1af44fcd08e9","kind":"dependency","needs":[4639]},{"original":5045,"merge":"382169be52d15f1a0ae4f3500039e0e8a9beb7fb","kind":"dependency","needs":[4552,4598]},{"original":5071,"merge":"7dc5c0b5e63e1a7b7308f8d18adf42cfb900148e","kind":"dependency","needs":[3940,4308]},{"original":5082,"merge":"94ada11eefdccc9040db71b710334c878f6bed83","kind":"dependency","needs":[3940]},{"original":5088,"merge":"b36628661f60d8076a1122487356406c6d5b86b9","kind":"partial","files":["packages/system/ingress-nginx/templates/admission-webhook-networkpolicy.yaml","packages/system/ingress-nginx/tests/admission_webhook_networkpolicy_test.yaml"]},{"original":5096,"merge":"6f8171db8990e5a0c12b216c37877abd0798213e","kind":"dependency","needs":[4380]},{"original":5133,"merge":"72ff22dc9ebd51c899f024ebefec111d8a36b7b1","kind":"dependency","needs":[4447]},{"original":5148,"merge":"b7e72840f92b15241f8dc451819f3a054e70d84a","kind":"dependency","needs":[3342]},{"original":5151,"merge":"23461e065d0fa210c2990122663e7f084f7b2a50","kind":"dependency","needs":[4832]},{"original":5153,"merge":"da17254bbc2c739c33c06139e7c2cfb280ae60c5","kind":"dependency","needs":[3280,3315,4713]},{"original":5175,"merge":"5a5d5cd3d85fec610516651ab9bc5623a83f62cf","kind":"dependency","needs":[3548,3637,3676,3723,3804,3836,3843,3886,3888,3889,3890,3919]},{"original":5211,"merge":"10e0ef9ece2b7a527c5c2c3fed9bdbecacdb668f","kind":"dependency","needs":[4674]},{"original":5226,"merge":"aa97451bc2cec98e9ac04131b9efd2a065983fff","kind":"dependency","needs":[3280]},{"original":5228,"merge":"238b3ee491f513302722972b50060e689292f826","kind":"dependency","needs":[3562,3580]},{"original":5230,"merge":"9e8e10c307584061f497e9b6506765c0e87b6c91","kind":"dependency","needs":[3562,3990,3992,4000,4929]},{"original":5236,"merge":"a2b341e31be2fc4d7c044a4f5ad5239d5f342af6","kind":"dependency","needs":[4563]},{"original":5249,"merge":"e5ab1d6a7e09ff10d92c497a3468c3f9800cff5b","kind":"dependency","needs":[4447]},{"original":5308,"merge":"30c4232be19bc1b887228d66e5e0fb8dc508547a","kind":"dependency","needs":[4819]},{"original":5329,"merge":"90797d9de977d791d32d16acf7286c848fa6aab2","kind":"dependency","needs":[4261,4756]},{"original":5352,"merge":"dec14c736d32cd12798de9af23363469986c7ed4","kind":"dependency","needs":[3861]},{"original":5354,"merge":"18a9530b873e557d0198c1b6f2bfeddead746445","kind":"dependency","needs":[5226]},{"original":5356,"merge":"4190aa82f5ef93a2bd4edd59a7e1db3f75bc8d01","kind":"dependency","needs":[4079]},{"original":5357,"merge":"ec8088e54c719be89fff58fcd17f88950a6cb1a0","kind":"dependency","needs":[4424]},{"original":5377,"merge":"d7573c009c482aacfc957954b9c1ae228c844ce7","kind":"dependency","needs":[4549]},{"original":5399,"merge":"22843c5c5c204249cf2599ad23abef203d492948","kind":"dependency","needs":[3315,5153]},{"original":5436,"merge":"40b4fc6ad4f39d3c449beee2a492fbd7f621b8ba","kind":"dependency","needs":[5377]}],"skipped":{"on-line":[],"before-start":[2195,2196,2198,2252,2352,2618,2621,2654,2666,2667,2680,2682,2683,2692,2698,2729,2914,2956,2984,3031,3115,3116,3158,3195,3208,3228,3260,3262,3266,3280,3315,3340,3341,3342,3353,3372,3373,3378,3379,3380,3383,3385,3391,3398,3399,3406,3407,3408,3409,3411,3412,3417,3421,3422,3427,3428,3429,3430,3435,3436,3441,3443,3444,3446,3447,3449,3454,3455,3460,3462,3463,3466,3468,3470,3471,3475,3476,3494,3495,3496,3500,3501,3505,3506,3507,3510,3511,3520,3522,3523,3524,3527,3529,3531,3535,3539,3546,3548,3551,3552,3557,3562,3564,3567,3569,3571,3572,3574,3575,3579,3580,3581,3584,3585,3586,3590,3591,3592,3593,3594,3595,3596,3598,3599,3602,3604,3605,3606,3607,3608,3616,3617,3620,3621,3622,3627,3630,3632,3636,3637,3639,3645,3647,3651,3659,3661,3662,3664,3670,3672,3673,3676,3677,3715,3723,3727,3735,3738,3742,3750,3760,3762,3763,3768,3769,3772,3775,3777,3780,3783,3784,3790,3791,3795,3797,3798,3799,3800,3802,3804,3808,3815,3817,3833,3834,3836,3837,3839,3840,3841,3843,3844,3845,3846,3848,3849,3856,3859,3860,3861,3862,3863,3872,3874,3886,3887,3888,3889,3890,3891,3897,3898,3899,3901,3907,3908,3910,3914,3919,3920,3922,3925,3926,3928,3931,3932,3934,3935,3936,3937,3938,3940,3945,3951,3954,3955,3956,3959,3960,3962,3963,3964,3967,3968,3969,3973,3980,3990,3992,3995,3997,4000,4011,4012,4013,4014,4015,4018,4019,4020,4021,4022,4023,4035,4039,4041,4042,4058,4063,4064,4077,4078,4079,4087,4088,4089,4090,4096,4097,4098,4099,4100,4101,4102,4103,4107,4109,4110,4121,4129,4130,4133,4134,4135,4136,4138,4143,4148,4152,4163,4170,4171,4182,4184,4185,4186,4188,4191,4200,4204,4220,4221,4222,4223,4225,4226,4228,4231,4232,4233,4236,4237,4242,4251,4252,4253,4254,4255,4256,4261,4271,4277,4278,4279,4280,4281,4282,4284,4286,4290,4291,4292,4293,4296,4299,4300,4306,4308,4317,4323,4326,4331,4333,4340,4341,4347,4356,4362,4363,4366,4367,4376,4379,4380,4381,4383,4386,4387,4390,4392,4394,4398,4399,4403,4405,4407,4411,4414,4415,4417,4424,4425,4426,4429,4436,4439,4441,4442,4443,4444,4447,4448,4451,4453,4455,4457,4458,4459,4460,4461,4462,4468,4469,4471,4473,4478,4480,4483,4485,4490,4492,4493,4494,4496,4497,4498,4501,4505,4512,4514,4517,4521,4522,4532,4534,4538,4544,4545,4549,4552,4557,4558,4562,4563,4567,4568,4569,4572,4573,4574,4576,4578,4583,4584,4585,4586,4587,4594,4595,4598,4603,4606,4608,4610,4612,4627,4632,4633,4634,4635,4637,4638,4639,4640,4643,4645,4648,4651,4652,4654,4657,4658,4660,4663,4664,4666,4669,4671,4672,4674,4675,4678,4682,4689,4692,4694,4695,4697,4701,4707,4710,4712,4713,4722,4724,4729,4738,4741,4742,4751,4754,4756,4757,4761,4766,4767,4768,4778,4779,4789,4790,4791,4792,4796,4799,4803,4804,4805,4807,4811,4812,4815,4819,4826,4828,4830,4831,4832,4833,4834,4843,4845,4847,4848,4861,4865,4866,4867,4873,4881,4888,4889,4898,4899,4914,4929,4936,4939,4940,4941,4955,4959,5027],"type":[2622,2664,2665,3149,3382,3440,4495,4508,4822,4859,4860,4869,4877,4879,4900,4902,4931,4944,4952,4953,4969,4983,4997,5000,5034,5039,5043,5046,5050,5090,5106,5110,5112,5144,5162,5168,5171,5174,5188,5214,5215,5216,5217,5218,5219,5220,5237,5238,5239,5240,5252,5254,5260,5264,5266,5267,5269,5277,5282,5285,5286,5287,5288,5306,5310,5318,5334,5336,5349,5360,5362,5372,5374,5376,5404,5408,5411,5424,5425,5428],"breaking":[4802,4818,5009,5085,5167,5191],"touches":[5166,5223,5430],"newer":[5049,5221,5224,5227,5229,5232,5294,5295,5309,5320,5344,5375,5398,5415,5426,5427],"skip-label":[4817,4921,4973,4989,4990,5083,5156,5163,5180,5186,5337,5393],"dropped":[4920,4960,5142,5155,5405]}},"overlays":{"dropped":[{"original":4920,"merge":"65cb73e38098a127d9c09bca3cf16d431222696e","reason":"its test needs newHandleTestWebhook from #4447, which never reaches release-1.6","on":5312,"date":"2026-11-26"},{"original":4960,"merge":"a5c58e5e985399a687e5f676a7321f828eda5ff7","reason":"builds on golden image checks of #4796, which is breaking and won't reach release-1.6","on":5312,"date":"2026-11-26"},{"original":5142,"merge":"5c564f9154ddc03387fd4cd6b7a9185b11b0bdb3","reason":"not needed on release-1.6, it ships only patches now and their changelogs are 8-22 KB, far below release body limit","on":5312,"date":"2026-11-25"},{"original":5155,"merge":"b53ca1fedebcc6288856995ada2629c06c9e4ae7","reason":"builds on init script passes from #4078 and #4574, release-1.6 doesn't have them and #4078 is breaking","on":5312,"date":"2026-11-26"},{"original":5405,"merge":"30ce2a3cb1de5b64e629780ef70349608d5cd05d","reason":"reverted on release-1.7 in #5461, comes to release-1.6 only as the hand port #5433 after #5459 is fixed","on":5312,"date":"2026-11-26"}],"stale":[],"changed":[4004,4673,4915,5119,5124,5210,5364,5373]},"diag":{},"other":[]}
```

### Screenshots

See the original pull requests.

### Downstream repositories

- [ ] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:

### Release note

```release-note
fix(tenant): retry a failed monitoring or gateway install instead of uninstalling the release, so a slow first install no longer runs the cleanup hooks that delete the tenant's metrics and logs volumes or its ACME account key

fix(harbor): set resources for the nginx proxy and raise the portal preset so neither is OOMKilled by the tenant LimitRange default (128Mi)

fix(bucket): the ACME cleanup hook now reaches the apiserver instead of reporting success while doing nothing

fix(monitoring): kube-apiserver is scraped with its own 128MB size limit (`vmagent.apiserverMaxScrapeSize` in the monitoring-agents component) instead of the global 32MB, so a large `/metrics` no longer makes KubeAPIDown fire on a healthy API server. A new VMAgentScrapeSizeExceeded alert reports any target whose response exceeds the scrape size limit.

fix(mariadb): correct webhook cert-manager override key path so cert-manager is actually used for the mariadb-operator webhook certificate

fix(etcd): the tenant etcd alert etcdHighNumberOfFailedGRPCRequests now counts only the gRPC codes that the etcd mixin and the platform copy of the alert count, so the Canceled watch streams of a Kubernetes API server that stops no longer fire it on every etcd member.

fix(tcp-balancer): HAProxy now takes its fd and thread caps from the replica's memory and CPU limits instead of the node, so a t1.nano balancer is no longer OOMKilled on nodes with many CPUs. maxconn follows the memory limit at about 16 connections per MiB, 2035 on t1.nano, and the pods roll once on upgrade.

fix(tenant): the tenant gateway release no longer times out on upgrade while TenantGateway listener certificates are pending, it waits only until the controller has observed the current TenantGateway spec.

fix(controller): existing HelmReleases now get `healthCheckExprs` and `waitStrategy` from their ApplicationDefinition. vm-disk and postgres releases created before these expressions were added stop waiting on DataVolume and KEDA ScaledObject during upgrades.

fix(cilium): the IPAM migration hook no longer fails with "Argument list too long" on clusters with more than a few nodes, which blocked the cilium upgrade and every package that depends on networking.

fix(kubernetes): the OIDC bootstrap Job no longer fails to start for a tenant cluster with about 240 or more oidc.users, the bindings now come from a ConfigMap the Job mounts.

fix(clickhouse): a RestoreJob now restores the archive its Backup was taken as, not the newest one. New Backups record the archive name, Backups taken before this release are restored best effort from the newest archive stamped no later than their takenAt, with a warning in the restore pod log. A ClickHouse BackupJob created again under a name whose Backup still exists now fails instead of reporting that Backup as its result.

fix(postgres): the init script renders the declared databases in a stable order, so an upgrade that leaves the databases unchanged no longer rewrites the init-script Secret.

fix(mariadb-operator): the MariaDB operator now uses the platform's networking.clusterDomain instead of a hard-coded cozy.local, so replication and User/Database/Grant reconciliation work on clusters with a non-default cluster domain.

fix(api): tenant quota admission now counts the parent pool's usage of extended resources and hugepages, so a child tenant can no longer get a share the parent has already used. After upgrading, updates to existing tenants may be rejected if their quota for these resources exceeds the parent's remaining budget. This includes updates that leave the quota unchanged.

fix(mariadb): a MariaDB BackupJob or RestoreJob whose operator Job failed now ends Failed instead of Succeeded, and a failed backup no longer creates a Ready Backup without an archive. Backups created by failed runs before this fix are not removed; restoring from one can fail or select another dump from the shared prefix.

fix(kubernetes, monitoring): the vmagent of tenant Kubernetes clusters now writes to the tenant's vminsert and labels series with the owning tenant instead of `cozy-monitoring`. Previously no tenant cluster metric reached the tenant's Monitoring.

fix(seaweedfs): bucket users granted together could get S3 keys that never work (403 InvalidAccessKeyId). COSI driver is bumped to v0.4.0, which writes each grant to per-identity IAM file.

fix(monitoring-agents): disabling the Monitoring Agents addon of a tenant Kubernetes cluster no longer leaves the monitoring-agents release stuck in UninstallFailed when the VictoriaMetrics operator is removed first; a pre-delete hook now releases the VictoriaMetrics objects' finalizers, and the VPA is only rendered when its CRD is served.

fix(vm-instance): an external PortList VM with an empty port list no longer fails to deploy; it keeps its external IP and blocks all inbound TCP and UDP traffic.

fix(backups): the barman-cloud sidecar of Postgres backups now has an explicit one-core CPU limit instead of inheriting the tenant LimitRange's 250m default, which made full backups and WAL archiving several times slower. Each instance pod of a tenant with a CPU quota now counts 750m more against `limits.cpu`; check the headroom before instance pods are recreated. Existing ObjectStores pick the limit up at their next backup (platform-managed) or HelmRelease upgrade (chart-rendered), and running pods at their next restart.

fix(etcd): the tenant etcd defrag job requests 10m and 32Mi instead of 200m and 256Mi, so it runs in tenants whose quota is nearly used up by their own services.

fix(monitoring): vmalert metrics are collected again. The vmalert VMServiceScrape selected app.kubernetes.io/instance=vmalert while the Service is labelled vmalert-<first metrics storage>, so it matched nothing.

fix(ingress-nginx): raise the client keepalive_time from the nginx 1h default to 12h, so long-lived HTTP/2 connections (for example kopia maintenance against S3) are no longer cut by a GOAWAY after one hour

fix(monitoring-agents): a Watchdog that stops reaching Alerta now raises a major HeartbeatFail about six minutes later. It used to raise an ok alert after a day.

fix(monitoring): InfoInhibitor no longer reaches Alerta as a major alert. It carries severity none again, which the platform Alertmanager routes to the blackhole, as upstream kube-prometheus intends. Before, any active alert with severity info, from a custom rule or from one CDI or KubeVirt generates, raised a major InfoInhibitor in Alerta and in its Telegram and Slack notifications.

fix(vertical-pod-autoscaler): the admission controller runs two replicas spread over nodes with a PodDisruptionBudget, so pods created during a drain still get their VPA recommendation.

feat(monitoring): new warning alert PodReplicasColocated fires when two or more running pods of one StatefulSet, ReplicaSet, CNPG Cluster, StrimziPodSet or etcd cluster have shared a node for an hour while the cluster has a schedulable node for each of them.

fix(kubevirt): tenant admins can upload an image into a VMDisk created with source upload using virtctl image-upload. The tenant admin and super-admin roles get get on persistentvolumeclaims and create on upload.cdi.kubevirt.io/uploadtokenrequests, and the vm-disk notes print the command with --no-create.

fix(piraeus-operator): the LINSTOR error-report alerts no longer fire on old reports when the LINSTOR controller pod moves to another node, when an external label of the scrape changes, or when a satellite reconnects within an hour. They now count reports per node, and their alerts carry the node's hostname instead of the controller pod's instance, job and controller_node labels.

fix(keycloak, foundationdb): keycloak-operator and foundationdb-operator now replace their CRDs on upgrade. Clusters upgraded from before v1.2.0 kept the v1.25.0 keycloak-operator CRDs, under which the apiserver dropped the Keycloak realm session settings and Keycloak could reject the dashboard client, and clusters upgraded from before v1.6.0 kept the v2.13.0 foundationdb-operator CRDs.

fix(tcp-balancer): the Service now publishes ports 6443 and 50000 only when kubernetesAndTalos is set, like the Deployment and the HAProxy config. Before, every tcp-balancer Service carried both ports with no container port behind them, on the LoadBalancer too when external was enabled, and a release with kubernetesAndTalos but without httpAndHttps had no Service port for them.

[vpa] Shorten the VPA admission webhook timeout to 5s so pod creation does not stall cluster-wide while the admission controller is unreachable.

fix(controller, platform): sub-tenants without their own resourceQuotas now receive their parent pool's container defaults (LimitRange) alongside the allocated quota, when that quota bounds a CPU or memory limit, so pods that omit such a limit, such as the postgres barman-cloud backup sidecar, are no longer rejected at admission.

fix(etcd): scope tenant etcd alerts to their release and avoid duplicate tenant peer RTT alerts from the global rules

fix(cozy-lib): a tenant quota with hugepages-2Mi or hugepages-1Gi now renders only requests.hugepages-<size>, so the tenant installs and its huge pages are bounded.

fix(seaweedfs): grant existing bucket credentials the Object Lock actions required by SeaweedFS 4.48 on install and upgrade, preserving their bucket restrictions and credentials.

fix(kamaji): stop writing kubelet config fields that older tenant Kubernetes versions do not know, such as memoryReservationPolicy on tenants before v1.36, so strict decoders of the kubelet-config ConfigMap no longer fail.

fix(qdrant): restore metrics scraping for TLS-enabled instances by using HTTPS and verifying the server certificate against the issued CA.

fix(kubernetes): remove cilium dependency from coredns HelmRelease to prevent a circular startup deadlock when Hubble Relay is enabled

fix(securitygroups): a port range now gets a clear "port ranges are not supported" error, and a malformed toFQDNs matchName or matchPattern is rejected on the SecurityGroup field instead of failing on the backing CiliumNetworkPolicy.

fix(postgres): a user named `app` no longer loses its password when the Postgres pod restarts. CNPG re-applied its own generated password to the `app` owner role on every pod start; the chart now hands CNPG the password stored in `<release>-credentials`.

fix(linstor): linstor-affinity-controller and linstor-scheduler now restart when their LINSTOR client certificate is rotated, instead of failing every LINSTOR API call with EOF once the certificate they loaded at startup expires.

fix(linstor): the NFS server's linstor-wait-node-online init container now runs the platform-built linstor-csi image instead of the operator's default.

fix(api): a resourceVersion from a WorkloadMonitor-triggered Application watch event now works as a delete precondition, and the event's spec matches its version.

fix(api): reject new workload memory values below 1Mi before storing an application. Updates to unrelated fields on existing applications with smaller values still pass admission.

fix(harbor): Harbor registry storage is billed again. The WorkloadMonitor controller finds BucketClaims by label, and the registry BucketClaim had no labels. It now carries the registry monitor's `release` and
  `component` labels, so its storage shows up as Workload under the registry WorkloadMonitor, the same way the registry PVC did before it moved to S3. And also registry WorkloadMonitor now reports not operational while the BucketClaim is not provisioned

fix(platform): system PostgreSQL databases (Keycloak, Harbor, Grafana, Alerta, SeaweedFS) move from 17.7 to 17.12-standard-trixie, which fixes CVE-2026-116331. On upgrade each of these databases is rolled: replicas first, then the primary is restarted in place, with a brief interruption of a few minutes per database.

fix(cozystack-basics): tenant super-admins can no longer create, edit or delete `kubevirt.io` VirtualMachines directly; they keep read and watch. Virtual machines are managed through VMInstance and VMDisk applications, power through the start/stop/restart actions. The install e2e now fails when a tenant super-admin gains a write verb outside a checked-in allowlist.

fix(ingress-nginx): TLS session tickets are turned off in the ingress-nginx controller (CVE-2026-97629). TLS session resumption keeps working through the shared session cache.

fix(ingress): restore visitor IP handling for Cloudflare-proxied HTTPS through ssl-passthrough while rejecting spoofed `CF-Connecting-IP` headers before IP whitelists
```
v1.6.6-rc.1
2026-11-27 10:16:05 +05:00
Andrei Kvapil d85c8d7c7b security(monitoring): pin the Alerta image by digest
The entrypoint and nginx template mounted over the image are copies of
alerta-web 9.1.0 at this digest. A retagged image could carry different
files, and the mounted copies would then no longer match it.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2026-11-27 05:46:06 +01:00
Andrei Kvapil 51acf0fcbb security(monitoring): reset the Alerta admin password on every start
The entrypoint creates admin users only when they are missing, so an
admin user created before Alerta had a password of its own keeps the
Grafana password, which stays valid after an operator rotates Grafana's.
The mounted entrypoint runs a step right after user creation that sets
every admin user's password to ADMIN_PASSWORD, and stops the container
if it fails.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2026-11-27 05:40:32 +01:00
Andrei Kvapil cbdb4f64a5 security(monitoring): show tenants Alerta's login apart from its keys
Tenants logged in to the Alerta UI with the Grafana credentials, the
only Secret of the release they are shown. With Alerta on a password of
its own, that password moves to a Secret that holds nothing but the
login, listed for tenants next to Grafana's, so the signing key and the
API key in the alerta Secret stay hidden. The alerta Secret is now
rendered under data alone.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2026-11-27 05:40:01 +01:00
Andrei Kvapil 77c74ea04a test(backups): register the RestoreJob status subresource in the fake client
The restore tests on this line build their fake client without a
status subresource for RestoreJob, so a reconcile that fails the job
through Status().Update gets NotFound instead of a Failed phase. The
cross-tenant checks backported here are the first tests on this line
to take that path; main already registers it.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2026-11-27 05:15:26 +01:00
Andrei Kvapil bd1bdc7a38 security(monitoring): keep Alerta credentials out of its container log
The Alerta entrypoint prints the whole environment, including the admin
password and API key, and echoes the admin API keys it creates, while
nginx logs the request line where Alertmanager passes the key as a
query parameter. Pod logs are readable at lower tenant tiers than the
credentials themselves.

This line runs the upstream image, so the entrypoint and nginx template
are mounted over the image's copies from a ConfigMap, changed only to
drop that output and mask the parameter.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2026-11-27 05:13:48 +01:00
Andrei Kvapil 661be40703 test(harbor): select the nested HelmRelease by kind
The registry credential Secret now renders ahead of the HelmRelease,
so a fixed document index points the storageClass assertions at the
wrong object. Select the release by kind, as main already does.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2026-11-27 05:13:12 +01:00
Andrei Kvapil 2682f9d3b8 fix(harbor): roll jobservice without a surge
jobservice keeps its job log on a ReadWriteOnce volume, but the
upstream chart rolls it with the default surge. When the replacement
lands on another node it waits on the volume attach for good, and the
nested release fails as stalled. The registry credential rotation
restarts jobservice on every existing release, so the upgrade would hit
this on any multi-node cluster.

Only jobservice is changed, through a post-renderer: the chart's own
switch to Recreate also applies to the registry, which keeps its data
in S3 and should go on rolling without an outage.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
(cherry picked from commit 4d0331167b)
2026-11-27 05:12:10 +01:00
Andrei Kvapil 428d5a5e0f security(harbor): give the inner registry its own credential and port policy
The Harbor application never set a credential for the registry that
Harbor core and jobservice talk to, so the vendored chart's published
default applied, and the registry Service accepted it from any pod the
tenant network policies let through. That bypasses Harbor's own
authorisation, quotas and audit log.

Each release now gets a random registry password with a matching
htpasswd line, kept in a Secret that stays out of the tenant-visible
allowlist and is reused across upgrades so the bcrypt salt does not
restart the registry on every reconcile. An existing installation
rotates on upgrade: core, jobservice and registry roll together because
their Secret checksums change; registry storage is untouched.

The inner chart also ships a CiliumNetworkPolicy that denies the
registry and registryctl ports to everything but core, jobservice and
trivy of the same release. A deny is needed because the tenant base
policy already allows the traffic and Cilium allow rules are additive.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
(cherry picked from commit 40525fc756)
2026-11-27 05:12:09 +01:00
IvanHunters ed1b86fda5 fix(backups): confine Velero restore-copy to the tenant's namespace subtree
A RestoreJob with the Velero strategy took options.targetNamespace verbatim
and, for a cross-namespace copy, checked only that the namespace existed. A
tenant administrator could restore their own backup - Secrets, PVCs and data
included - into any other tenant's namespace, or overwrite an application
there. GHSA-vq9c-8j6p-r6mp / GHSA-p7mc-34g4-53vv / GHSA-4295-xcmq-8h9h.

Require the target namespace to carry the tenant.cozystack.io/<restoreJob
namespace> subtree label, the same marker the Cilium egress and
tenant-namespace delete policies already use. The target is then the
RestoreJob's own namespace or a descendant; a different tenant, a parent, a
sibling or a system namespace is refused before any Velero Restore is created.
Restore-copy within a tenant's own subtree keeps working.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
(cherry picked from commit 5780952b45)
2026-11-27 05:11:48 +01:00
Andrei Kvapil 479245f4f1 fix(monitoring): give Alerta a real signing key and its own admin password
Alerta signs its session JWTs with SECRET_KEY, but the upstream image never
wires a real value into it: the entrypoint renders the generated key into
alertad.conf under the name SECRET (which the application never reads) and
unsets SECRET_KEY before exec, so at runtime the built-in default from
alerta.settings ("changeme") signs and verifies every token. Anyone can mint
a valid admin token without credentials.

Alerta's admin account also reused Grafana's credentials
(grafana-admin-password), and Alerta exposes the whole process environment via
/api/management/properties to any admin-scoped caller, so admin on Alerta
yielded Grafana's admin password.

Generate a strong SECRET_KEY and a dedicated admin password, persist both in
the alerta Secret so they survive upgrades and restarts, feed the key to the
application through a mounted alertad.conf under the name it actually reads,
and stop referencing grafana-admin-password. Add a unittest covering the key,
the mount and the credential decoupling.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
2026-11-27 05:11:44 +01:00
Myasnikov Daniil 6b310132a6 fix(backups): delete the Velero backup of a failed BackupJob (#5364)
<!-- Thank you for making a contribution! Here are some tips for you:
- Use Conventional Commits for the PR title: `type(scope): description`
- Types: feat, fix, security (a fix that comes through a security
advisory), docs, style, refactor, perf, test, build, ci, chore
- Scopes are not an exhaustive list — pick the most specific scope for
the change and extend the list when a genuinely new area appears.
Examples:
- System components: dashboard, platform, operator, cilium, kube-ovn,
linstor, fluxcd, cluster-api
- Managed apps: postgres, mariadb, redis, kafka, clickhouse,
virtual-machine, kubernetes
- Development and maintenance: api, hack, tests, ci, docs, maintenance
- Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or
add a `BREAKING CHANGE:` footer
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Fixes merged to `main` reach the release lines the backport batch runs
for automatically, so do not open backport PRs by hand:
https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md
-->

## What this PR does

<!-- Link the issues this PR addresses. For a complete fix targeting the
default branch, use Closes #N (Closes owner/repository#N for another
repository). Otherwise use a non-closing reference; release-branch PRs
need manual issue linking and closure when appropriate. -->

Closes #5355

A BackupJob whose Velero backup ends `Failed` or `PartiallyFailed`
leaves that `backup.velero.io` object and its data in the backup bucket
(partial resources, logs) until Velero's TTL expires it, 720h by
default. No `Backup` is created for a failed run, and the `Backup`
finalizer was the only code that asked Velero to delete backup data;
deleting the BackupJob does not remove it either, because the Velero
backup is only labelled for the job, not owned by it.

The first commit requests deletion of the failed Velero backup through a
`DeleteBackupRequest`, and turns the reconcile of a `Failed` BackupJob,
which returned at once, into a sweep over the Velero backups still
labelled for the job. That sweep also cleans up backups leaked by
earlier versions after an upgrade. The request creation is shared with
the `Backup` finalizer and named after the Velero backup, so repeated
reconciles converge on one request. The failure message is unchanged.

The second commit narrows that sweep and makes it converge:

- Only `Failed`, `PartiallyFailed` and `FailedValidation` Velero backups
are deleted. A `Completed` one is never touched from a job-level
failure: a job can fail after Velero completed (creating or recording
the `Backup` failed), and that Velero backup may be the only copy of
good data.
- Deletion is requested only after `Failed` is persisted. The strategy
no longer sends the request inline, so a failed status write cannot
leave a retried run without the backup it reports the failure from. The
BackupJob watch has no predicate, so the `Failed` status update itself
triggers the sweep.
- While a failed backup still exists, the job is requeued every 5
minutes. Nothing watches `DeleteBackupRequest`, so this is how a request
Velero processed with errors is noticed and replaced. A backup that is
still running is rechecked every minute.
- Backups that reference the Velero backup are read through the uncached
API reader before anything is deleted.
- The ClusterRole of `backupstrategy-controller` gains `delete` on
`deletebackuprequests`, needed to replace a processed-with-errors
request. The `Backup` finalizer shares the helper, and without the verb
that path would fail with 403.

The third commit makes a deletion that Velero could not finish converge,
and makes it visible:

- A Velero backup in `Deleting` goes through the same request path.
Velero sets that phase before it removes the data and leaves it there
when removal fails, so skipping it left the data in place until the TTL.
- Our own request that Velero processed while the backup still exists is
replaced, whether it carries errors or not. The second case is a backup
that the BSL sync brought back.
- Each replacement emits a `VeleroBackupDeletionFailed` Warning event on
the BackupJob with Velero's `status.errors`, and doubles the wait before
the next replacement, 5 minutes up to 1 hour (enforced from the recorded
attempt time since the fourth commit). The count is kept in the
`backups.cozystack.io/velero-deletion-retries` annotation on the
BackupJob. A missing, read-only or unavailable BSL therefore shows up in
`kubectl describe` instead of being retried silently every 5 minutes.

The fourth commit makes the backoff binding rather than advisory:

- Each request the sweep creates records its time in the
`backups.cozystack.io/velero-deletion-attempted-at` annotation, next to
the retry counter. A request Velero has processed is replaced only once
the backoff for the current retry count has passed since that time.
Writing the annotations triggers a reconcile at once, because the
BackupJob watch has no predicate; that reconcile now only computes the
remaining wait. Before, with a BSL that fails instantly, it could
replace the request again right away.
- A request Velero has not processed yet, and a Velero backup still in
`New` or with no phase, are checked again after as long as they have
already waited: between 5 minutes (1 minute for a running backup) and 1
hour. Waiting emits no event.
- If the job was deleted before the annotations are written, the sweep
stops quietly. Any other error writing them is logged, and the computed
requeue is kept, because the request already exists.

Points for the reviewer:

- The sweep matches on the BackupJob labels, not on the strategy kind,
because a `Failed` job's BackupClass may be gone. The Kubernetes
strategy labels its Velero backup the same way and has the same leak on
failure, so a failed Kubernetes strategy run is cleaned up by the sweep
as well.
- The Velero strategy still treats a `FailedValidation` Velero backup as
in progress and requeues the BackupJob indefinitely. That is unchanged
here; the sweep already treats `FailedValidation` as deletable.
- After the upgrade, the Velero backups of BackupJobs that already
failed are deleted. An operator who wants one of them for a manual
`velero restore` must copy it first.

### Screenshots

<!-- REQUIRED for UI changes: attach screenshots or screen recordings
demonstrating
the visual impact of your changes. PRs with UI changes without
screenshots will not be merged. -->

N/A — no UI changes.

### Downstream repositories

<!--
Cozystack is upstream for repositories that are NOT kept in sync with it
automatically, and nothing in CI compares the two sides, so a change
here can break them silently.

Which change forces what, and which file to touch, is the trigger map in
docs/agents/contributing.md under "Downstream Repositories". Walk it
before you tick anything.

IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM
TO FILL IN:

1. Walk the trigger map against the actual diff of this PR, file by
file. Do not decide from the PR title or from your memory of what you
changed.
2. For every repository you tick, open the follow-up PR there and link
it on the same line. A ticked box with no link claims work that does not
exist, which is worse than an empty box. Search that repository for an
open PR or issue covering it first, and link that instead of filing a
duplicate.
3. When the follow-up is out of scope, or needs a decision that is not
yours to make, open an issue in that repository instead, link that, and
say so in the PR body. Do not push a speculative PR into another
repository just to fill a line here.
4. Do not tick "No downstream repository is affected" to make the
checklist go away. If you are unsure, leave every box empty and say so
in the PR body, so a human decides.
-->

The diff touches Go code in `internal/backupcontroller/` and one chart
file, `packages/system/backupstrategy-controller/templates/rbac.yaml`,
which adds the `delete` verb on `deletebackuprequests` to the
controller's ClusterRole. Walked against the trigger map:

- website: no package, platform value, variant, component, release
asset, ApplicationDefinition, Talos or tooling change. The ClusterRole
is not documented there.
- terraform-provider-cozystack: no app, schema field, enum, default,
`kind`/`plural`, prefix, or `Package`/`Plan`/`RestoreJob` CRD change.
- ansible-cozystack, talm, examples: no installer value, namespace,
variant, platform value, node prerequisite, or object the role waits on.
- ccp, external-apps-example: nothing under `hack/`, no package layout,
`-rd` path, variant, `tags.yaml`, `ApplicationDefinition` CRD or
commit-convention change.
- cozyhr, cozy-proxy, cozystack-telemetry-server, community: none of
their annotations, labels, metrics, `hack/package.mk` targets, PR
template or commit convention change.

No entry applies.

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same `type(scope):` prefix as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
fix(backups): a BackupJob whose Velero backup ends Failed, PartiallyFailed or FailedValidation now asks Velero to delete that backup and its data in the bucket, instead of leaving them until Velero's TTL expires. A Velero backup that completed is never deleted this way. If Velero cannot carry out the deletion (for example, the backup storage location is missing, read-only or unavailable), the BackupJob gets a `VeleroBackupDeletionFailed` Warning event with Velero's errors, and the deletion is retried at a growing interval of up to one hour. After upgrading, the Velero backups of BackupJobs that already failed are deleted as well; to keep one for a manual `velero restore`, copy it before the upgrade. The backupstrategy-controller ClusterRole gains `delete` on `deletebackuprequests`.
```

Backported-from: 7f31011b99
2026-11-26 16:19:34 +00:00
Myasnikov Daniil 40af058885 fix(clickhouse): restore the archive a Backup was taken as (#5208)
## What this PR does

A ClickHouse `RestoreJob` restored the newest archive under the app
prefix, whichever `Backup` it named. Strategy pod generated the archive
name with `date -u` and nothing was recorded on the `Backup`, so restore
could only list the remote archives and take the last one. Restoring an
older `Backup` brought back the latest data.

Now the controller names the archive before it creates the backup Job
(`clickhouse-<app>-<startedAt>` from persisted `status.startedAt`, so
retried pods write the same one), passes it to the pod as `.ArchiveName`
and records it in the `Backup` `driverMetadata`. Restore takes exactly
that archive and fails with its name when storage has no such archive.
The name is recorded only when the Job's pod got it, so a Job left from
the previous controller during an upgrade, or a custom strategy with its
own names, leaves no name instead of a wrong one.

A retried pod reuses the name, so it waits for an attempt the sidecar
still runs (no 423) and asks for `resume`.

A `Backup` outlives its `BackupJob` and a Plan names `BackupJob`s after
the schedule slot, so a `BackupJob` created again under a used name met
the earlier run's `Backup` when its Job completed, took it as its result
and left the archive it just wrote recorded nowhere. Now it fails if
that `Backup` records another archive, and the message names both. A
retry of the same run still gets its own `Backup` back.

Old `Backup`s have no recorded name and stay restorable: the pod logs a
`WARNING` and takes the newest archive stamped no later than `takenAt`,
and fails when nothing qualifies. While the chart rolls out, previous
controller pod can still render the new template and pass no `takenAt`,
so a restore of a `Backup` without recorded name fails before it touches
any table, and works when created again after the rollout.

Fixes https://github.com/cozystack/cozystack/issues/5199

Tests are go unit tests for naming, recording, a reused `BackupJob` name
and restore render, and `hack/altinity-backup-strategy.bats`, which runs
the shipped script against a stubbed clickhouse-backup API (the restore
tests go red on the old template). Checked on a live ClickHouse with two
backups of 1500 and 2000 rows: restore of the older one by recorded name
ends with 1500 rows, fallback for an unnamed older backup picks the same
archive with the warning, a missing archive fails without touching the
table, a retry over an existing local backup completes under the same
name. The controller binary itself was not run on the cluster, only its
rendered output in the pod.

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
fix(clickhouse): a RestoreJob now restores the archive its Backup was taken as, not the newest one. New Backups record the archive name, Backups taken before this release are restored best effort from the newest archive stamped no later than their takenAt, with a warning in the restore pod log. A ClickHouse BackupJob created again under a name whose Backup still exists now fails instead of reporting that Backup as its result.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Backups now use a consistent archive name tied to the backup job, and
completed backups retain that name for future restores.
* Restores can select the recorded archive and backup timestamp. If no
archive was recorded, the system selects the newest eligible archive for
the application.
* **Bug Fixes**
* A restore now fails when its recorded archive is missing instead of
silently selecting a different one.
* Backup requests avoid starting a duplicate action when the matching
action is already in progress.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Backported-from: 970191dc8a
2026-11-26 16:19:34 +00:00
Andrey Kolkov ee1d64c4e2 fix(backups): enforce the Velero deletion backoff of failed BackupJobs
The retry backoff of the failed-job sweep only set RequeueAfter. Writing the
retry counter onto the BackupJob triggers a reconcile at once, since the
BackupJob watch has no predicate. When Velero processes a request instantly,
as it does when the backup storage location is missing or read-only, that
reconcile replaced the request again, emitted another event and raised the
counter without any wait. The sweep now records when it last created a
request, in the backups.cozystack.io/velero-deletion-attempted-at annotation,
and replaces a processed request only after the backoff for the current
count has passed since then. Before that, it requeues for the remaining
time.

A request Velero never processes, because Velero is down, and a Velero
backup stuck in New or with no phase were checked at a fixed interval,
each check with an uncached list of Backups. They are now checked again
after as long as they have already waited, from the request's or the
backup's creation time, capped at one hour. Waiting emits no event.

Recording the attempt can fail after the request was created. If the job
was deleted meanwhile, the sweep ends without an error. Any other error is
logged and the computed requeue is kept, because failing the reconcile
would only retry sooner.

Unit tests drive the clock through two back-to-back reconciles of an
instantly processed request (one replacement, one event), then three
retries at 10, 20 and 40 minutes. They also check the waiting intervals for
requests and backups of different ages, and both annotation write errors.

Refs: #5355
Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
(cherry picked from commit dbc088f862)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-26 16:19:34 +00:00
Myasnikov Daniil 0acc4d3dfa fix(backups): fail a ClickHouse BackupJob whose Backup name is taken
A Backup outlives the BackupJob that made it, so a BackupJob created
again under a name already used meets the earlier run's Backup when its
own Job completes. That happens by hand, and from a Plan reconciled
again inside its starting deadline, since a Plan names each BackupJob
after its schedule slot. The Altinity driver took the earlier Backup as
its result: the BackupJob turned Succeeded with a BackupRef recording
the earlier run's archive, the archive this run wrote was recorded on
nothing, and restoring what the BackupJob reported brought back the
older data.

An existing Backup is now taken as this run's only when it records this
run's archive, which is what an earlier reconcile of the same run
leaves when its status write is lost. Any other fails the BackupJob,
naming both archives, and leaves the earlier Backup untouched.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
(cherry picked from commit d7ae34dfc3)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-26 16:19:34 +00:00
Andrey Kolkov 6d70eb20de fix(backups): retry stuck Velero deletions of failed BackupJobs and report them
Velero marks a backup Deleting before it removes the data and leaves it in
that phase when removing the data fails, with the deletion request
processed with errors. The failed-job sweep skipped Deleting backups and
did not requeue for them, so their data stayed in the bucket until
Velero's TTL. Deleting backups now go through the same request path: a
pending request is left alone, and a processed one of ours is replaced.

A request of ours that Velero processed without errors is also replaced
when the backup still exists, for example after the BSL sync brought it
back. Otherwise the request name blocked a new attempt until Velero
garbage-collects processed requests a day later.

When Velero can never carry out the deletion, because the backup storage
location is missing, read-only or unavailable, the sweep replaced the
request every 5 minutes without any sign of it. Each replacement now
emits a VeleroBackupDeletionFailed Warning event on the BackupJob with
Velero's status.errors, and doubles the requeue interval from 5 minutes
up to 1 hour. The count is kept in the
backups.cozystack.io/velero-deletion-retries annotation, because the
replaced request is gone and a requeue carries no state. The
controller's ClusterRole already allows patching BackupJobs.

Unit tests cover a Deleting backup with a pending request and with an
errored one, a cleanly processed request whose backup still exists, an
errored request under a foreign name that is left alone, three
consecutive failed deletions (three events, 10m, 20m and 40m requeues,
the 1h cap), and a cluster without the Velero CRDs.

Refs: #5355
Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
(cherry picked from commit 73df99b77d)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-26 16:19:34 +00:00
Andrey Kolkov 1dc45c6ec6 fix(backups): keep completed Velero backups of failed BackupJobs
The failed-job sweep treated a Completed Velero backup as deletable. A
BackupJob can fail after Velero completed, when creating or recording its
Backup fails transiently, and that Velero backup may be the only copy of a
good backup. The sweep now deletes only Failed, PartiallyFailed and
FailedValidation backups, also when several Velero backups reference one
job, and it reads the Backups that may reference them through the uncached
API reader, so a Backup the cache has not seen yet still protects its data.

The Velero strategy no longer requests the deletion before it records the
failure. If that status write failed, Velero removed the backup and the
retried run created a new one, so the failure was lost. The deletion now
comes only from the sweep, which runs on the reconcile that the persisted
Failed phase triggers; the BackupJob watch has no predicate that drops
status updates.

Replacing a request that Velero processed with errors deletes it, and the
backupstrategy-controller ClusterRole only allowed create, get, list and
watch on deletebackuprequests. That Delete failed with 403, and since the
Backup finalizer uses the same helper, a Backup deletion could get stuck
on it. The rule now includes delete.

Nothing watches DeleteBackupRequests, so the sweep did not run again after
Velero processed a request with errors. A Failed job now requeues every
5 minutes while a failed Velero backup of it remains, which replaces such a
request, and every minute while one is still running, instead of every 5
seconds.

Unit tests cover a rejected Failed status write, Completed, Deleting and
FailedValidation backups, a request processed with and without errors, the
UID precondition on the replacement, a Backup visible only to the uncached
reader, and API errors from the helper.

Refs: #5355
Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
(cherry picked from commit 887453c008)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-26 16:19:34 +00:00
Andrey Kolkov 9967676a68 fix(backups): delete the Velero backup of a failed BackupJob
When a Velero strategy run ended Failed or PartiallyFailed, no Backup was
created, and the Backup finalizer was the only code that asked Velero to
delete backup data. The failed backup.velero.io object, labelled for the
BackupJob but not owned by it, stayed in the bucket with its partial
resources and logs until Velero's TTL (720h by default) expired it, and
deleting the BackupJob did not remove it.

The strategy now requests the deletion through a DeleteBackupRequest before
it marks the job Failed, and the failure message is still read from the
Velero backup first. A direct delete is not enough, because the BSL sync
recreates the object from the object store. A reconcile of a Failed
BackupJob, which used to return at once, now requests deletion of every
Velero backup still labelled for the job. That retries a request that could
not be created and removes backups that earlier versions leaked, after an
upgrade. A Velero backup that a Backup references (the job failed after its
Backup was created) is left alone, and one still running is polled until
Velero accepts a request for it. The sweep matches on the job labels, so it
also covers the Velero backup of a failed Kubernetes strategy run.

The request is named after the Velero backup, and the Backup finalizer uses
the same helper, so repeated reconciles converge on one request. Nothing is
created while another request for the backup is pending. A request that
Velero processed with errors is replaced, because Velero keeps it for a day
and its name would block the retry until then. A job with more than one
Velero backup now fails with a message that names them, not with an empty
one.

Fake-client unit tests cover Failed and PartiallyFailed runs, a repeated
reconcile, leftovers of already Failed jobs (no request, a pending request,
a request processed with errors, a Backup-referenced backup, a running
backup) and the unchanged Succeeded path.

Closes: #5355
Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
(cherry picked from commit 5fbf7e9a38)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-26 16:19:34 +00:00
Myasnikov Daniil 529b3b6729 fix(lineage, kubernetes): resolve CAPK node VMs to their cluster (#5124)
<!-- Thank you for making a contribution! Here are some tips for you:
- Use Conventional Commits for the PR title: `type(scope): description`
- Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore
- Scopes are not an exhaustive list — pick the most specific scope for
the change and extend the list when a genuinely new area appears.
Examples:
- System components: dashboard, platform, operator, cilium, kube-ovn,
linstor, fluxcd, cluster-api
- Managed apps: postgres, mariadb, redis, kafka, clickhouse,
virtual-machine, kubernetes
- Development and maintenance: api, hack, tests, ci, docs, maintenance
- Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or
add a `BREAKING CHANGE:` footer
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `kind/backport` if it's a bugfix that needs to be
backported to a previous version.
-->

## What this PR does

The virt-launcher pods of Kubernetes worker nodes are never marked as
managed by the lineage webhook, so anything that relies on the webhook
having resolved them misses them. The visible symptom: a SecurityGroup
attached to a `Kubernetes` application labels the control-plane pods but
never the worker nodes, because the securitygroup-controller caches only
pods carrying `internal.cozystack.io/managed-by-cozystack=true`.

**Root cause.** The webhook is not skipped for these pods (they do not
carry the managed-by label, so the `objectSelector` lets them through);
it runs and fails to resolve their owner chain. The walk goes Pod →
VirtualMachineInstance → VirtualMachine and stops there: the Cluster API
KubeVirt provider creates the VirtualMachine with no ownerReference and
links it to its KubevirtMachine through the
`capk.cluster.x-k8s.io/kubevirt-machine-{name,namespace}` labels only.
With no ownerReference, no HelmRelease kind and no
`helm.toolkit.fluxcd.io/name` label on the VM, `WalkOwnershipGraph`
returns no ancestor, `computeLabels` returns nothing and the pod is
admitted unmanaged. The
`apps.cozystack.io/application.{group,kind,name}` labels the pods do
carry come from the `KubevirtMachineTemplate` in
`packages/apps/kubernetes-nodes/templates/nodegroup.yaml`, not from the
webhook.

**Measured on a v1.6.5 cluster.** Every Kubernetes cluster on it showed
the same shape (three clusters across two tenants). For one worker node:
the pod carries the three lineage labels but not `managed-by-cozystack`;
the pod is owned by its VMI and the VMI by its VM; the VM has no
ownerReferences, and its labels include
`capk.cluster.x-k8s.io/kubevirt-machine-name` and
`capk.cluster.x-k8s.io/kubevirt-machine-namespace` pointing at a
KubevirtMachine in the same namespace. From there ownerReferences run
KubevirtMachine → Machine → MachineSet → MachineDeployment → Cluster,
and the CAPI Cluster carries `helm.toolkit.fluxcd.io/name:
kubernetes-<name>`. The bridge is one hop. Setting
`managed-by-cozystack=true` by hand on a worker's virt-launcher pod made
the securitygroup-controller stamp the membership label within ten
seconds.

**Fix.** `WalkOwnershipGraph` now follows a VirtualMachine without
ownerReferences to the KubevirtMachine named by its CAPK labels, and
keeps walking from there. Node pods then resolve to the parent
`Kubernetes` application, which is the attribution the machine template
already hard-codes, and they get `managed-by-cozystack` like every other
managed pod. The bridge is only taken when the label names the VM's own
namespace: CAPK can target an external infrastructure cluster, and the
walk must never attribute an object across namespaces. The webhook's
ClusterRole already grants `get` on every resource, so no RBAC change is
needed.

**Why at the source rather than in the consumer.** Relaxing the
securitygroup-controller's pod cache to
`apps.cozystack.io/application.kind` Exists would also have fixed the
symptom, but it would leave every other consumer of the managed-by label
blind to node pods, and it would rest membership on labels the webhook
never vouched for. Stamping `managed-by-cozystack` from the machine
template was ruled out too: the `objectSelector` would then skip these
pods entirely, and they would lose the scheduling-class injection the
webhook performs on every pod.

**Blast radius.** Only objects below a CAPK VM change: the VMI, the
virt-launcher pods and the PVCs of the VM's `dataVolumeTemplates` now
get the lineage labels of their Kubernetes application. None of them
match a resource selector of the `Kubernetes` ApplicationDefinition, so
they get `tenantresource=false`. Nothing selects PVCs on
`application.kind=Kubernetes` (the Velero strategy selects `VMDisk`).
The `-userdata` cloud-init Secret CAPK creates is not affected either
way: at the pinned provider commit, `reconcileKubevirtBootstrapSecret`
creates it with the bootstrap Secret's labels and no ownerReferences, so
the walk reaches neither the VM nor the KubevirtMachine from it, before
or after this change. Existing node pods pick the labels up on their
next admission (recreation, live migration, or any update).

**Tests.** `pkg/lineage/capk_test.go` builds the observed chain in a
fake dynamic client and checks that a worker's virt-launcher pod
resolves to `Kubernetes/cluster-a`, that a VM pointing at a
KubevirtMachine in another namespace is not followed, that a VM without
CAPK labels still has no ancestor, and, in a table of negative cases,
that the CAPK labels are ignored on any object other than a
`kubevirt.io/v1` VirtualMachine (another kind of the `kubevirt.io`
group, a VirtualMachineInstance, a VirtualMachine of another group or
version). Weakening the kind and API version guard to match on either
field alone fails all four cases. With the bridge disabled, the first
test fails. No chainsaw case: the only suites that bring up worker VMs
are `kubernetes-latest` and `kubernetes-previous`, whose shared runner
script is already over its time budget, and the unit test covers the
walk exactly as it runs in the webhook.

### Screenshots

<!-- REQUIRED for UI changes: attach screenshots or screen recordings
demonstrating
the visual impact of your changes. PRs with UI changes without
screenshots will not be merged. -->

### Downstream repositories

<!--
Cozystack is upstream for repositories that are NOT kept in sync with it
automatically, and nothing in CI compares the two sides, so a change
here can break them silently.

Which change forces what, and which file to touch, is the trigger map in
docs/agents/contributing.md under "Downstream Repositories". Walk it
before you tick anything.

IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM
TO FILL IN:

1. Walk the trigger map against the actual diff of this PR, file by
file. Do not decide from the PR title or from your memory of what you
changed.
2. For every repository you tick, open the follow-up PR there and link
it on the same line. A ticked box with no link claims work that does not
exist, which is worse than an empty box. Search that repository for an
open PR or issue covering it first, and link that instead of filing a
duplicate.
3. When the follow-up is out of scope, or needs a decision that is not
yours to make, open an issue in that repository instead, link that, and
say so in the PR body. Do not push a speculative PR into another
repository just to fill a line here.
4. Do not tick "No downstream repository is affected" to make the
checklist go away. If you are unsure, leave every box empty and say so
in the PR body, so a human decides.
-->

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

<!--  Write a release note:
- Explain what has changed internally and for users.
- Start with the same `type(scope):` prefix as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->

```release-note
fix(lineage, kubernetes): the virt-launcher pods of Kubernetes worker nodes are now resolved to their Kubernetes application and marked as managed by Cozystack, so a SecurityGroup attached to a Kubernetes cluster now applies to its worker nodes, not only to its control plane.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Lineage results now connect supported virtual machines to their
associated machine and Kubernetes application when the required
association labels are present.
* **Bug Fixes**
* Association tracing is limited to supported virtual machine resources
and machines in the same namespace. Unlabelled standalone virtual
machines and machines in another namespace do not gain ancestors through
this association.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Backported-from: 1f35c26ece
2026-11-26 16:19:33 +00:00
Myasnikov Daniil 51d4668029 test(backups): remove the Altinity strategy tests' scratch directories
Every test in hack/altinity-backup-strategy.bats made a directory with
mktemp -d and never removed it, so each passing run of the file left
nine directories in TMPDIR, and they pile up on any machine that keeps
it between runs.

Each test now removes its directory as its last statement. A failed
assertion aborts the body before that line, so a failing test keeps
its stub log and rendered script for inspection.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
(cherry picked from commit d5559bb934)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-26 16:19:33 +00:00
Myasnikov Daniil 150d36e0f6 fix(platform): do not gate cert-manager-issuers on ClusterIssuer readiness (#5210)
## What this PR does

This PR makes the cert-manager-issuers release stop waiting for
ClusterIssuers to become Ready. ClusterIssuer is Ready only after
cert-manager registered an ACME account with the CA, so when
letsencrypt-stage can't reach the staging endpoint, helm upgrade of the
release hangs until timeout with `timeout waiting for:
[ClusterIssuer/letsencrypt-stage status: 'InProgress']`. The release
stays not Ready and every package that dependsOn cozystack.cert-manager
stays in DependencyNotReady, even when letsencrypt-prod works and all
certificates are already issued.

Fix is `healthCheckExprs` with `current: "true"` for ClusterIssuer on
the component, the same mechanism vm-default-images uses. It covers the
prod issuer too, I did not special-case staging because the wait is the
same.

Issuers keep their own status and retry registration, so they start
issuing when the CA is back. Certificate requests that come before that
stay Pending with `IssuerNotReady`, they are not failed.

Downside is that unreachable CA no longer shows up as non-Ready Package.
Only signal left is ClusterIssuer's own Ready condition and Certificates
at `Ready=False`, and there is no alert on ClusterIssuer in monitoring
packages yet.

On a cluster where the release is already stuck, the running upgrade has
to time out first (10m by default), then the retry uses the new spec.

letsencrypt-stage is still rendered on every cluster. Making it optional
needs a migration, because the issuers carry
`platform.cozystack.io/no-delete`, so it is not part of this PR.

Checked on a 3-node dev cluster running v1.7.0. I made the staging ACME
host unreachable from the cert-manager controller, so letsencrypt-stage
went to Ready=False with ErrRegisterACMEAccount, and forced an upgrade
of cert-manager-issuers. Without the expression the release hung in the
upgrade action and 23 releases went to DependencyNotReady within 15
seconds (67 of 124 at the peak). I then added the expression to the
PackageSource by hand, since I did not install a build of this branch.
The stuck upgrade ran until its timeout, the retry came right after it
and the release was Ready within 2 seconds, a second forced upgrade took
8 seconds, and all 124 releases converged with letsencrypt-stage still
False. After I made the host reachable again the issuer registered by
itself in about 30 seconds.

### Screenshots

### Downstream repositories

- [x] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:

### Release note

```release-note
fix(platform): the cert-manager-issuers release no longer waits for ClusterIssuers to become Ready, so an unreachable ACME endpoint (staging included) does not hold other platform packages in DependencyNotReady.
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
* Updated cert-manager issuer release checks to use the ClusterIssuer’s
current status and polling. Releases are no longer held up by ACME
readiness, which can remain unavailable even when issuance may recover
without intervention. This also helps prevent dependent packages from
being delayed while waiting for ACME services to become reachable.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Backported-from: a1be486fb6
2026-11-26 16:19:33 +00:00
Mattia Eleuteri 8df659f84e test(lineage): reject CAPK labels on objects that are not KubeVirt VMs
The bridge from a VirtualMachine to its KubevirtMachine is guarded by
the object's API version and kind, but no test exercised that guard:
weakening it to match on either field alone still passed, and let a
labelled kubevirt.io Cluster or a VirtualMachine of another group
resolve to the Kubernetes application.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
(cherry picked from commit fd9245f008)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-26 16:19:33 +00:00
Myasnikov Daniil bf60f024d8 fix(backups): restore the ClickHouse archive a Backup was taken as
The Altinity strategy named each archive inside its Pod with date -u
and recorded nothing on the Backup, so a restore could only guess: it
listed the remote archives under the application's prefix and took the
newest. A RestoreJob of an older Backup therefore restored whichever
backup had run last.

The controller now names the archive before it creates the backup Job,
from the BackupJob's persisted StartedAt, so every reconcile and every
retried Pod of the Job writes the same one. The name is recorded in the
Backup's driverMetadata next to the strategy parameters, and a restore
renders it into the strategy Pod, which restores exactly that archive
and fails, naming it, when remote storage no longer holds it. The name
is recorded only when the Job's Pod was given it, so a Job created by
an earlier controller, or a strategy that names its own archives,
leaves the Backup without one instead of pointing it at an archive
that does not exist.

Because a retried Pod reuses the name, it waits on an attempt the
sidecar is still running instead of being refused with 423, and asks
for resume, so a local or partial remote backup an earlier attempt left
is completed rather than refused as existing.

Backups taken before names were recorded stay restorable: the Pod picks
the newest archive whose name is stamped no later than the Backup's
takenAt, which is set only after the backup Job finished, and logs a
warning that the choice is a best effort.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
(cherry picked from commit 47b497194e)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-26 16:19:33 +00:00
Myasnikov Daniil 9061f9a5e1 fix(platform): do not gate cert-manager-issuers on ClusterIssuer readiness
A ClusterIssuer turns Ready only after cert-manager has registered an
ACME account with the CA. Under the kstatus wait helm-controller applies
by default, an unreachable Let's Encrypt endpoint, staging included,
keeps the cert-manager-issuers upgrade in progress until it times out.
Every package that dependsOn cozystack.cert-manager then waits behind
that release, so one unreachable CA leaves the platform half rolled out
while the issuers that are in use keep issuing.

Report the issuers as current through healthCheckExprs. The release
completes once the manifests are applied, and the issuers recover on
their own when the CA is reachable again.

Assisted-by: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
(cherry picked from commit 13fefcedda)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-26 16:19:33 +00:00