Commit Graph
1717 Commits
Author SHA1 Message Date
Mattia Eleuteri ad47521c95 fix(cozystack-basics): make the tenant super-admin VirtualMachine grant read-only
cozy:tenant:super-admin:base carried '*' on kubevirt.io virtualmachines.
A VirtualMachine written directly is sized outside any application: it
is not a HelmRelease the tenant ordered, so nothing that accounts for
applications sees it, and the same verbs let a super-admin raise the
guest size of a VM a VMInstance release rendered. Nothing in tree needs
the write: power goes through the virtualmachines start/stop/restart
subresources, console and VNC through the VMI subresources, size, disks
and networking through VMInstance values. The grant arrived together
with a '*' on helmreleases that was later removed; this one was missed.

watch stays, because the dashboard watches the VirtualMachine for its
live power state and no other tenant role grants it.

The tenant roles are aggregated from ClusterRoles in several packages,
so a write path can reach a tenant without touching the role that
names it; the install e2e now guards against that.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
2026-11-23 16:14:49 +03:00
Aleksei Sviridkin 1ab20ea96e fix(cluster-api): name the kubeconfig the upgrade hook runs with (#5398)
<!-- 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

The "Unit & controller tests" job fails on `main` and on every PR
rebased on it: `hack/check-hook-request-timeout.bats` reports "no
in-cluster kubectl call carries a non-zero --request-timeout" against
`packages/system/capi-providers-core/files/upgrade-providers.sh`. #4902
added that script and #5360 extended the check to `files/` a few hours
apart, so neither ran against the other.

It is a false positive. The hook Job exports
`KUBECONFIG=/scripts/kubeconfig` and the script talks to the API only
through that explicit kubeconfig, which is exactly the case the check
exempts, but the exemption keys on the file naming `KUBECONFIG` and the
script only named `KUBE_CONTEXT`.

The single commit makes the script require `KUBECONFIG` with its other
inputs, so the dependency is explicit and the script refuses to fall
back to the in-cluster config. The check and the 10s per-call timeout
are left as they are. It adds a test that the script exits before any
API call when `KUBECONFIG` is unset, and asserts in the chart test that
the Job sets `KUBECONFIG` to the mounted kubeconfig. Reverting the
script change makes both the check and the new test fail.

### 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(cluster-api): the provider upgrade hook script now requires the kubeconfig its Job mounts, which also unblocks the unit test job on main.
```


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

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

## Summary by CodeRabbit

* **Bug Fixes**
* Upgrade operations now require `KUBECONFIG` to be set and stop with an
error if it is missing, before making API calls.
* Added checks that the upgrade job uses the expected kubeconfig path
and that the configured current context is `capi-upgrade`.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 16:49:40 +03:00
Aleksei Sviridkin 8f0082a1c8 fix(clickhouse): delete the archive when its Backup is deleted (#5224)
<!-- 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

Builds on #5229 (merged), which gives every backup run an archive of its
own.

Deleting a `Backup` taken with the Altinity (ClickHouse) strategy
released its finalizer at once and left the archive in the bucket. On
the system bucket nothing else prunes it, so every ClickHouse backup
stayed until someone called the sidecar by hand, and the route the chart
and the examples documented for that, `DELETE /backup/<name>/remote`,
does not exist in clickhouse-backup 2.7 and answers 404.

The driver names each archive `<application>-<start time as
YYYYMMDDHHMMSS>-<first 12 hex digits of the BackupJob UID>` (#5229) and
records it on the `Backup` under
`altinity.strategy.backups.cozystack.io/archive`. This PR also records,
under `altinity.strategy.backups.cozystack.io/use-system-bucket`, the
application's `backup.useSystemBucket` as it read when the backup Job
was created: the setting is stamped on the backup Job and copied onto
the `Backup`, because the application may switch before the controller
sees the Job complete. A Job created before the stamp existed falls back
to the application as it reads at completion. For a system-bucket
application the bucket the projected credentials (`cozy-backups-creds`)
name is recorded the same way, under
`altinity.strategy.backups.cozystack.io/bucket`. The `Backup` is created
with its cleanup finalizer already set, so a `Backup` deleted before the
`Backup` reconciler first sees it still has its archive deleted.

On `backup.useSystemBucket: true`, deleting the `Backup` runs a one-shot
cleanup Job that calls `POST /backup/delete/remote/<name>` on the
application's sidecar and holds the finalizer until it completes. The
sidecar refuses a delete with 423 while any other operation runs and
cannot be reached while its Pod restarts, so the Job waits both out
within its deadline; an archive that is already gone counts as deleted,
and any other answer fails the Job, which is reported as an
`ArtifactCleanupFailed` Warning Event carrying the reason the Job failed
and retried after a wait that starts at 30 seconds and doubles with each
failure up to 30 minutes (kept on the `Backup` under
`altinity.strategy.backups.cozystack.io/cleanup-failures` and
`.../cleanup-retry-after`, since the failed Job is deleted to make room
for the next). The Job starts only once the projected credentials have
reached the sidecar, as the backup and restore Jobs do. It is built by
the controller, not rendered as a whole from the strategy template,
because the shipped and the example templates run `restore_remote` for
every mode other than `backup`; only the image, how to pull it and where
the Pod may be scheduled (node selector, tolerations, affinity, priority
class) come from the template, rendered as for the strategy's own Pods.

When the delete cannot or must not run, the `Backup` is released with an
`ArtifactNotDeleted` Warning Event naming the archive left behind: the
namespace is terminating, the strategy, the application or its API
Secret is gone, the application no longer uses the system bucket (also
when it leaves while the delete runs), the system bucket is no longer
the one the `Backup` records or cannot be read (also when it changes
while the delete runs; a sidecar on another bucket would answer "not
found" and the delete would count as done), another Job holds the
cleanup Job name, or the archive has the older
`clickhouse-<application>-<YYYYMMDDTHHMMSSZ>` form, without its
BackupJob's UID. Such a name comes from a controller that predates
per-run names; two runs of one application started within the same
second share it, and a run still in flight when the controller is
upgraded records it later, so it is never deleted.
`backups.cozystack.io/skip-artifact-cleanup: "true"` releases a `Backup`
without deleting anything. An application on its own bucket keeps the
archive's lifecycle, as with MongoDB. The wrong delete route is
corrected in the chart comments and the restore scenario.

A BackupJob or RestoreJob no longer takes the outcome of a batch Job of
its name that it does not control. A Job left by an earlier owner of the
same name is waited out, with the `Ready` condition
(`PredecessorJobPending`) naming it, until the garbage collector removes
it; any other Job holding the name fails the BackupJob or RestoreJob
with a message naming the Job. The condition is dropped once the run's
own Job starts.

The example strategy under `examples/backups/clickhouse` now uploads
under the archive name the controller chose and restores the archive the
`Backup` records, as the shipped strategy does, keeping its clock-made
name and the newest archive only as the fallback for a run given no
name; `hack/clickhouse-example-strategy.bats` runs it against a stubbed
sidecar. The backup scenario no longer says the archive is expired by
the upstream tool's retention, which the chart does not configure.

Known limitations: a `Backup` taken before #5208, or by a custom
strategy that does not use `.ArchiveName`, does not name its archive and
keeps it; a `Backup` that names its archive but not the bucket setting,
as every `Backup` taken before this change does (a 1.7.x release that
carries #5208 among them), keeps its archive too and is released without
an Event; a `Backup` that records no bucket, taken before buckets were
recorded, is deleted without the bucket check; a `Backup` deleted during
an application uninstall can lose its cleanup Job to the chart's own
`<release>-cleanup` hook and is then released with a Warning Event,
leaving the archive; the recorded setting and bucket are read when the
backup Job is created, not observed from the upload, so a switch made
just before a backup, while the sidecar still runs on the previous
bucket, is recorded for an archive written to the previous one.

Related gap outside this PR, in main today: an archive uploaded by a run
whose `Backup` name is already taken is recorded by nothing, so no
`Backup` deletes it.

Verified with unit tests that drive the cleanup path through a fake
client and the cleanup script against a stub `curl`, with mutation
checks on every guard, and on a test cluster running v1.7.0 with the
backup controllers built from this branch (before #5229 shortened the
run name to its current form, which leaves the deletion side unchanged),
against the real clickhouse-backup sidecar and SeaweedFS: a backup
records a per-run archive name and the bucket setting on a `Backup`
created with its finalizer; deleting the `Backup` deletes the archive's
objects in the bucket; a restore from a `Backup` brings the data back; a
BackupJob recreated under a used name waits for the earlier Job and then
writes an archive of its own; a Job of that name created by anything
else fails the BackupJob; a `Backup` recording an archive named without
a UID is released with `ArtifactNotDeleted` and its objects stay. The
changes made after that run (the recorded bucket, the retry wait, the
credentials wait before the cleanup Job, the rendered cleanup Pod
settings, the cleared predecessor condition, the example strategy) are
covered by the unit tests and bats, not by a live run.

### 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.
-->

- [ ] No downstream repository is affected by this change
- [x] [cozystack/website](https://github.com/cozystack/website) -
follow-up: cozystack/website#809 (for cozystack/website#808; its `next/`
pages should merge after this PR)
- [ ]
[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(clickhouse): deleting a Backup taken on the system bucket from this release on now deletes its clickhouse-backup archive and keeps the Backup until the delete finished, reporting an archive it cannot or must not delete (including one named without its BackupJob's UID, or in a system bucket the platform has left) as a Warning Event and retrying a failed delete with a growing wait; the cleanup Pod is scheduled as the strategy's own Pods; a BackupJob or RestoreJob no longer reports the outcome of a batch Job it did not create; the documented sidecar delete route is corrected to POST /backup/delete/remote/<name>.
```


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

## Summary by CodeRabbit

* **New Features**
* ClickHouse backups using the system bucket now remove their recorded
archive when the backup is deleted. Deletion waits for cleanup to
finish.
* Backup and restore operations use the controller-provided archive name
when available. Restores can fall back to the latest matching archive.
* **Bug Fixes**
* Temporary sidecar failures are retried with increasing delays. If
cleanup cannot safely remove an archive, it completes with a warning
rather than risking deletion of the wrong archive.
* **Documentation**
* Clarified that archives in tenant-owned buckets remain until manually
deleted or removed by bucket lifecycle rules.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 16:27:05 +03:00
Mattia Eleuteri 5e6772ec3f fix(cluster-api): name the kubeconfig the upgrade hook runs with
The provider upgrade hook reaches the API through the kubeconfig its
Job mounts at /scripts/kubeconfig and exports as KUBECONFIG, never
through the in-cluster config. The script only named KUBE_CONTEXT,
so hack/check-hook-request-timeout.bats, which since it started
reading files/ exempts a script only when it names KUBECONFIG, took
its "kubectl --context ... --request-timeout=10s" for an in-cluster
call and failed "no in-cluster kubectl call carries a non-zero
--request-timeout" on main.

Require KUBECONFIG alongside the other inputs instead of loosening the
check or dropping the timeout: the per-call timeout is safe because
the explicit kubeconfig is what serves it, and the script now refuses
to fall back to the in-cluster config, where the timeout would hit the
bug the check guards against.

Tested with bats on hack/check-hook-request-timeout.bats,
hack/capi-upgrade_test.bats and hack/capi-upgrade-chart_test.bats; with
the script change reverted, the check and the new missing-KUBECONFIG
test both fail.

Fixes: 9680ed64df ("feat(cluster-api)!: update Cluster API to v1.14.4 (#4902)")
Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
2026-11-23 13:24:41 +01:00
Aleksei Sviridkin f5ceed0e24 feat(linstor, platform): upgrade snapshot-controller to v8.7.0 and enable VolumeGroupSnapshots (#5239)
## What this PR does

Windows VMs with three or more disks cannot get an
application-consistent Velero backup on Cozystack today. Velero takes
one CSI snapshot per PVC, one after the other, while virt-freezer holds
the guest frozen, and on LINSTOR each snapshot takes 2 to 4 s. With
three disks or more the freeze runs past the 10 s that Windows VSS
allows, VSS aborts with `0x80042314`, and the backup fails. The only
workaround is `kubevirt.io/skip-backup-hooks=true` on the VM, which
gives up application consistency.

The fix is a VolumeGroupSnapshot: one snapshot request for all the PVCs
of a VM, taken inside the freeze. linstor-csi has implemented the CSI
GroupController since v1.11 (the package ships v1.11.2), and it creates
the whole group in a single LINSTOR `Resources.CreateSnapshots` call, so
every volume of the VM is captured at the same instant and the freeze
lasts one snapshot instead of N. Velero 1.18 drives VolumeGroupSnapshots
through `groupsnapshot.storage.k8s.io/v1beta2`. What is missing is on
the Cozystack side: snapshot-controller v8.0.1 serves the group snapshot
API only as v1alpha1 and runs without the `CSIVolumeGroupSnapshot` gate,
and piraeus-operator turns the gate off on the csi-snapshotter sidecar
when it does not find v1beta2.

This PR:

- Upgrades the vendored Piraeus `snapshot-controller` chart from 3.0.5
(v8.0.1) to 5.4.0 (v8.7.0) with the package's `make update`. The
`snapshot.storage.k8s.io` CRDs stay at v1. The
`groupsnapshot.storage.k8s.io` CRDs go from v1alpha1 only to v1beta1,
v1beta2 and v1, with v1beta2 as the storage version. The controller runs
with `--feature-gates=CSIVolumeGroupSnapshot=true`, the chart's default.
The validating webhook is gone upstream, replaced by CEL rules in the
CRDs. The new optional conversion webhook stays disabled, as upstream
ships it, since no cluster holds group snapshot objects to convert.
- Sets `keepCRDs: true`. The chart now renders its CRDs from a template
instead of `crds/`, so without it an uninstall of the release would
delete every VolumeSnapshot with the CRDs.
- Patches the vendored CRD template (`patches/skip-foreign-crds.diff`,
applied by `make update`) so a CRD is rendered only when it is absent or
already carries this release's `meta.helm.sh/release-name` and
`meta.helm.sh/release-namespace`. A CRD a distribution ships, or that
another release owns, stays out of the manifest, so helm-controller
neither takes it over nor rewrites it on upgrade. On a fresh install,
and for the CRDs migration 62 adopts, the output is unchanged.
- Adds migration 62 and bumps `migrations.targetVersion` to 63
(renumbered from 61 after upstream took migration 61 for the Strimzi v1
conversion). The CRDs `crds/` created carry no Helm ownership metadata,
and the patched chart renders only the CRDs that do, so the migration
annotates the three `snapshot.storage.k8s.io` CRDs the release installed
for adoption, which keeps them in its manifest. The three group snapshot
CRDs cannot be adopted: the apiserver rejects an update that drops
v1alpha1 while it is listed in `status.storedVersions`. The old
controller never ran with the gate, so no v1alpha1 object was ever acted
on, and the migration deletes each of these CRDs when it is empty and
creates it again straight away at v1beta2, from copies `make
image-migrations` renders out of the snapshot-controller chart with the
release's ownership metadata (as it already bakes the etcd-operator CRDs
for migration 50). Every HelmRelease waits for this pre-upgrade hook, so
the linstor release renders against the v1beta2 API even when it
upgrades before snapshot-controller. A CRD that still holds objects is
kept and recorded on the `cozystack-version` ConfigMap as
`cozystack.io/migration-62-needs-attention`, and the CRD stays out of
the release, which carries no Helm ownership on it, so
snapshot-controller still upgrades with that group snapshot API at
v1alpha1 and group snapshots off. Nothing re-renders either release once
the CRD is cleaned up, so the migration's warning gives the whole
recovery: delete the objects and the CRD, force a snapshot-controller
HelmRelease upgrade so the chart creates the CRD at v1beta2, restart the
snapshot-controller Deployment, which sets up its group snapshot watches
only when it starts, then force a linstor HelmRelease upgrade. The
migration only touches CRDs that helm-controller labelled as installed
by `cozy-snapshot-controller/snapshot-controller`, and the chart leaves
the others out of the release, so a distribution that ships its own
snapshot CRDs keeps them in both places. Whether the release is
installed is read from its HelmRelease rather than from those labels, so
a retry after a failed create still recreates the group CRDs it deleted
when only they carried the labels; without the HelmRelease the migration
changes nothing. The version is stamped only once every release-owned
v1beta2 group snapshot CRD is Established, whichever path brought it
there, so a retry after a timed-out wait waits again rather than letting
linstor render before the API is served.
- Sets `FEATURE_GATE_CSI_VOLUME_GROUP_SNAPSHOT=true` on the linstor-csi
`csi-snapshotter` sidecar through the LinstorCluster pod template.
piraeus-operator v2.10.2 probes for the v1beta2 API once, when it
starts, and adds a patch that sets the variable to `false` when the
probe fails. On a cluster upgraded from v1alpha1 the operator started
before the new CRDs existed, so the gate would stay off until the
operator next restarted. The pod template is merged after the operator's
own patch. The variable is always set, to `true` only when the apiserver
serves all three `groupsnapshot.storage.k8s.io/v1beta2` kinds and to
`false` otherwise: the operator's probe looks at VolumeGroupSnapshot
alone, and csi-snapshotter with the gate on and a group API missing
waits for its group snapshot caches before it starts the ordinary
snapshot workers. The class below renders under the same check.
- Adds a default `VolumeGroupSnapshotClass` `linstor-group-snapshots`
for `linstor.csi.linbit.com`, next to the existing `linstor-snapshots`
VolumeSnapshotClass, with the `velero.io/csi-volumegroupsnapshot-class:
"true"` label Velero selects a group snapshot class by. Only on a
cluster where migration 62 kept a populated v1alpha1 CRD do they wait
for the forced linstor upgrade at the end of that recovery.

Not in this PR: grouping a VM's PVCs for Velero. Velero builds a group
from the PVCs that share the value of the `velero.io/volume-group`
label, so the `vm-instance` and `vm-disk` charts would have to set it to
the VM name on every disk. That is a separate change, and an operator
can set the label by hand meanwhile.

Testing:

- Kubernetes v1.34.3, Velero 1.18.1, linstor-csi v1.11.2,
piraeus-operator v2.10.2. On that cluster the group snapshot CRDs are
v1alpha1 only, list `["v1alpha1"]` in `storedVersions`, hold no object,
and carry the helm-controller labels of
`cozy-snapshot-controller/snapshot-controller`. The csi-snapshotter
sidecar runs with `FEATURE_GATE_CSI_VOLUME_GROUP_SNAPSHOT=false`, set by
the operator's patch.
- `hack/migration-62-snapshot-crds.bats` (16 cases) runs migration 62 in
the migrations base image against a fake kubectl that keeps the CRDs in
a state file: adoption and deletion, a second run that changes nothing,
a CRD holding objects, CRDs another installer owns, CRDs that already
serve v1beta2, a cluster without the release, a release without the
group CRDs, a failing HelmRelease read, CRD read or delete that aborts
before the stamp, a failed diagnostic record that still stamps, a failed
create that aborts and is completed by the retry, release labels on the
group CRDs alone, with and without a failed first create, a timed-out
Established wait whose retry must wait again before stamping, and a
v1beta2 CRD that still stores v1alpha1, which is recorded rather than
adopted. With the delete removed from the migration, the first case
fails; with the release identity taken from the CRD labels instead of
the HelmRelease, the failed-create case with group-only labels stamps 63
without recreating the CRDs and fails. Without the wait on the adoption
path, the timed-out-wait case stamps 63 on the retry without waiting and
fails.
- New helm-unittest suites:
`packages/system/snapshot-controller/tests/crds_test.yaml` pins
`keepCRDs`, v1beta2 served and stored on the three group snapshot CRDs
and the controller gate;
`packages/system/snapshot-controller/tests/crd_ownership_test.yaml`
mocks the live CRDs and checks that one without Helm ownership and one
owned by another release are left out while an absent one and one this
release owns are rendered (it fails with the patch reverted);
`packages/system/linstor/tests/volume_group_snapshot_test.yaml` pins the
sidecar gate on with and without strict topology, off when only
VolumeGroupSnapshot or no group API is served, and the
VolumeGroupSnapshotClass rendered only when the v1beta2 API is served.
`csi-topology_test.yaml` now counts the `csi-snapshotter` entry in the
pod template.
- `helm unittest` passes for `packages/system/linstor` (30 tests),
`packages/system/snapshot-controller` (7) and `packages/core/platform`
(285). `hack/cozystack-version-stamp.bats` and
`hack/check-migrations-target.sh` pass.
- Not yet run end to end: the upgrade of a live cluster through
migration 62, and a Velero backup with a VolumeGroupSnapshot through
linstor-csi.

### Screenshots

Not a UI change.

### 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:

The only change to `packages/core/platform/values.yaml` is the value of
`migrations.targetVersion`. The website's `platform-package.md` lists
that key without a value, so it needs no change. No website page
mentions VolumeGroupSnapshots or documents the snapshot-controller
webhook. The rest of the diff is a vendored chart, two system packages,
a migration and its tests, none of which the trigger map reaches.

### Release note

```release-note
feat(platform): snapshot-controller is upgraded to v8.7.0 and serves VolumeGroupSnapshots as groupsnapshot.storage.k8s.io/v1beta2, and linstor-csi takes group snapshots with a default VolumeGroupSnapshotClass labelled for Velero. A platform migration hands the snapshot CRDs over to the release and removes the empty v1alpha1 group snapshot CRDs.
```


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

## Summary by CodeRabbit

* **New Features**
* Added LINSTOR volume group snapshot support when all required APIs are
available, including a default snapshot class.
* Updated the snapshot controller to support newer snapshot APIs and a
conversion webhook.
* Added safer CRD installation and upgrade handling, preserving CRDs
with existing objects and recording items that need attention.

* **Bug Fixes**
* Improved snapshot-controller upgrade reliability, including recovery
from certain CRD creation failures.

* **Documentation**
* Updated chart guidance for CRD management, conversion webhooks, and
snapshot class configuration.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 14:12:46 +03:00
Aleksei Sviridkin 39f3f73fbc fix(postgres): keep users.app's password across pod restarts (#4984)
## What this PR does

A Postgres app that declares a user named `app` loses that user's
password every time its pod restarts. Clients keep the password
advertised in `<release>-credentials` and start failing with `password
authentication failed for user "app"`, with nothing changed on their
side.

`app` is the owner role CNPG bootstraps, with a generated password in
`<release>-app`, and a declared `users.app` adopts that role (the
init-script says so). The init-job sets the role's password from
`<release>-credentials`, but CNPG's instance manager re-applies the
owner's password from the bootstrap secret whenever it meets a secret
version it has not applied yet (`refreshCredentialsFromSecret` →
`reconcileUser` in
`internal/management/controller/instance_controller.go`). Its cache is
in memory, so every pod start re-applies `<release>-app` and silently
undoes the init-job. Only releases whose two secrets happen to differ
break, which is every release where `users.app` was declared at
creation.

This PR renders a `<release>-app-owner` basic-auth Secret from the same
password `<release>-credentials` holds, and sets
`spec.bootstrap.<method>.secret.name` to it, so both writers agree on
one value. CNPG resolves the owner secret through that field before
falling back to `<release>-app`, never rewrites the data of a secret it
does not own, and its webhook accepts a bootstrap change on an existing
Cluster. The secret goes on the method the live Cluster was bootstrapped
with, read through `lookup`, because CNPG rejects two methods and a
restored Cluster keeps `bootstrap.recovery` in its live spec. A release
with no `users.app` renders exactly what it rendered before, and a
restore in progress (`bootstrap.enabled`) is left alone, since the chart
flags its credentials as pending until the init-job runs.

We hit this in production: the cluster-wide pod restart of a platform
upgrade broke two of the four apps that declare `users.app`; the two
others survived only because their two secrets held the same value.

`tests/app_owner_secret_test.yaml` covers the shared password (preserved
and freshly generated), the initdb and recovery methods, a release
without `users.app`, and an in-progress restore. Without the template
change, 5 of its 8 tests fail. The full chart suite passes (217 tests).

### Screenshots

Not a UI change.

### Downstream repositories

Walked against the diff: two templates and one test file under
`packages/apps/postgres`. No package is added or renamed, `values.yaml`,
`values.schema.json` and `README.md` are untouched, and no output Secret
or Service is renamed (a new Secret is added; the Terraform provider
reads only `-credentials`, `-rw` and `-ro`).

- [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(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`.
```


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

## Summary by CodeRabbit

- **New Features**
  - Added owner credentials when the `app` user is configured.
- PostgreSQL clusters now use those credentials during initialization or
recovery, while preserving compatible recovery settings for restored and
actively recovering clusters.

- **Bug Fixes**
- Ensured generated or existing `app` passwords are reused for owner
credentials.

- **Tests**
- Added coverage for credential reuse, password generation, omitted-user
behavior, and cluster recovery scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 13:39:43 +03:00
Aleksei Sviridkin afa3dfa224 feat(virtual-machine): group a VM's claims for Velero volume group snapshots (#5240)
<!-- 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

An application-consistent Velero backup of a VM freezes the guest,
snapshots its PVCs one after another, then thaws it. Windows holds a VSS
freeze for 10 seconds at most, and on LINSTOR each CSI snapshot takes
about 4 seconds. So a Windows VM with three volumes (system disk, data
disk and the `persistent-state-for-*` claim KubeVirt keeps for TPM/EFI
state) overruns the window: `virt-freezer --unfreeze` fails with
`VSS_E_HOLD_WRITES_TIMEOUT` and the backup is only crash-consistent.
Velero 1.18 snapshots the PVCs that share a `velero.io/volume-group`
value as one VolumeGroupSnapshot, which linstor-csi takes as a single
atomic snapshot.

This adds a `post-install,post-upgrade` hook to `vm-instance` that
labels every claim of the VM with `velero.io/volume-group:
<VirtualMachine name>`. That covers the `vm-disk-<name>` claim of each
disk in `disks`, and the claims KubeVirt labels `persistent-state-for:
<VirtualMachine name>`. The hook also removes the label from claims
still carrying this VM's group once they no longer belong to it (a
detached disk, or a group that can no longer form). A claim grouped
under another VM is left alone.

A `vm-disk-<name>` claim belongs to the `vm-disk` release and outlives
the VM, and the hook leaves out a claim grouped under another VM's name,
so a disk reattached to a replacement VM would otherwise keep its old
group for good. A `pre-delete` hook therefore removes this VM's group
from every claim still carrying it when the release is uninstalled. Helm
runs uninstall hooks from the stored manifest, so that hook is rendered
unconditionally, and it selects the claims at run time with `-l
velero.io/volume-group=<VM>` rather than from a render-time list that
would be stale by then. Its Role needs `list` on the namespace's claims
for that; the removal is the same JSON `test`+`remove` patch, so a claim
another VM grouped in the meantime keeps its group.

Why a hook and not a label in the charts' own manifests:

- CDI copies DataVolume labels to the PVC only when it creates it
(`newPersistentVolumeClaim` in
`pkg/controller/datavolume/controller-base.go`, v1.66.1), so a label
added to an existing VMDisk's DataVolume never reaches its claim.
- A VMDisk is created, and its PVC with it, before any VMInstance names
it, so `vm-disk` cannot know the VM at that point; the disk-to-VM
mapping only exists in `vm-instance` values. `vm-disk` is therefore
unchanged.
- KubeVirt creates the persistent-state PVC with a fixed label set
(`createPVC` in `pkg/storage/backend-storage/backend-storage.go`,
v1.9.0); nothing on the VM or VMI spec adds labels to it.

Velero 1.18.1 has no fallback for a labelled claim it cannot group
(`getVolumeSnapshotReference` in
`pkg/backup/actions/csi/pvc_action.go`). Any of these fails the claim's
backup: an unbound member, two CSI drivers in the group, or anything
other than exactly one VolumeGroupSnapshotClass labelled
`velero.io/csi-volumegroupsnapshot-class: "true"` for the driver. The
hook therefore forms the group only when all of these hold, and removes
the label otherwise:

- the claims are bound and use a single CSI driver;
- at least two of them exist;
- `groupsnapshot.storage.k8s.io/v1beta2` is served;
- exactly one default class serves that driver.

On a cluster without group snapshot support the hook does not render.
That is every cluster on current `main`, which runs snapshot-controller
v8.0.1 with v1alpha1 CRDs. A companion change upgrades
snapshot-controller to v8.7.0, enables the `CSIVolumeGroupSnapshot` gate
on linstor-csi and adds a default VolumeGroupSnapshotClass. This PR does
nothing until something like it lands.

The hook is gated on render-time lookups like `vm-update-hook.yaml`, so
a converged VM renders no Job, and its Role is limited by
`resourceNames` to the claims it patches. Existing VMs are picked up on
their next Helm upgrade, which a Cozystack upgrade that bumps the chart
triggers.

Known limit: the hook labels only the claims the render saw. A
persistent-state claim created after it stays unlabelled until the next
upgrade. That happens on the first boot of a new VM, and on every live
migration, where KubeVirt creates a new RWO claim. Such a claim is
snapshotted on its own, next to one group snapshot of the disks: two
snapshot operations, which still fit the freeze window, as two-volume
VMs show today. Closing that gap needs something that sees every PVC
creation. The lineage webhook is a candidate: it already mutates PVCs on
create and walks the owner graph to the VMInstance. That is left for a
follow-up.

`tests/instancetype_resources_test.yaml` rendered every template, and
the fake client of helm-unittest refuses a list lookup for a kind it
does not register. That suite is therefore scoped to `vm.yaml` and
`vm-update-hook.yaml`, the two templates it covers.
`tests/volume_group_hook_test.yaml` covers labelling, convergence, label
removal, the Job's security context and each gate: API not served, no
default class, two default classes, two drivers, an unbound claim, a
single claim. Each gate was checked to fail its test when removed.

`tests/volume_group_release_hook_test.yaml` pins the uninstall hook's
manifest, and `hack/vm-volume-group-release-hook.bats` runs its script
against a fake kubectl: every claim the VM grouped is released, a
detached disk included, another VM's claim is untouched, a claim
regrouped or deleted between the list and the patch does not fail the
uninstall, and a failed list or a patch that leaves the label in place
does. `tests/volume_group_hook_test.yaml` also covers a differently
named VM grouping the released disks.


### 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
feat(virtual-machine): label every PVC of a VMInstance with velero.io/volume-group, so Velero snapshots them as one VolumeGroupSnapshot when the cluster serves groupsnapshot v1beta2 with a default VolumeGroupSnapshotClass for their CSI driver.
```


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

## Summary by CodeRabbit

* **New Features**
* VM disk and persistent-state volumes can now be grouped for snapshots
when the storage provider and snapshot configuration support it.
* Volume grouping is updated automatically as claims change; ineligible
volumes are excluded, and claims assigned to another VM are left
unchanged.
* Grouping is applied only when multiple bound volumes share a supported
storage driver and a matching default snapshot class is available.
* Volumes no longer eligible for the VM’s group are ungrouped, and
missing volumes are safely skipped.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 13:26:04 +03:00
Andrei Kvapil 9680ed64df feat(cluster-api)!: update Cluster API to v1.14.4 (#4902)
<!-- 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.
- Breaking changes: append `!` after type/scope or add a `BREAKING
CHANGE:` footer.
- If it is a work in progress, consider creating this PR as a draft.
- Ask for opinion and review in the community chats when needed.
- Fixes merged to main reach supported release lines through the
backport batch automatically. Do not open backport PRs by hand.
-->

## What this PR does

Updates the Cluster API stack with an automatic intermediate upgrade for
existing v1.10 providers.

The core chart upgrades them through v1.13.8 before Helm applies the
final manifests. The hook fails on API errors, conflicting changes or
timeouts. The hook image goes through cozy-lib. The core chart's
PackageSource declares that library, otherwise the packaged chart can't
render the hook. Fresh installations skip the intermediate providers.
Helm keeps the intermediate ConfigMaps, so they stay in the cluster
after the next change of the intermediate version, and that bump has to
remove them.

Each provider now selects exactly one repository. The bridge and final
ConfigMaps carry `provider.cluster.x-k8s.io/version` with the full
version, including the role suffix, and the core and kubeadm selectors
include it. The operator's finalize step hashes every ConfigMap the
selector matches and rejects more than one. During an upgrade it also
checks the selector of every other installed provider. So the bridge
ConfigMaps carry only the version label, and the v1.10 selectors, which
have no version, never match them. The hook switches the version and the
selector in one guarded patch and selects a bridge by that label alone.
It also narrows an existing bridge selector to that label. A provider
whose first installation never finished takes the fresh-install path.

Kamaji, CAPK, capmox and IPAM keep their existing pins and temporary
v1beta1 compatibility. The autoscaler keeps its explicit v1beta1
selection. An infrastructure provider's v1beta1 `failureReason` no
longer immediately fails a Machine or triggers remediation. The provider
conditions still show the cause.

The vendored operator chart gets six local patches, and `make update`
reapplies them. The core components get a startup probe patch. The
sync-period patch from main stays. I kept the one-minute resync setting
until restart recovery is tested.

CAPI Bats, the bootstrap and platform Helm suites and the rendering
checks pass locally. On envtest against cluster-api-operator v0.30.0,
legacy v1.10 core and kubeadm providers go through v1.13.8 to v1.14.4
with these ConfigMaps. With the old bridge labels core stayed on v1.10.
I have not run a live upgrade, restart or eviction test on this
revision. The [earlier Proxmox
report](https://github.com/cozystack/cozystack/pull/4902#pullrequestreview-5510737333)
covers the v1.13 candidate only.

### 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. -->

Not a UI change.

### Downstream repositories

<!-- Cozystack is upstream for repositories that are not kept in sync
automatically. Check the trigger map in docs/agents/contributing.md
against the diff. Keep every checkbox. Tick an affected repository only
after linking an existing or newly opened follow-up. Do not claim no
downstream impact when it is unknown. -->

- [ ] No downstream repository is affected by this change
- [x] [cozystack/website](https://github.com/cozystack/website) -
follow-up: cozystack/website#751
- [ ]
[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 existing website follow-up needs the management-cluster minimum
updated to v1.33. No tenant API fields, version enums, installer values
or platform variants change.

### Release note

```release-note
feat(cluster-api)!: update Cluster API core and kubeadm bootstrap to v1.14.4, cluster-api-operator to v0.30.0 and Talos bootstrap to v0.6.13. Legacy core and kubeadm installations are upgraded through v1.13.8 before the final manifests are applied. The core and kubeadm bootstrap charts reject management Kubernetes older than v1.33. The upgrade is one-way: Cluster and Machine CRDs use v1beta2 storage and downgrades are not supported. The preferred Cluster API version becomes v1beta2. Clients relying on v1beta1 fields must select that version explicitly. The operator no longer serves operator.cluster.x-k8s.io/v1alpha1. The autoscaler stays on the v1beta1 Cluster API.
```
2026-11-23 11:00:48 +01:00
Andrey KolkovandYan Bondarenko 4fb8ea40e2 test(clickhouse): delete the system-bucket Backup while its S3 host resolves
Deleting a system-bucket Backup now deletes its archive through the
clickhouse-backup sidecar, and the Backup is held until that delete is
answered. The delete reaches S3 at s3.example.org only through the
CoreDNS rewrite and the Ingress certificate the round-trip installs,
and the script's EXIT trap removes both. The round-trip therefore
deletes its Backup inside the script, before the trap runs, and waits
for the cleanup; the preconditions and the step's finally mark a
Backup they still find with skip-artifact-cleanup, since no S3 host is
mapped by then. The wait covers a cleanup Job that runs out its 600s
deadline, the 30s retry delay and a second Job, so the route is not
removed while a retried delete still needs it.

The test then checks the delete itself by listing the objects under
the archive's prefix in the system bucket, through the S3 Ingress with
the projected credentials and with folder entries left out: some before
the delete, none once the Backup is gone. clickhouse-backup's
list/remote is not used for this: it reports an archive for every
prefix at the top of the bucket, and SeaweedFS was seen to keep the
folders the delete emptied for minutes after all their objects were
gone.

Co-authored-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
2026-11-23 12:15:07 +03:00
Alexey Artamonov 8cf04bdd0f fix(clickhouse): make the example strategy use the archive its Backup records
The example strategy minted its own archive name from the clock and
restored the newest archive of the source application. The controller
then found no archive name in the backup Job and recorded none, so a
restore of an older Backup silently restored the latest archive and
deleting a Backup left its archive in the bucket.

The example now uploads under the name the controller chose and
restores the archive the Backup records, as the shipped strategy does;
the clock-made name and the newest archive remain the fallback for a
run the controller gave no name. The backup scenario no longer says the
archive is expired by the upstream tool's retention, which the chart
does not configure.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
2026-11-23 12:15:06 +03:00
Aleksei Sviridkin 319c2c81f7 test(migrations): build each migration test image once per file (#5362)
## What this PR does

Closes #5299

In `hack/migration-{54,55,57,58,59,61}-*.bats`, every test calls
`prep()`, and `prep()` ran `docker build -q -t "$TESTIMG"` for one fixed
tag derived from the alpine pin. Under `bats -j N`, the tests in a file
run concurrently. On a cold cache, several uncached builds of that tag
therefore ran at the same time. The issue traces how a retag on the
containerd image store deletes the old image before creating the new
one, so a sibling's `docker run` can find the tag missing and fall back
to a pull.

This PR takes the first fix the issue suggests:
- `build_test_image()` holds the existing Dockerfile for each file,
unchanged (`jq`, plus `bash` for migration 61). Its exit status is
`docker build`'s, so a failed build still fails the caller.
- `setup_file()` builds the image once, before any test in the file
starts. If docker isn't available it does nothing, so `prep()` still
prints its existing "docker is required" message.
- `prep()` now runs `docker image inspect "$TESTIMG" ||
build_test_image`, so it only builds as a fallback when the tag is
missing (for example, a run without bats' `setup_file`). Under bats the
image already exists, so tests never build concurrently.

The issue lists 54, 55, 57, 58 and 59.
`migration-61-strimzi-v1-conversion.bats` has the same `prep()` pattern,
so it's included. Its separate `cozystack-migration61-test:ubuntu` build
stays where it is: only one test builds and uses it.

I chose this over `--no-parallelize-within-files` because it keeps these
files parallel and doesn't change the Makefile for every other bats
file.

### How I checked it

- I had no Docker daemon here, so I ran each file with a stub `docker`
on `PATH` that logs its calls and treats the tag as present once built:
- **On this branch:** one `docker build` per file (two for migration 61,
the second being the ubuntu image), with one `image inspect` per
`prep()` call.
  - **On main:** migration 54 ran four builds for its four tests.
- `bats --count` parses all six files.
- None of these files sources a `.sh` file, so they run only under real
bats (`bats-unit-tests`), not the `cozytest.sh` POSIX lane.
- Please rely on CI to run them against a real daemon.

### Screenshots

Not a UI change.

### 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:

These are repository-internal tests only.

### Release note

```release-note
NONE
```


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

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

## Summary by CodeRabbit

* **Tests**
* Improved migration test setup by building the required test image once
per test file and reusing it across tests.
* Preserved the existing Docker prerequisite checks and fallback
behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 12:01:18 +03:00
Mattia Eleuteri 62dee1d132 fix(postgres): keep users.app's password across pod restarts
CNPG bootstraps an "app" owner role with a generated password stored in
<release>-app, and a declared users.app adopts that role. The init-job
then sets the role's password from <release>-credentials, but CNPG's
instance manager re-applies the owner's password from the bootstrap
secret whenever it meets a secret version it has not applied, which
includes every pod start. Any restart therefore reverts users.app to
CNPG's generated password, and clients holding the advertised one get
"password authentication failed" with nothing changed on their side.

Render the owner's bootstrap secret from the same password the
credentials Secret holds, and point the live bootstrap method at it, so
both writers agree on one value.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
2026-11-23 11:56:33 +03:00
Mattia Eleuteri 3a5ae23797 feat(virtual-machine): group a VM's claims for Velero volume group snapshots
Velero snapshots the PVCs of an application-consistent VM backup one
after another between the guest freeze and thaw. Windows holds a VSS
freeze for 10 seconds at most, and on LINSTOR a VM with three volumes
(two disks and the persistent TPM/EFI state) outlasts it, so the thaw
fails and the backup is only crash-consistent. Velero 1.18 snapshots
the PVCs sharing a velero.io/volume-group value as one
VolumeGroupSnapshot.

Neither chart can carry that label onto the claims. CDI copies
DataVolume labels to a PVC only when it creates it, and a VMDisk
exists, PVC included, before any VM names it; KubeVirt creates the
persistent-state PVC with a fixed label set. A post-install and
post-upgrade hook of vm-instance labels them instead, and removes the
label from claims of this VM that no longer belong to the group.

Velero has no fallback for a labelled claim it cannot group: an unbound
member, a second CSI driver, or no single default
VolumeGroupSnapshotClass for the driver fails it. The group is formed
only when all of that holds and groupsnapshot v1beta2 is served, so
clusters without group snapshot support render nothing new.

The instancetype suite rendered every template, and the hook's PVC list
lookup needs a scheme it does not mock, so it is scoped to the two
templates it covers.

A vm-disk claim outlives the VM that grouped it, so a pre-delete hook
releases this VM's group on uninstall. Helm runs uninstall hooks from
the stored manifest, so that hook is rendered unconditionally and
selects the claims by this VM's label value when it runs.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
2026-11-23 11:55:31 +03:00
Mattia Eleuteri 892d9c9b34 feat(platform): upgrade snapshot-controller to v8.7.0
snapshot-controller v8.0.1 serves VolumeGroupSnapshots only as
v1alpha1 and runs without the CSIVolumeGroupSnapshot gate, so no CSI
driver on the platform can take a crash-consistent snapshot of several
volumes at once. Velero 1.18 and piraeus-operator both look for
groupsnapshot.storage.k8s.io/v1beta2, which v8.7.0 serves and which the
upstream chart enables by default.

The upstream chart renders its CRDs as ordinary templates instead of
shipping them in crds/, and helm-controller takes over existing objects
by default. A patch makes the chart render a CRD only when it is absent
or already carries this release's ownership, so a distribution that
ships its own snapshot CRDs keeps them as they are. keepCRDs is set
because an uninstall would otherwise delete every VolumeSnapshot along
with the CRDs.

Migration 62 hands the CRDs this release installed over to it, read
from its helm-controller labels, and checks the HelmRelease rather than
those labels to decide whether the release exists, so a retry after a
failed create still recreates what the first attempt deleted. The
apiserver refuses to drop v1alpha1 from a CRD that lists it in
storedVersions, so the empty v1alpha1 group snapshot CRDs are deleted
and created again at v1beta2 from copies the image build renders out of
the chart. Every HelmRelease waits for the pre-upgrade hook, so linstor
renders against the v1beta2 API even when it upgrades first; the version
is stamped only once every release-owned v1beta2 group snapshot CRD is
Established, which a retry after a timed-out wait must check again. A
CRD that still holds v1alpha1 objects is kept, recorded on the
cozystack-version ConfigMap, and its warning spells out the manual
recovery, since nothing renders either release again once it is gone.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
2026-11-23 08:08:49 +01:00
Aleksei Sviridkin f5479e7093 fix(qdrant): scrape TLS metrics over HTTPS (#5340)
## What this PR does

Qdrant with TLS enabled serves metrics over HTTPS, but its
ServiceMonitor still uses HTTP. Patch the rendered endpoint to use HTTPS
with the issued CA and a certificate SAN. The API key and explicit TLS
opt-out are preserved.

Validation: 3 regression tests and 110 Helm tests pass; both TLS cases
fail without the patch. The full Bats run has 183 failures on this macOS
host, all reproduced on unchanged main. The POSIX lane has 4 baseline
failures as well.

### 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(qdrant): restore metrics scraping for TLS-enabled instances by using HTTPS and verifying the server certificate against the issued CA.
```

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

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

## Summary by CodeRabbit

* **New Features**
* Qdrant monitoring now uses HTTPS when TLS is enabled, with certificate
verification and the configured server name.
* Monitoring connections use the release’s TLS certificate authority,
while non-TLS setups continue to use HTTP.
  * External Qdrant monitoring uses HTTPS by default.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-23 04:13:36 +03:00
Aleksei Sviridkin 0b53d53c01 Merge branch 'main' into fix/qdrant-monitoring-tls
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-23 02:58:03 +03:00
Andrey Kolkov 35634080f4 fix(backups): sign Kafka S3 requests without curl --aws-sigv4
The Kafka topic-metadata strategy and the topic-data demo strategy move
their artifacts to and from S3 with the curl of the Strimzi image they
run in, signed by curl --aws-sigv4. The Strimzi 1.3.1-1 images carry
curl 7.76.1-43.el9, whose RHEL backport of the S3 payload handling
(0044-curl-7.76.1-aws-sigv4-s3-unsigned-payload.patch) adds
x-amz-content-sha256 to the canonical headers and to SignedHeaders but
never sends the header. SeaweedFS rejects every signed request, so both
backup Jobs fail with

    curl: (22) The requested URL returned error: 403

The 7.76.1-40.el9 curl of the Strimzi 1.2 images has a different
defect, a signed Host without the non-default port it sends, which the
--connect-to workaround covered.

Sign the request in the script with openssl and sha256sum, both in the
Strimzi image, and leave curl only the transport. Sending the missing
header from the script would not do: for an upload the -43 build signs
UNSIGNED-PAYLOAD and the -40 build the empty-body hash, so no single
value satisfies both, and a curl that is fixed to send the header would
then send it twice. With the Host signed as curl sends it, the
--connect-to workaround goes too.

The bats suites hold the signature to the one botocore 1.35.99
S3SigV4Auth computes for the same request at a fixed time. Against
SeaweedFS 4.45 on a non-default port, the metadata script's backup,
restore and cleanup and the demo strategy's upload and download pass
in both quay.io/strimzi/kafka:1.2.0-kafka-4.3.1 and
1.3.1-1-kafka-4.3.1, a key with a space and non-ASCII bytes included,
and a wrong secret still gets 403.

Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-11-20 20:18:32 +07:00
Andrey Kolkov f4330867ea feat(dashboard): let a login link pick the Keycloak identity provider (#5286)
## What this PR does

A login link into the dashboard can now name the Keycloak identity
provider, so a user who comes from a portal brokered into Keycloak skips
the realm login page:

```
https://dashboard.<host>/oauth2/start?kc_idp_hint=<idp-alias>&rd=/admin/tenants
```

The motivating case is a billing portal registered in the realm as an
OIDC identity provider. Its "Open dashboard" button today lands every
client on "Sign in to <realm>", where they must pick the portal's
provider by hand on every new browser or session. Keycloak skips that
page when the auth request carries `kc_idp_hint`. The gatekeeper,
however, builds the request from a fixed `--login-url`, and
oauth2-proxy's flags forward only `acr_values`, `prompt` and
`approval_prompt` from `/oauth2/start`. Putting the hint into
`--login-url` would force every dashboard login, administrators
included, through that one provider.

oauth2-proxy can forward an allowed parameter through
`providers[].loginURLParameters`, but only in its alpha configuration.
The OIDC gatekeeper therefore now runs from one:

- `templates/gatekeeper-config.yaml` (new, OIDC only) holds the
provider, upstream, listen address and injected headers. The values are
exactly what `oauth2-proxy --convert-config-to-alpha` (v7.12.0) produces
for the previous flags, both the in-cluster Keycloak branch and the
external-discovery branch. On top of those, `kc_idp_hint` is allowed
when it matches `^[A-Za-z0-9._-]+$`. That rule and `clientSecretFile` in
place of the inline `clientSecret` are the only hand-written lines;
everything else, `scope`, `approval_prompt`, `insecureSkipNonce`,
`flushInterval` and `timeout` included, is the converter output
unchanged.
- `templates/gatekeeper.yaml` keeps the flags the alpha configuration
does not own (redirect URL, whitelist domain, email domain, API routes,
cookie options, `--skip-provider-button`, `--ssl-insecure-skip-verify`).
It mounts the config and the `dashboard-client` secret as files
(`clientSecretFile`). A checksum annotation restarts the pod when the
config changes.
- The token-proxy branch (OIDC disabled) is unchanged.

A login without the parameter behaves as before. oauth2-proxy logs a
warning on start that the alpha configuration format may change between
releases.

Tests:
- **Chart suite.** The gatekeeper suite loads the config template as
well, because the deployment checksums it. The "no branding volume" test
now asserts the branding volume is absent, not that the pod has no
volumes. The five tests that read Keycloak URLs from the container args
are removed: those values now sit in the alpha configuration. `helm
unittest .` passes, 23 tests.
- **E2E.** After the gatekeeper rolls out with OIDC enabled, the in-tree
install suite requests `/oauth2/start` through a port-forward and checks
the redirect: `kc_idp_hint=e2e-idp` reaches the `cozy` realm's auth URL,
and a value outside the allow pattern (`e2e%26prompt%3Dnone`) is
dropped. This covers the realm path and the allow rule that the removed
chart tests no longer pin.
- **Gatekeeper login (`hack/dashboard-gatekeeper-login.bats`).** Renders
the chart for a realm other than `cozy`, starts the auth-proxy image
with the rendered args and alpha config, and checks the `/oauth2/start`
redirect: on the in-cluster Keycloak branch the hint reaches that
realm's auth URL, a value outside the allow pattern is dropped, and a
login without it carries none; on the external-discovery branch the
gatekeeper discovers that realm from a local Keycloak stub and passes
the hint. The image is read from the render, so an oauth2-proxy bump
re-checks the alpha configuration. Needs docker, like
`hack/etcd-grpc-alerts.bats`.
- **Real oauth2-proxy v7.12.0 on the rendered config.** Ran with the
rendered args and checked:
  - `/ping` answers OK;
- `/oauth2/start?kc_idp_hint=whmcs` puts `kc_idp_hint=whmcs` into the
Keycloak auth URL;
- `/oauth2/start` without the parameter, or with a value outside the
pattern, does not;
  - a protected path redirects without it;
  - `/apis/*` stays 401;
  - `--ssl-insecure-skip-verify` starts fine alongside `--alpha-config`.
- **Live cluster.** Swapped in the rendered gatekeeper with the
HelmRelease suspended, then reverted:
- a brokered user who was already signed in at the portal went from the
hinted link straight to the dashboard;
  - a plain visit still showed the realm login page;
- a hinted visit without a portal session went straight to the portal's
own login;
- API calls from the console worked, so the `Authorization` header
injection is intact.

### Screenshots

N/A — no console UI changes. The change removes the Keycloak login page
from the hinted flow.

### 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:

The diff touches only the dashboard gatekeeper templates and their
tests. It adds no value, schema, package or platform component. I walked
the trigger map against it, and no entry matches.

### Release note

```release-note
feat(dashboard): a dashboard login link can name the Keycloak identity provider with `/oauth2/start?kc_idp_hint=<alias>`, so users coming from a brokered portal skip the realm login page. The OIDC gatekeeper now runs oauth2-proxy from an alpha configuration kept in a ConfigMap; logins without the parameter are unchanged.
```


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

## Summary by CodeRabbit

* **New Features**
* OIDC-enabled clusters now use updated dashboard sign-in settings,
forwarding identity and token information to the dashboard.
* Authentication requests use Keycloak’s internal URL when configured;
otherwise, logout uses the public Keycloak URL.
  * Sign-in requests include the OpenID, email, and profile scopes.
* Supported identity-provider hints are preserved in sign-in redirects,
while invalid hints are excluded.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-20 17:05:43 +07:00
Marian Koreniuk cfb5119c0b feat(build): attach a provenance attestation beside the SBOM (#5043)
## What this PR does

Follow-up to #4997 (merged as d32092ac9), rebased onto `main` at that
merge: one commit `57db352ed`. The second half of what was agreed there:
beside the SBOM, each release image gets a SLSA provenance statement
from BuildKit, in the same attestation manifest.

Refs #4759, #3278

`SBOM=1` in `hack/common-envs.mk` now passes `--attest
type=provenance,mode=min` with the SBOM attest, in place of
`--provenance=false`; a build without `SBOM=1` keeps
`--provenance=false` as before. BuildKit writes both predicates into the
one attestation manifest per platform, so the index shape
`hack/stitch-multiarch.sh` and `hack/verify-multiarch.sh` read after
#4997 is unchanged, and a signature over the index covers the provenance
as it covers the SBOM. `mode=min` records the build times, the build
platform, the frontend and the BuildKit version and leaves out the build
arguments and the secrets, which `mode=max` would write in, so it can
ride every release image. `docker buildx imagetools inspect
<image>@<digest> --format '{{ json .Provenance }}'` prints it;
`docs/release.md` says so.

### How it was checked

- `hack/common-envs_test.bats`: the `SBOM=1` test now also holds that
`--attest type=provenance,mode=min` is passed, that `--provenance=false`
is not, that neither `mode=max` nor `--provenance=true` appears, and
that the default build still passes `--provenance=false` and no
`--attest`. `make -n` of `packages/system/cozystack-controller` shows
exactly that in both modes. `hack/stitch-multiarch_test.bats` is green:
the attestation manifest count per platform does not change.
- A real build, by @myasnikovdaniil on a local registry: amd64 and arm64
built with the flags from `common-envs.mk`, stitched,
`verify-multiarch.sh` passes, the index has four manifests (two images,
two attestation manifests with SBOM and provenance each), `.Provenance`
reads for both platforms, and a `--build-arg` value is in `mode=max` and
not in `mode=min`.
- Rebased on `main` at d32092ac9: `hack/common-envs_test.bats` and
`hack/stitch-multiarch_test.bats` 34/34.
- Not checked: the provenance predicate on a release runner. The first
alpha after the merge shows it.

### Decisions for the release owners

- `mode=min` rather than `mode=max`: the Dockerfiles take `--build-arg`
values a reader of a public attestation should not see by default. If a
package's arguments are all public, `max` is one word away.
- `docs/security/self-assessment.md` still says build provenance is
disabled (`--provenance=false`). It stays until the first alpha shows
provenance on a release image, as #4997 holds its SBOM row.
- PR, main and nightly builds stay without provenance, as they stay
without an SBOM: nothing reads it there, and the default docker driver
cannot attach it.

### 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

- [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:

I walked the trigger map against the diff. `hack/common-envs.mk` changes
the flags one variable expands to and no target, variable name or file
that ccp's skills anchor on; nothing else is touched.

### Release note

```release-note
feat(build): every release image built with `SBOM=1` also carries a SLSA provenance statement (BuildKit `mode=min`: build times, platform, frontend and BuildKit version, no build arguments or secrets) in the same attestation manifest as its SBOM, readable with `docker buildx imagetools inspect <image>@<digest> --format '{{ json .Provenance }}'`.
```



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

## Summary by CodeRabbit

* **New Features**
* Container builds with SBOM generation enabled now include both an SPDX
software bill of materials and a minimal SLSA provenance attestation.
  * Provenance attestations remain disabled when SBOM generation is off.

* **Documentation**
* Updated the container image security guide with details on provenance
contents and how to inspect the attestation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-20 10:32:33 +01:00
Andrey Kolkov 421dc2a0a7 test(dashboard): require the exact hint in the e2e redirect check
The case pattern *kc_idp_hint=e2e-idp* also accepted e2e-idp-other
and xkc_idp_hint=e2e-idp. Match the parameter as a whole: preceded by
&, followed by & or the end of the URL.

Assisted-By: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-11-19 20:44:54 +07:00
Adham Kiwan 589c895d59 test(migrations): build each migration test image once per file
Every test in the migration 54, 55, 57, 58, 59 and 61 bats files called
prep(), and prep() ran `docker build -t` for one fixed tag. Tests in a
file run concurrently under bats -j, so on a cold cache several builds
of that tag ran at once. With the containerd image store a retag to a
different image deletes the old one before creating the new one, and a
sibling's `docker run` that resolved the tag in between found nothing
locally and fell back to a pull of an image that does not exist.

Build the image in setup_file, before any test of the file starts.
prep() keeps a fallback build for a run without setup_file, taken only
when the tag is missing.

Closes: #5299
Assisted-by: LLM
Signed-off-by: Adham Kiwan <adhamkiwan@outlook.com>
2026-11-19 15:16:30 +02:00
Adham Kiwan ffb3b6faf3 test(hack): check hook scripts under files/ for --request-timeout
The guard against a non-zero --request-timeout on in-cluster kubectl
calls only read chart templates. A chart that loads its hook script with
.Files.Get runs it with the same in-cluster credentials, so a flag in
packages/*/*/files/ went through unchecked; a review, not the guard,
caught it in #4915. It also matched only the --request-timeout=<value>
form, while kubectl accepts --request-timeout <value> as well.

Scan shell scripts under files/ too, recognised by a .sh suffix or a
sh/bash shebang, through env or env -S included, and match the
space-separated form and quoted values when a non-zero number follows,
so prose about the flag in comments stays quiet. The new cases run the
scan on a throwaway tree.

Closes: #5304
Assisted-by: LLM
Signed-off-by: Adham Kiwan <adhamkiwan@outlook.com>
2026-11-19 15:12:48 +02:00
Aleksei Sviridkin 0887b43793 Merge branch 'main' into feat/capi-v1.13
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-18 15:21:54 +03:00
Aleksei Sviridkin 191e2f45fa fix(capi-providers-core): stage unfinished kubeadm installations
A kubeadm installation can finish at its old requested version while
core moves to the intermediate release. Ignoring its initial empty
installedVersion leaves the final bootstrap chart outside its supported
upgrade window.

Fixes: 4d251f4122 ("fix(capi-providers-core): let a never-installed provider take the fresh path")
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-18 15:01:21 +03:00
Aleksei Sviridkin d88322197f chore(deps): roll up Renovate updates and raise dependencies to latest stable (#4869)
## What this PR does

One PR instead of separate Renovate PRs. Go modules, Dockerfile base
images and GitHub Actions move to newer versions that build and pass the
tests. Where a newer version is known to break something, it stays
behind, and `.github/renovate.json` holds it with the reason in the rule
description.

The tests come first, in their own commits:

- `make go-unit-tests` runs the Go tests under `pkg/` and `cmd/`, except
the backport-batch suite, which keeps its own target. The apiserver
serializer and fuzz tests, the generated OpenAPI and applyconfiguration
suites, the apis packages and the controller, operator and
observability-proxy commands did not run in CI before.
- The apps API surface that apiserver libraries shape is pinned:
server-side apply, content negotiation, Table output on watch, the
served OpenAPI v2 and v3 documents, and building the server without
etcd. Two answers look wrong and are pinned as they are today: applies
from different field managers never conflict (#4857), and protobuf is
refused with 406 even when the client offers JSON as a fallback (#5297).
- New tests cover the kubeovn webhook patch, the token proxy session
cookie and the mount-utils behaviour the kubevirt CSI node service
relies on.
- `hack/image-smoke.bats` checks the tools the CSI, LINSTOR, multus,
Harbor and redis-backup images take from their base images or build
stages, and that the kubevirt CSI node plugin and its sidecars need no
more than x86-64-v2. Each PR build job runs it against the images it
pushed; forks and the unit lane run no container.

The tests found two bugs:

- The kubeovn webhook dereferenced a nil pointer on an admission review
without a request, so the caller got a dropped connection instead of a
400.
- The token proxy cookie refresh never fired: securecookie decodes the
session times as int64 and the refresh looked for float64, so the
`--cookie-refresh=1h` the chart sets did nothing. A refreshed cookie
keeps the token's expiry. A session too large to encode now shows an
error at sign-in and leaves the current cookie alone on refresh.

What moved:

- GitHub Actions to their Node 24 majors. The flux action stays on the
tag of the Flux CLI it installs. The release job's checkout no longer
persists credentials, so its staging branch push uses the App token.
- Go 1.27.2 for the toolchain and builders. Builds that reproduce an
upstream release keep the Go upstream uses: Harbor, cilium-operator,
SeaweedFS and the chainsaw stage of the e2e sandbox.
- controller-runtime v0.25.2, gateway-api v1.6.3 on the minor of the
installed v1.6.1 CRDs, cel-go v0.30.0, grpc v1.84.0, etcd v3.7.2,
cert-manager v1.21.2, kubevirt csi-driver f10ae94 on Kubernetes v0.37.1.
- Node 24 for the dashboard console.

Held back, each with its reason in the Renovate rule:

- cel-go stays below v0.31: the old repository has no tags past v0.30.0,
and v0.32 moves to cel.dev/cel-go, which k8s.io/apiserver does not
import.
- kube-openapi stays on the commit its dependencies require, and
structured-merge-diff stays on v6, because k8s.io/apimachinery v0.37
does not compile against v7.
- The Flux API modules stay on the Flux v2.8 line the platform installs.
- gomodules.xyz/jsonpatch stays on v2, which controller-runtime's
admission.Patched takes.
- jwx stays on v3: v4 removes jwk.Cache, which the token proxy's JWKS
refresh is built on.
- kubevirt.io/api and the CDI API stay where upstream csi-driver builds.
- The kubevirt CSI driver image stays on AlmaLinux 9, because AlmaLinux
10 builds its amd64 userland for x86-64-v3.
- shadowbox stays on node 18, which outline-server declares in its
engines.
- The e2e sandbox stays on Ubuntu 24.04. 26.04 ships uutils coreutils,
whose `date` costs about 4x per call, and the test harness forks it per
traced line, which adds about ten minutes to the install phase.
- clastix/kubectl stays on v1.32 for the cleanup hooks, within kubectl's
one-minor skew.

The cert-manager Go module (v1.21.2) is one minor ahead of the installed
chart (v1.20.2). The Certificate objects the gateway controller writes
serialize the same either way.

`api/apps/v1alpha1` now requires Go 1.27.2, which applies to every
module that imports the published types.

The Linux run with Go 1.27.2 was done before the rebase onto current
main, and the rebased head has not been through it yet. There the five
modules built, vetted, tested and tidied cleanly, and the repository
unit, controller and envtest lane passed. `go test -race` passed in four
modules. In the root module it failed only on a pre-existing data race
in the workload monitor tests (#5296), which main has too. The image
smoke checks run in this PR's CI.

### Screenshots

No UI change.

### Downstream repositories

`api/apps/v1alpha1` moves to `go 1.27.2`, and
cozystack/terraform-provider-cozystack imports it, so that repository is
affected but needs no action. Its box stays empty for that reason, and
so does the "not affected" one.

- [ ] 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: none needed, because its Renovate raises the go directive
together with the pin bump and its CI takes Go from `go.mod`; the only
effect is that the provider's minimum Go becomes 1.27.2.
- [ ]
[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
chore(deps): move the toolchain and builder images to Go 1.27.2 and raise Go modules, base images and GitHub Actions to newer working releases; the dashboard token proxy now refreshes its session cookie, and the kube-ovn webhook rejects an admission review without a request instead of dropping the connection.
```
2026-11-18 14:42:34 +03:00
Aleksei Sviridkin a3e60ec372 feat(kafka)!: run on Strimzi 1.2.0 and Kafka 4.x (#4900)
<!-- 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

This upgrades the Kafka operator to Strimzi 1.2.0. Kafka 4.3 is the
application default, with 4.2 also available. Upgrades must pass through
Cozystack v1.7 and finish the ZooKeeper-to-KRaft migration first.

The upgrade now stops while any Kafka lacks KRaft evidence. Every Kafka
must report a nonempty `kafkaMetadataVersion` and the `KRaft` metadata
state. The API conversion deletes that state, so without it a Kafka
needs `Ready=True` or the `cozystack.io/kraft-verified` annotation,
which migration 61 writes on every Kafka it accepts before it stops the
operators. Any other explicit state blocks, and the error gives the
reason for each Kafka. On every variant, the platform chart refuses to
switch package sources while Strimzi still serves `v1beta2` and a Kafka
fails that check. On variants without the migration hook, it also
refuses while any Strimzi CRD still stores `v1beta2`, so
`/migrations/61` has to run first. Migration 61 checks the same evidence
again, including on repeat runs, and blocks unfinished broker-pool
drains. A manual change that bypasses the managed package source is
outside this check.

Existing Kafka 3.x applications move to v4.3. Kafka 4 no longer accepts
clients older than Kafka 2.1. Kafka 4 also rejects the topic settings
`message.format.version`, `message.downconversion.enable` and
`message.timestamp.difference.max.ms`, and a `segment.bytes` below 1 MiB
(1048576), which Kafka 3.x accepted down to 14 bytes. A Kafka 4 broker
whose log holds such a topic does not start. The chart now refuses to
render a topic that sets any of these. The platform upgrade refuses to
start while a Kafka application sets one, and migration 61 also checks
KafkaTopic resources, so topics created outside the chart are caught
too. A topic created through the Kafka admin API without a KafkaTopic is
not visible to these checks. Restoring a topic-metadata backup taken on
Kafka 3.x skips the three removed settings and raises a smaller
`segment.bytes` to 1 MiB, with a warning for each. In-place downgrades
are unsupported. The default 10-minute Helm timeout can leave a long
broker roll Failed until its retry succeeds.

The migration does not run automatically on every platform variant. Only
the `isp-*` variants run it automatically. On other variants, run
`/migrations/61` from the matching migrations image before upgrading, as
the Kafka README describes. This includes clusters that run no Kafka but
have the kafka-operator package, from the `paas` bundle or
`bundles.enabledPackages`. Their Strimzi CRDs still store `v1beta2` even
with no objects. The migration converts Strimzi resources and stored
Helm references to `v1`. It stamps platform version 62. Running it
manually also skips earlier migrations on a later move to an `isp-*`
variant. Before it stops the operators, migration 61 refuses objects
that the Strimzi 0.51 conversion tool would reject and names each one,
for example a Kafka with `.spec.kafka.resources` or with OAuth, Keycloak
or OPA settings. A failed conversion can leave the old operators stopped
until the migration succeeds and the operator release upgrades. The
failed conversion Job stays for diagnosis, but its ClusterRole, binding
and ServiceAccount are removed. A Job that is still running when the
wait times out keeps them, because the retry waits for it.

Known limitations. Migration 61 converts with the old operator stopped,
while Strimzi's conversion guide expects a running operator of 0.49 or
later. I stop it because 0.45 keeps writing the Kafka status through
`v1beta2`, but I have not checked this on a live cluster. Objects
Strimzi created keep `ownerReferences` to `v1beta2` until Strimzi 1.2
reconciles them. Deleting a Kafka before that can leave dependents
behind, and the chart's pre-delete hook covers only StrimziPodSets. The
conversion image is pulled from quay.io by digest with no values
override, so an air-gapped cluster has to mirror it under the same name.

The full offline unit run passed on Linux on
`1171d63adfafb45be34214fb9a0f565723e255fd`: 2,576 cases, no failures,
errors or skipped tests. Later changes were checked on `69c704499fa4`
with the Bats tests for migration 61, the migration runner, the Kafka
hooks and the Kafka backup scripts (102), the platform Helm suite (310
tests) and the Kafka Helm suite (91 tests). After the rebase onto `main`
at `5a5d5cd3d85f`, `a48a2f259947` passes the same Bats tests (115) and
the platform and Kafka Helm suites (326 and 103 tests). It also passes
the new check against added `documentIndex` selectors. I have not
validated this revision on a live cluster.

Closes #4365

### 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. -->

Not a UI change.

### 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.
-->

- [ ] No downstream repository is affected by this change
- [x] [cozystack/website](https://github.com/cozystack/website) -
follow-up: https://github.com/cozystack/website/issues/805
- [ ]
[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 Terraform provider does not model the Kafka `version` field. The
website issue covers the upgrade notes the `default` variant needs.

### 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
feat(kafka)!: upgrade to Strimzi 1.2.0 and Kafka 4.3 by default, with Kafka 4.2 also available. Platform migration 61 converts Strimzi resources to v1 and moves Kafka 3.x applications to v4.3. Every Kafka must have confirmed KRaft state before the upgrade, including on repeat runs. Upgrade through Cozystack v1.7 first. Kafka 4 drops clients older than Kafka 2.1 and the message.format.version, message.downconversion.enable and message.timestamp.difference.max.ms topic settings, and requires segment.bytes of at least 1 MiB; the chart and the upgrade refuse a topic that breaks either rule, and a topic-metadata backup taken on Kafka 3.x restores without the removed settings and with segment.bytes raised to 1 MiB. In-place downgrades are unsupported.
```
2026-11-18 13:26:31 +03:00
Aleksei Sviridkin 5a92f1fc4e Merge branch 'main' into feat/build-provenance-attestation
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-18 11:55:28 +03:00
Aleksei Sviridkin 045f1a9bbc fix(seaweedfs): remove identities left behind by deleted BucketAccesses
Since SeaweedFS 4.08 the S3 gateways move every identity from
/etc/iam/identity.json into /etc/iam/identities/<name>.json, and the
COSI driver up to v0.3.1 revokes only from identity.json. Every
BucketAccess deleted on such a filer left its identity file behind,
with its keys still accepted (seaweedfs/seaweedfs-cosi-driver#11). A
driver that deletes the file on revoke does nothing for the files
already left.

A post-install/post-upgrade hook removes a ba-<uid>.json file when no
BucketAccess in any namespace names it, by uid or by
status.accountID. The uid covers a BucketAccess still being granted,
the accountID one restored with its status. The identity directory is
listed before the BucketAccesses: a BucketAccess exists before its
grant writes a file, so a file seen in the first listing whose
BucketAccess still exists is always named by the second. File ages are
not used, because grants and gateway migrations rewrite left-over
files as well. A failed or empty listing removes nothing. Each removal
is logged and recorded as an Event on the HelmRelease. The hook runs
before the Object Lock hook, so in delete mode a left-over identity is
removed before that hook grants it anything.

A filer published for Client-topology clusters holds identities whose
BucketAccesses live in those clusters, so cosi.orphanIdentities
defaults to auto: report there, delete otherwise. An operator can
force either.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-17 22:07:25 +03:00
Aleksei Sviridkin c49f58c4a4 fix(seaweedfs): keep Object Lock working for COSI credentials on SeaweedFS 4.48 (#4893)
## What this PR does

Existing bucket credentials need additional Object Lock actions to work
with SeaweedFS 4.48. Since v0.4.0 (#5284), the upstream COSI driver
grants them to new credentials. It does not grant access again for a
ready BucketAccess, so older identities stay unchanged after the driver
update. The custom COSI driver build and its image repository are no
longer part of this PR.

This PR adds a post-install and post-upgrade hook that grants the
actions implied by each identity's Read and Write permissions. Bucket
restrictions and credentials stay unchanged, and Write does not grant
governance bypass. The `anonymous` identity that public-read buckets
share is skipped on purpose. The driver revokes public read by removing
only `Read:<bucket>`, so added Object Lock reads would stay open to
unsigned requests. The hook runs after the release update and does not
guarantee Object Lock access during a server rollout.

The wrapper chart also declares its local dependency so Helm lint can
check it. The chart remains on 4.45. #4879 is stacked on this PR for the
4.48 upgrade.

The hook's bats suite (22 cases), the chart tests and shellcheck pass
locally on 65708a81b8. The Linux unit lane and E2E are pending. Live
cluster validation has not been run.

Known hook limitations remain tracked in #4894. A pod that never starts
can still fail the Helm action. Deletion between the dry run and apply
can leave a keyless identity. Warning Events expire, and the Job stays
behind for its logs.

### Screenshots

Not a UI change.

### 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(seaweedfs): grant existing bucket credentials the Object Lock actions required by SeaweedFS 4.48 on install and upgrade, preserving their bucket restrictions and credentials.
```
2026-11-17 18:05:41 +03:00
Aleksei Sviridkin a48a2f2599 fix(backups): restore Kafka 3.x topic configs that Kafka 4 rejects
Every Kafka now runs 4.x, and a topic-metadata backup taken on Kafka
3.8 or 3.9 can record message.format.version,
message.downconversion.enable or message.timestamp.difference.max.ms,
which Kafka 4 removed, or a segment.bytes below 1 MiB, the minimum
Kafka 4 raised it to from 14 bytes. A 4.x broker rejects each of them,
so the restore stopped at the first one, leaving that topic
half-configured and every later topic unrestored, and a rerun failed
on the same line.

The restore now skips the removed keys and raises a smaller
segment.bytes to the minimum, each with a warning, and applies the
rest. segment.bytes is read the way Kafka reads it: trimmed, with an
optional sign, leading zeros decimal.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-17 12:22:56 +03:00
Aleksei Sviridkin f293d64e84 fix(kafka): delete the release's StrimziPodSets on uninstall
On a cluster upgraded from Strimzi 0.x, deleting a Kafka application
leaves its brokers running. kube-controller-manager's garbage collector
first saw the StrimziPodSets under v1beta2 and never updates that
record, so once v1beta2 is no longer served it retries them forever
instead of deleting them, until kube-controller-manager restarts
(kubernetes/kubernetes#102641).

The pre-delete hook now deletes the release's StrimziPodSets after its
node pools, so uninstall no longer depends on garbage collection for
the brokers. An absent CRD is not a failure; any other error fails the
hook like the pool delete does, because Helm never runs it for the
release again.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-17 12:22:55 +03:00
Aleksei Sviridkin 3b65cebea3 feat(kafka)!: run on the Strimzi v1 API and Kafka 4.x
Strimzi 1.2 serves only the v1 API and runs Kafka 4.2 and 4.3. The
node-pool hook no longer drives the ZooKeeper to KRaft migration or
the drain that freed the shared "kafka" pool name: Strimzi 1.x has no
ZooKeeper support, and the platform migration refuses to upgrade while
a ZooKeeper cluster is left. A cluster migrated earlier keeps its
"kafka" broker pool. Without the drain the hook takes seconds, so the
seven-hour install timeout goes too.

Kafka 4 rejects the topic configs it removed and a segment.bytes below
1 MiB, which Kafka 3.x accepted. A KafkaTopic that sets one stays
NotReady while the release reports Ready, so the chart refuses to
render such a topic. It reads segment.bytes the way Kafka does:
trimmed, with an optional sign, leading zeros decimal.

BREAKING CHANGE: the Kafka application accepts version v4.3 (default)
and v4.2; v3.8 and v3.9 are gone, and the platform migration moves
existing applications to v4.3.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-17 12:22:54 +03:00
Aleksei Sviridkin af0db99c71 feat(platform): move Strimzi resources to the v1 API before Strimzi 1.x
Strimzi 1.0 removed v1beta2 from its CRDs, and the API server refuses
a CRD that drops a version its status still lists as stored. Every
stored object has to be rewritten as v1 before the new operator
arrives, which needs the CRDs of Strimzi 0.49 to 0.51 that serve both
versions and Strimzi's own conversion tool. The 0.45 operator is
stopped first: Strimzi supports the conversion only under an operator
that knows v1, and 0.45 keeps rewriting the Kafka status through
v1beta2. The conversion Job's ClusterRole can patch CRDs and write
ConfigMaps in every namespace, so it goes with its binding and
ServiceAccount once the Job has finished, successfully or not; a
failed Job stays for diagnosis, and a Job still running when the wait
times out keeps them, because the retry waits for that Job.

Two references to v1beta2 outlive the stored objects. Helm builds the
objects of a release before it upgrades or uninstalls it, so every
stored revision of every Kafka application is rewritten to v1. And the
API server refuses server-side apply to an object whose managedFields
still name a version the CRD no longer serves; when helm-controller
recovers by wiping them, a field a later chart drops is never removed.
Those entries move to v1 as well. A Helm action already running stores
the releases it read when it finishes, v1beta2 included, so the version
is not stamped while any Kafka release revision is still pending.

Strimzi 1.x also runs neither ZooKeeper nor Kafka 3.x. A ZooKeeper
cluster, or a shared broker pool still being drained, left by a
platform that moved past v1.7 before its ZooKeeper to KRaft migration
finished cannot be finished afterwards, so the migration stops
instead; Kafka applications on v3.8 or v3.9 move to v4.3. The
migration also stops, before it changes anything, while a Kafka
application topic or a KafkaTopic sets a config Kafka 4 removed or a
segment.bytes below the 1 MiB minimum of Kafka 4: the new kafka chart
refuses to render such a topic, and a Kafka 4 broker whose log holds
the small segment.bytes does not start. segment.bytes is read the way
Kafka reads it: trimmed, with an optional sign, leading zeros decimal.

Strimzi's conversion tool refuses some v1beta2 objects outright, and
convert-resource stops at the first one, with the operators already
stopped. While v1beta2 is served the migration lists every Strimzi
kind first and refuses, naming each object and the reason, before it
stops anything. The list follows the 0.51.0 tool the conversion Job
runs, and a test fails when that image changes.

The conversion deletes the Kafka's KRaft metadata state, and KRaft is
the state Strimzi never leaves. Before it stops the operators, the
migration records an annotation on every Kafka it accepts, so a retry
after the conversion still accepts a NotReady Kafka that passed on
its KRaft state.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-17 12:02:45 +03:00
Aleksei Sviridkin 76d68a919f test(e2e): pin the importer restarts an unreachable VMDisk reports
The kubernetes-nodes guard and the image option list call an import
failing once its importer has restarted three times and is not running,
and the vm-disk guard once it has restarted three times, because CDI
keeps an unreachable URL in progress instead of moving it to Failed.
Assert that CDI reports both on the DataVolume of the unreachable
VMDisk, so a CDI change that stops doing so turns this suite red rather
than leaving the guards blind.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-17 11:20:21 +03:00
Aleksei Sviridkin b6ef231d44 docs(kubernetes-nodes): state why a pool must share its golden's class
The worker image guard, its error message and the storageClass docs
said CDI cannot clone across StorageClasses and always falls back to a
host-assisted copy. CDI falls back only when the two claims have
different CSI drivers or volume modes; with one driver it asks that
driver for a clone into the other class. The guard stays, the reason it
gives is corrected, and the docs name the virtualization default class
an empty storageClass now resolves to.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-17 11:20:20 +03:00
Yan Bondarenko d009a1e737 fix(qdrant): scrape TLS metrics over HTTPS
TLS-enabled Qdrant rejects the ServiceMonitor's HTTP requests. The
vendored chart exposes no scheme or CA value, so patch its endpoint
through the existing HelmRelease post-renderer mechanism. Trust the
issued CA and use a certificate SAN without disabling verification.

Tested the app-to-system chart render through Kustomize for explicit
TLS, external default TLS and explicit opt-out; the TLS cases fail
without the patch.

Fixes: cdb03a9929 ("feat(qdrant): implement TLS in Helm templates")
Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
2026-11-17 01:22:04 +01:00
Aleksei Sviridkin 0d239fab81 Merge branch 'main' into feat/kubernetes-nodes-talos-sysctls
The generated cozyrds file is regenerated from the merged values.yaml.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 17:17:33 +03:00
Aleksei Sviridkin 2d1d98364d fix(platform): ship cozy-lib with the capi-providers-core artifact
The upgrade hook image is rendered through cozy-lib.image, and the
chart links cozy-lib through charts/cozy-lib. The chart reaches the
cluster as the artifact the operator assembles from the PackageSource,
which copies a library into <chart>/charts/ only when the variant
declares it and the component lists it. capi-provider-core declared
neither, so the artifact carried a dangling symlink and the install
failed with 'no template "cozy-lib.image"'. Rendering from the git
tree resolves the symlink, which is why the chart tests stayed green.

Declare cozy-lib on the variant and on the capi-providers-core
component, as bucket-application does, and pin both in the chart
tests.

Fixes: a709ca1bdb ("fix(capi-providers-core): pull the upgrade hook image through cozy-lib")

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 16:24:25 +03:00
Aleksei Sviridkin e634fd75ed fix(capi-providers-core): repair a bridge selector with extra expressions
The repair check compared only matchLabels, so a bridge selector with
the right label plus matchExpressions was left alone, although the
bridge ConfigMaps carry nothing those expressions could match and the
selector then finds no repository. The check now compares the whole
selector, the same shape the repair patch writes.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 14:03:54 +03:00
Aleksei Sviridkin a52e8dac30 fix(capi-providers-core): name the version the upgrade hook rejects
The hook reported every malformed version as an installed one, also
when the bad value was the requested spec.version or the bridge or
target release from the chart, which sent an operator to look at the
wrong field. The message now says which version it checked.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 14:03:07 +03:00
Aleksei Sviridkin a6a82515f7 test(capi-operator): describe why the resync period is still pinned
The header said the resync period bounds how long a stale Ready lasts
after an operator restart. That was the v0.19 restart bug, which the
operator shipped now already fixes; the period is pinned only until
restart recovery on the new operator is measured.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 13:52:40 +03:00
Aleksei Sviridkin 4d251f4122 fix(capi-providers-core): let a never-installed provider take the fresh path
A provider whose first installation never completed has no
status.installedVersion. The hook and the kubeadm chart guard both
refused it, so a later chart version that could fix the installation
could not be applied without deleting the provider by hand.

cluster-api-operator installs such a provider from scratch at whatever
version it requests, so it needs no intermediate step: the hook now
skips it and the chart guard lets it through. An installed kubeadm
provider still requires an installed core provider, because it cannot
be moved to the intermediate release without one.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 13:31:47 +03:00
Aleksei Sviridkin a709ca1bdb fix(capi-providers-core): pull the upgrade hook image through cozy-lib
The hook image was rendered verbatim, so an installation that mirrors
images through the cluster images registry still pulled it from Docker
Hub. Routing it through cozy-lib.image applies the configured registry
like the other system charts do, and leaves the reference unchanged when
none is set.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 13:29:50 +03:00
Aleksei Sviridkin 40e219c0b6 fix(capi-providers-core): keep the upgrade Job until the next attempt
With hook-succeeded the Job is removed after a successful run, and
before-hook-creation already removes a failed one only when the next
attempt starts. Keeping the Job after success as well leaves the last
run's pod logs readable whichever way it ended; the next attempt still
replaces it. The ConfigMap and RBAC objects keep both policies.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 13:28:44 +03:00
Aleksei Sviridkin 78e21fefcc fix(seaweedfs): grant Object Lock actions to existing S3 identities
SeaweedFS 4.48 requires dedicated Object Lock actions, but upgrading the
COSI driver does not re-grant access for ready BucketAccesses. Add the
actions implied by existing Read and Write grants after install and
upgrade, without changing credentials or granting governance bypass.

The anonymous identity that public-read buckets share is skipped: the
COSI driver revokes public read by removing only Read:<bucket>, so
derived Object Lock reads would stay open to unsigned callers.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 13:28:42 +03:00
Aleksei Sviridkin a6d57c6aee test(capi): model the operator's cross-provider repository check
The kubectl fake let a provider converge as soon as its own selector
named its version, so the suite could not see a failure that comes from
another provider's repository. cluster-api-operator resolves the
repository of every other installed provider whenever a provider's
version changes, and refuses a selector that matches more than one
ConfigMap; that is how a bridge bundle carrying legacy labels blocked
the core step.

The fake now holds the repository ConfigMaps, the legacy v1.10 ones plus
the bridge ones rendered from the capi-operator chart, and applies the
operator's rule before a provider converges.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 13:23:35 +03:00
Aleksei Sviridkin b0faab56a0 fix(capi-operator): keep legacy selector labels off the bridge bundles
On a v1.10 installation the kubeadm BootstrapProvider still selects its
repository by bootstrap-components and bootstrap-provider alone. The
bridge bootstrap ConfigMap carried both labels, so that selector matched
two ConfigMaps as soon as the operator chart was upgraded. When the hook
then moved core to the bridge, cluster-api-operator resolved kubeadm's
repository for the upgrade, refused the ambiguous selector, and core
never left v1.10; every retry hit the same state.

The bridge ConfigMaps now carry only the version label, and the hook
selects a bridge by that label alone, narrowing a selector that still
keeps legacy labels.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 13:19:28 +03:00
Aleksei Sviridkin a7e0a6e187 ci(workflows): move GitHub Actions to their Node 24 majors
Most of the official actions move one or more majors, onto the Node 24
runtime. The inputs these workflows pass are still accepted, and the
contract tests that pin the checkout and App token commits follow.

Since checkout v6 the persisted token lives in a separate config file,
so unsetting the extra header in .git/config no longer removes it. The
release job's checkout stops persisting credentials, so its staging
branch push goes out with the App token, and a contract test guards
that setting.

The flux action stays on v2.8.6, whose tag has to equal the Flux CLI
version it installs. A self-hosted runner needs v2.327.1 or newer for
the Node 24 checkout, which the Proxmox workflow now states next to its
runs-on.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 01:07:37 +03:00
Aleksei Sviridkin 9cd2d3ac0f test(ci): smoke-test the tools that built images take from their base
The CSI, LINSTOR, multus, Harbor and redis-backup images call tools at
runtime that their base images or build stages install: mkfs and
mount.nfs, drbd, lvm and zfs, the CNI plugins, nginx and trivy under a
fixed uid, redis 8. A base or tool bump that drops one still builds,
and only fails once the image runs in a cluster.

The kubevirt CSI node plugin and its sidecars run inside tenant VMs on
whatever vCPU they are given, so their filesystem tools, libc and Go
entrypoints must not require more than x86-64-v2. C objects declare
that level in a GNU property note and Go binaries in their GOAMD64
build setting; a file that records neither fails the check.

Each PR build job runs the checks against the images it pushed, found
by diffing the tree's image references before and after the build.
Fork PRs are skipped because their images are not in a registry yet,
and the unit lane runs no container. A change to kubevirt-csi-node
alone, where the node sidecar tags live, now runs the kubevirt CSI
build too, and the check fails when either sidecar is missing or the
reference file cannot be read.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-11-16 01:07:36 +03:00
Aleksei Sviridkin 5a5d5cd3d8 fix(tests): reject matcher failures in negative file assertions (#5175)
<!-- 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

Fixes #3700.

Negative file assertions must not pass when the matcher fails or an
artifact is missing. Share `assert_file_lacks_pattern` through the
existing Bats helper, preserving all call sites while removing the 12
divergent copies. The shared implementation accepts absence only when
awk evaluates successfully and explicitly reports no match. It reports
read/evaluation failures regardless of their exit status and validates
the regex even when the artifact is empty.

Regression tests run the assertion under `bash -eu` and cover matching
and non-matching patterns, empty files, invalid regexes, missing paths,
directories, and unreadable files. The tests reproduce false positives
against the previous helper implementations, including a matcher that
prints a no-match result but exits with an error. The test suite
resolves its helper relative to its own directory and also runs outside
the repository root.

### Validation

- Bats 1.14.0: all 471 tests in the regression file and 12 affected
consumer suites pass, with no skips.
- All 462 tests in the 12 affected consumer suites pass under the dash
POSIX compatibility runner.
- All nine helper tests pass from both the repository root and `/tmp`;
independent verification also passes all nine with BusyBox awk v1.35.0.
The previous helper falsely accepts invalid patterns and unreadable
files with that implementation.
- `bash -n hack/test_helper.bash` and `git diff --check` pass.
- An earlier full Bats run executed all 2,491 tests: 2,426 passed and 65
failed. Of these, 56 require Docker and three require `envsubst`,
neither of which is installed in this environment. The remaining six
selector failures also reproduce on the unchanged baseline with the
older local yq; rerunning both selector suites with the CI-pinned,
checksum-verified yq v4.53.3 passes all 110 tests. The full-tree suite
has not been rerun for this corrective revision; its focused checks are
listed above.

### 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(tests): fail negative file assertions on invalid patterns or unreadable artifacts and share the helper across Bats suites.
```


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

## Summary by CodeRabbit

* **Tests**
* Consolidated checks for verifying that files do not contain specified
patterns.
* Expanded coverage to verify behavior for matching and non-matching
patterns, invalid patterns, missing paths, directories, inaccessible
files, and pattern-checking errors.
* Checks now succeed only when the target is a regular file and pattern
evaluation completes successfully without finding a match.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-15 06:00:02 +03:00