Commit Graph
7857 Commits
Author SHA1 Message Date
Alexey Artamonov 751cf28e98 test(backups): drop the comment restating what accepted() returns
Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 0f336e99c5)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:39 +00:00
Alexey Artamonov 2660954027 fix(clickhouse): give every backup run an archive of its own
An archive was named from the application and the BackupJob's start
time, which has one-second resolution. Two runs of one application
started in the same second, as two Plans on the same schedule are,
wrote the same archive. The strategy takes a finished upload of its
archive as an earlier attempt of its own run, so the later run could
succeed on the other run's upload and record an archive missing any
table created since.

The BackupJob's UID now ends the name. It goes after the timestamp so
names keep sorting chronologically, and the restore of a Backup that
records no archive, which accepts only a bare timestamp after the
release prefix, never picks one of these.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 1291e616c7)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:39 +00:00
Alexey Artamonov 14f06074e5 fix(backups): keep a ClickHouse archive an earlier attempt finished
A backup Pod that loses sight of its upload, by dying or by losing six
polls in a row, is retried while the sidecar finishes that upload. The
retry found it in the action log as a success, took the sidecar for
idle and asked for create_remote with resume again. clickhouse-backup
then rebuilds the local backup and uploads it once more over the
archive already in the bucket, which is left broken if that second
upload dies halfway.

The archive name belongs to one BackupJob, so a success row of exactly
this upload can only be an earlier attempt's, and the retry now takes
it as its result. An error or cancel row still leads to a resumed
upload, and a restore still runs again, since a restore is not named
per RestoreJob.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit d530ca8cf5)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:39 +00:00
Alexey Artamonov c90765771e test(backups): cover a ClickHouse restore against an unreachable sidecar
The restore path resolves its archive from list/remote before the start
gate runs, so it carries its own wait for a sidecar that is not up, and
only the backup path had a test for a sidecar that never answers. The
retry comment also miscounted: the limit is attempts, not retries.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit ae1e1830ce)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:39 +00:00
Alexey Artamonov 817b59a45a fix(backups): take over a running ClickHouse restore on Job retry
restore_remote drops every table it restores before recreating it, so
running it twice discards whatever was written after the first run
finished. The strategy Job retries a failed Pod up to twice, and with
the start gate waiting for an idle sidecar instead of hitting 423, a
retry whose predecessor died after its POST waited for that restore to
finish and then started a second one. A retry now takes over a
restore_remote of the same archive that is still running.

A finished row is not taken over: the sidecar never trims its action
log, so a success row of the archive may belong to an earlier
RestoreJob, and treating it as this one would report a restore that
never ran. A retry that arrives after the restore finished therefore
still runs it again.

Once the operation is accepted, one failed poll no longer ends the
attempt under errexit; six in a row do. An operation that ends
cancelled now fails the Pod instead of being polled forever.

A retried backup still starts a new create_remote, because its archive
name changes on every attempt; taking it over needs a name fixed for
the whole BackupJob.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 993b79bb37)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:39 +00:00
Alexey Artamonov 1e5e3a45df fix(backups): fail a ClickHouse backup whose operation the sidecar lost
The sidecar keeps its action log only in memory, so a sidecar restart
after create_remote was accepted drops the operation's row, and the
strategy kept polling for it forever under a Job with no deadline.
Until now the resumed upload re-added a row ending in the archive name
and ended the loop, but resume is now off so a failed attempt never
reaches the bucket, which leaves nothing to end it. The row is logged
before the POST is acknowledged, so its absence means the operation is
gone and the attempt has to fail.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit d0a73302d9)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:38 +00:00
Alexey Artamonov 8b76529539 fix(backups): wait for an idle ClickHouse backup sidecar before starting
The sidecar refuses a new operation with 423 while another one is in
progress, but the strategy only waited for the API to answer, and went
on to start its operation even when it never did. An operation already
running in the sidecar therefore failed the attempt within seconds.

Poll the action log until nothing is in progress, and fail the Pod
instead of proceeding when the sidecar stays busy or unreachable, so
the failure names the cause rather than surfacing as a 423 or a
connection error from the operation itself.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit a25db5aeb6)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:38 +00:00
Alexey Artamonov 84a5f9ee64 fix(clickhouse): stop the backup sidecar from publishing failed attempts
create_remote keeps its local backup when the upload fails, and with
the upstream defaults the sidecar never prunes local backups and
resumes every unfinished upload when it starts. A strategy attempt that
fails mid-upload therefore lands in the bucket on the next sidecar
restart as an archive no Backup refers to, and restore can pick it as
the newest one. The resumed upload also holds the API lock, so the
strategy Pods racing it get 423 and burn the Job's retries.

Turning the resume off keeps a failed attempt out of the bucket, and a
negative local retention leaves at most the newest local backup and
drops it once its upload succeeds, so leftovers no longer accumulate on
the data volume.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 4f3f1a5cad)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:38 +00:00
Myasnikov Daniil 668ddded49 fix(seaweedfs): enforce S3 bucket lifecycle rules (#5228)
<!-- 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

SeaweedFS accepts and stores an S3 bucket lifecycle configuration, but
only the `s3_lifecycle` job of its plugin worker applies it, and that
job is scheduled by the admin server. Cozystack deployed neither, so a
lifecycle rule returned 200 and no object ever expired, on the platform
backup bucket and on tenant buckets alike. That also made the documented
way to bound backup storage a no-op.

This PR adds the admin server and a worker to Simple and MultiZone
SeaweedFS instances, behind a new `lifecycle.enabled` value that is
**off by default**. A Client instance is unchanged, because its rules
are enforced where the instance it connects to runs. The worker
registers for `s3_lifecycle` only, so vacuum, balancing and erasure
coding are not started as a side effect. The admin keeps its job state
on a 1Gi volume on `lifecycle.storageClass`, or on the cluster default
when that is empty; `volume.storageClass` is not reused, because in
MultiZone it can name a class local to one zone or node. The admin UI is
protected by a generated password, because a tenant namespace admits
traffic from the whole cluster. The dashboard Role lists the two new
WorkloadMonitors.

Enabling the worker alone was not enough on SeaweedFS 4.45. Its chart
renders no `[grpc.s3]` section, so the s3 gateway served its internal
gRPC in plaintext while the worker dials it with mTLS, and every
lifecycle delete failed the TLS handshake. The section is backported
from upstream (seaweedfs/seaweedfs#11157, released in 4.46) as a chart
patch, applied with `--forward` so the next `make update` stops at the
point where the patch must be dropped instead of silently reversing it.
The s3 pods are restarted once so they load the section. This also
repairs IAM cache propagation between s3 replicas, which failed in the
same way, and it applies whether or not lifecycle is enabled.

The data-plane release now retries a failed install or upgrade in place
(`RetryOnFailure`) instead of rolling it back. With the previous default
remediation and unlimited retries, an upgrade that waited out its
timeout, for example on a tenant quota with no room for the admin
volume, rolled back and retried forever, restarting the s3 pods twice
per cycle. The worker's hostname anti-affinity is relaxed to a
preference so a rollout finishes on a single-node cluster.

#### Why lifecycle is off by default

The daily walk that SeaweedFS uses to expire objects sends its deletes
without an object identity, and the s3 server skips its compare-and-swap
when no identity is given; it does not re-check the object's age either.
A key overwritten between the walk's listing and the delete loses its
new content. This path is unchanged from 4.45 through 4.52 and on
upstream master (`weed/s3api/s3lifecycle/dailyrun/walker_dispatcher.go`,
`identityMatches` in `weed/s3api/s3api_internal_lifecycle.go`). Backup
buckets write unique keys and are barely exposed; a tenant bucket that
rewrites a fixed key is. On top of that, turning enforcement on would
start applying, on upgrade, every rule that was stored and ignored until
now. Both are retention changes an operator should choose, so nothing
changes for existing instances until `lifecycle.enabled` is set. Making
it the default again is left to a separate PR that carries object
identity on the walk path; upstream report:
https://github.com/seaweedfs/seaweedfs/issues/12451.

#### Turning lifecycle on and off

When `lifecycle.enabled` is set, rules that have been stored but ignored
start applying within minutes, and objects they have already expired are
deleted on that first pass, so review existing bucket lifecycle rules
first. Set `lifecycle.storageClass` before enabling, and prefer a
replicated class: the class is part of the admin StatefulSet's volume
claim template, which cannot change, so changing it while lifecycle is
on makes every upgrade of the instance fail until it is reverted. Moving
the volume means disabling lifecycle, deleting the
`admin-data-seaweedfs-admin-0` PVC, changing the class and enabling
lifecycle again. Each instance gains two small pods and a 1Gi PVC; when
the tenant quota has no room for them, the data-plane release keeps
retrying in place until it has.

When `lifecycle.enabled` is turned off again, the parent release removes
the admin credentials Secret while the data-plane release removes the
admin StatefulSet only on its own reconcile, shortly after. An admin pod
that restarts in that window fails to start on the missing Secret until
the StatefulSet is gone; nothing is lost, and the order is left as is.
The admin PVC stays until the instance is deleted, and a later re-enable
starts the admin with a new password.

Verified on a test cluster with the 4.45 chart: without the backport,
the worker found the expired objects and every delete failed with `tls:
first record does not look like a TLS handshake`; with this branch and
lifecycle enabled, a rule with a past expiration date removed the
matching objects and left the others, both on a manual run and on the
first scheduled pass.

### 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
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up needed, not opened yet:
`operations/services/backup-classes.md` (v1.7 and next) advises an S3
lifecycle policy, which the bundled SeaweedFS applies only once
`lifecycle.enabled` is set; the SeaweedFS reference page gains
`lifecycle.enabled` and `lifecycle.storageClass` from the regenerated
README on the next release
- [ ]
[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 SeaweedFS application, so the
new values do not reach it.

### 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(seaweedfs): S3 bucket lifecycle rules can now be enforced. Simple and MultiZone SeaweedFS instances run the SeaweedFS admin server and a lifecycle worker when the new `lifecycle.enabled` value is set; it is off by default, so existing instances keep their current behaviour. It stays off by default because the upstream daily expiry walk deletes without checking that the object it listed is still the one stored, so an object overwritten in that window can be deleted although it is new. When enabled, rules that were stored but ignored start applying within minutes and objects they have already expired are deleted on that first pass; review existing rules first. Each enabled instance gains two small pods and a 1Gi volume, placed on `lifecycle.storageClass` or the cluster default. Independently of the switch, the s3 gateway now serves its internal gRPC over mTLS, which repairs IAM cache propagation between s3 replicas and restarts the s3 pods once on upgrade.
```

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

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

## Summary by CodeRabbit

* **New Features**
* Added optional, daily S3 bucket lifecycle-rule processing for
supported SeaweedFS configurations. It is disabled by default; Client
instances rely on lifecycle rules configured on the connected SeaweedFS.
* Added configurable storage for lifecycle job state and dashboard
visibility for lifecycle components.
* Enabled the S3 gRPC server to use its internal TLS identity when
security is configured.

* **Bug Fixes**
* Improved storage-class handling so numeric-looking names remain
strings and unset classes are omitted where appropriate.
* Clarified backup cleanup guidance, including when lifecycle rules
apply and how to reclaim storage.

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

Backported-from: 238b3ee491
2026-11-25 10:15:38 +00:00
Alexey Artamonov 48aa4188b4 fix(seaweedfs): keep the metadata database storage class a string
db.storageClass went unquoted into the values of the database release
and again into its CNPG Cluster. A class name made only of digits,
which Kubernetes allows, became a number that the Cluster rejects, and
a line break in the value could add keys to the database release
values. It is quoted at both steps.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit f5114ae04c)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:38 +00:00
Alexey Artamonov 48c14268fe fix(seaweedfs): escape pool and zone storage classes in the release values
Pool and zone storage classes were wrapped in quotes by hand, which
does not escape a quote or a backslash in the value: a quote closes the
string early and the data-plane release values stop parsing, with a
YAML error that does not name the field. They are now quoted like the
volume and admin classes.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit e6eb3345c6)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:38 +00:00
Alexey Artamonov 1a01f171ea fix(seaweedfs): quote every storage class the upstream claims carry
The master, filer, volume index, log and all-in-one claims of the
upstream chart write storageClassName unquoted, like the data claims
did, so a class name made only of digits renders as a number and the
claim is rejected. None of them is set by Cozystack today, but they
are values of the same chart that a later change can start handing on,
and the patch already exists for the data claims. They follow the same
rule: quoted, and left out when no class is named so that the cluster
default applies. The deprecated filer.enablePVC claim is left alone:
it renders only with filer.data unset, and the template fails earlier on
an unset filer.data, so it cannot be reached.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit f83db514b0)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:38 +00:00
Alexey Artamonov bb1af44417 fix(seaweedfs): keep storage class names strings in the volume claims
The upstream admin and volume StatefulSets write storageClassName
unquoted, so a class name made only of digits, which Kubernetes allows
and the parent chart now hands on as a string, turned back into a
number there and the claim was rejected. The field is quoted, and left
out when no class is named: quoting an empty value would set an empty
storageClassName, which disables dynamic provisioning instead of using
the cluster default. Upstream 4.52 and master still write both fields
unquoted, so this is a chart patch, applied with --forward so make
update stops once upstream carries an equivalent change.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit e7b5a5a1a9)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:38 +00:00
Alexey Artamonov 7a6aac9ede fix(seaweedfs): hand storage class names to the data plane as strings
The volume and admin storage classes were written unquoted into the
values of the data-plane release. A class name made only of digits,
which Kubernetes allows, arrived there as a number, and a value with a
line break could add keys next to the field, past the schema that is
the tenant's input gate. Both are now quoted. lifecycle.storageClass,
new in this release, also carries the StorageClass name rules in its
schema, so a value that cannot name a class is refused when the
application is written instead of leaving the admin claim pending.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 7c9aa2fe10)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:38 +00:00
Alexey Artamonov 9a6715502d fix(seaweedfs): give the lifecycle admin volume its own storage class
volume.storageClass is picked for volume server data, and in a
MultiZone instance it can name a class whose volumes exist in one zone
or on one node. Reusing it for the admin volume would tie the admin to
that zone or node, so losing it would stop lifecycle enforcement for
the whole instance, a placement nobody chose for the admin. The admin
volume now takes lifecycle.storageClass, and the cluster default when
that is empty.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 5cbb3a633e)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:37 +00:00
Alexey Artamonov e59a9db440 fix(seaweedfs): keep bucket lifecycle enforcement off unless enabled
The daily walk that expires objects sends its deletes without an object
identity, and the s3 server skips its compare-and-swap when none is
given (walker_dispatcher.go and identityMatches, unchanged from 4.45
through 4.52). It does not re-check the object's age either, so a key
overwritten between the walk's listing and the delete loses its new
content. Backup buckets write unique keys and barely meet that window;
a tenant bucket that rewrites a fixed key does.

Turning enforcement on by default would also start applying, on
upgrade, every rule that was stored and ignored until now. Both are
retention changes an operator should choose, so the admin server and
the worker now run only where lifecycle.enabled is set. On by default
can return once the walk carries identity.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 62b4213784)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:37 +00:00
Alexey Artamonov df3f13354c fix(seaweedfs): let the lifecycle worker roll out on a single node
The worker is a one-replica Deployment, so a rollout surges a second
pod before stopping the first, and the subchart pins worker pods apart
with a hard hostname anti-affinity. On a single-node cluster the surge
pod never schedules and the release waits out its timeout on every
change to the worker template. A preference keeps the spread where
there are nodes for it, as the master and s3 settings here already do.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 7eabb9b517)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:37 +00:00
Alexey Artamonov b444b9d1d0 fix(seaweedfs): let the dashboard read the lifecycle monitors
The dashboard reads an application's WorkloadMonitors by name through
its resource-map Role, so the admin and worker monitors the lifecycle
switch adds were invisible to the tenant: the components ran, but the
application page never listed them.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit a6f4f557f3)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:37 +00:00
Alexey Artamonov 2305b5cd3e build(seaweedfs): stop make update when the [grpc.s3] backport lands
The backport becomes redundant once the vendored chart reaches 4.46.
Re-applied to a chart that already carries the section, BSD patch takes
it as reversed, removes the section and exits 0, so a re-vendor would
quietly return the s3 gRPC listener to plaintext. --forward refuses an
already-applied patch with a non-zero exit, which stops the update at
the point where the patch should be dropped.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit c3d1a73d8c)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:37 +00:00
Alexey Artamonov 849d8449d7 fix(seaweedfs): retry the data-plane release instead of rolling it back
The admin volume and the two lifecycle pods are new demands on tenant
quota, so an upgrade into a namespace with no headroom can wait out its
timeout. Flux's default remediation then rolls the release back, and
with unlimited retries it does so on every attempt: each rollback drops
the [grpc.s3] section and the s3 restart annotation, each retry brings
them back, and the s3 pods restart twice per cycle until quota frees up.

RetryOnFailure keeps what was applied and retries it, as the parent
release that the apiserver builds for the application already does.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit a70a1cf83b)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:37 +00:00
Alexey Artamonov ae779b1416 docs(backups): say who applies a bucket lifecycle rule
The notes that send a tenant to a bucket lifecycle rule for a backup
object Cozystack leaves behind read as if some policy were already in
place. None is: the rule has to be set on the bucket, and it is applied
only by an object store that implements lifecycle, which the bundled
SeaweedFS now does once a day while lifecycle.enabled is on.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 27e0aa2880)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:37 +00:00
Alexey Artamonov f966ddb939 fix(seaweedfs): run the worker that enforces bucket lifecycle rules
SeaweedFS accepts and stores a bucket lifecycle configuration, but only
the s3_lifecycle job of its plugin worker acts on it, and that job is
scheduled by the admin server. Neither ran here, so a rule returned 200
and no object ever expired, on the platform backup bucket and on tenant
buckets alike, and the documented way to bound backup storage did
nothing.

Both now run in Simple and MultiZone instances, behind lifecycle.enabled
(on by default). A Client instance has no data plane of its own; its
rules are enforced where the master it connects to runs. The worker
registers for s3_lifecycle alone, so enabling lifecycle does not also
start vacuum, balancing or erasure coding. The admin keeps its job state
on a small volume (on volume.storageClass when set), and its UI gets a
generated password, because a tenant namespace admits traffic from the
whole cluster and the server is unauthenticated without one. The
data-plane chart keeps both off unless its parent turns them on, so it
never starts an admin without that password.

Existing rules start applying minutes after the upgrade: the admin's
scheduler runs the first pass within one idle cycle of its lifecycle
lane, then once a day, and objects the rules have already expired are
deleted on that first pass.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit f36d864e99)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:37 +00:00
Alexey Artamonov d3afba46b3 fix(seaweedfs): serve the s3 internal gRPC over mTLS
weed s3 takes its gRPC server identity from [grpc.s3] in security.toml
and serves plaintext when the section is missing, which it is in the
4.45 chart. Every peer dials that port with mTLS: the s3_lifecycle
worker with its [grpc.worker] certificate, other s3 replicas with
[grpc.client] for IAM cache propagation. Both fail the handshake, so
lifecycle deletes cannot run and identity changes do not reach the
other replicas.

The section is backported from upstream (seaweedfs/seaweedfs#11157,
first released in 4.46) as a chart patch. It uses the internal
CA-signed client certificate the s3 pods already mount, not the public
listener's tlsSecret, which internal peers would not trust.

security.toml is mounted by subPath, so a running s3 pod never sees the
new section. A pod annotation changes the s3 template in this release
so the upgrade restarts it.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
(cherry picked from commit 2cc90b18f5)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:37 +00:00
Myasnikov Daniil 3ce6c4badd fix(talos): bump Talos to v1.14.4 (CVE-2026-99999) (#5045)
## What this PR does

Bumps the Talos release Cozystack ships for host nodes from v1.14.2 to
v1.14.4. Talos v1.14.4 ships Linux 6.18.57, which carries the upstream
fix
[`6785011f8b16`](https://git.kernel.org/linus/6785011f8b16abf40b1e9d8b2e332232b3e68822)
("ipv4: validate checksum_start before completing checksum") for
CVE-2026-99999, known as PwnEscape. v1.14.2 runs Linux 6.18.54 and is
affected.

A guest controls the `csum_start` field of the `virtio_net_hdr` it hands
to the host through TAP or vhost-net. When the host fragments such a
packet, `skb_checksum_help()` writes two guest-chosen bytes inside the
IPv4 header, and `ip_frag_next()` then copies host memory past the
packet into every fragment. The leak has been chained into code
execution on the host. No nested virtualization is needed. KubeVirt VMs
on Cozystack use the bridge binding, a TAP device with vhost-net and
checksum offload on, so root in any guest (a `vm-instance` or a tenant
Kubernetes worker) reaches this path on the host node.

Changes:

- `packages/core/talos/images/talos/profiles/*`: regenerated with
`hack/gen-profiles.sh v1.14.4` (installer-base and every system
extension digest, amd64 and arm64).
- `packages/system/multus/images/multus-cni/Dockerfile`: the
`talos-cni-plugins-checked-against` marker moves to v1.14.4. Talos
v1.14.4 still pins containernetworking/plugins v1.9.1 in
siderolabs/pkgs, the same as `CNI_PLUGINS_VERSION`.
- `docs/operations/system-memory-limits.md`: the shipped version it
names moves to v1.14.4. No OOM handler file changed between v1.14.2 and
v1.14.4, so the quoted defaults still hold.

The v1.14.2 to v1.14.4 changes are patch fixes only (network route
teardown, DHCP, KubePrism recovery, mount cleanup, etcd 3.7.2), with
DRBD 9.3.4 and ZFS 2.4.4 unchanged. No machine-config change is needed
on top of the v1.14 requirements that v1.14.2 already brought in.

Not covered here: tenant Kubernetes workers default to Talos v1.13.6
(`packages/apps/kubernetes`, `packages/apps/kubernetes-nodes`). The bug
is on the host side, so the host bump is what closes the guest escape.
No v1.13 release with the fix exists yet (v1.13.11 is on 6.18.54).

Tested: `hack/cni-plugins-staging-contract.bats` and
`hack/talos-installer-index_test.bats` pass (12/12), run in the
`bats/bats:1.13.0` container. No image was built or booted locally.

### Screenshots

Not a UI change.

### Downstream repositories

The trigger map hits `cozystack/website`: this bumps the version in
`packages/core/talos/images/talos/profiles/installer.yaml`, and
`data/versions/next.yaml` there pinned `talos: "v1.14.2"`. The follow-up
moves it to v1.14.4 and should merge after this PR. No other repository
on the map is reached by this diff.

- [ ] No downstream repository is affected by this change
- [x] [cozystack/website](https://github.com/cozystack/website) -
follow-up: https://github.com/cozystack/website/pull/768
- [ ]
[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(talos): Bump Talos to v1.14.4 (Linux 6.18.57) to fix CVE-2026-99999 (PwnEscape), a guest-to-host escape through virtio_net_hdr checksum offload that any KubeVirt VM can reach on the host node. Upgrade and reboot host nodes; the fix applies only to the kernel that is running.
```

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

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

## Summary by CodeRabbit

* **Updates**
* Updated Talos-based installer, ISO, kernel, metal, and NoCloud
images—including ARM64 variants—from v1.14.2 to v1.14.4, with refreshed
system extensions and firmware.
* Updated the documented Talos version associated with host-node
memory-limit defaults to v1.14.4.

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

Backported-from: 382169be52
2026-11-25 10:15:36 +00:00
Mattia Eleuteri 482e3e85f8 fix(talos): bump Talos to v1.14.4 (CVE-2026-99999)
Talos v1.14.4 ships Linux 6.18.57, which carries the upstream fix
6785011f8b16 ("ipv4: validate checksum_start before completing
checksum") for CVE-2026-99999, known as PwnEscape.

A guest controls the csum_start field of the virtio_net_hdr it hands
to the host through TAP or vhost-net. When the host fragments such a
packet, skb_checksum_help() writes two guest-chosen bytes inside the
IPv4 header, and ip_frag_next() then copies host memory past the
packet into every fragment. The bug reads host kernel memory and has
been chained into code execution on the host. KubeVirt VMs on
Cozystack use the bridge binding, a TAP device with vhost-net and
checksum offload on, so root in any guest reaches this path on the
host node. v1.14.2 runs Linux 6.18.54 and is affected.

The Talos CNI plugins stay at containernetworking/plugins v1.9.1, so
the multus staging marker moves to v1.14.4 with no version change.

Assisted-by: LLM
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
(cherry picked from commit d28316671c)
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-11-25 10:15:36 +00:00
Myasnikov Daniil 114df65045 fix(platform): honour a bool false in ingress-enabled and monitoring-enabled (#5354)
## What this PR does

`default "true"` treats a bool false as empty, so an unquoted
`_cluster.ingress-enabled: false` or `_cluster.monitoring-enabled:
false` still rendered `_namespace.ingress: tenant-root` and the
monitoring ExternalName redirects. Both gates now check for a missing
key first and otherwise require `"true"` or a bool true, so a missing
key keeps the old behaviour, every string value keeps its old meaning,
and a bool false turns the feature off. #5097 does the same for the
seaweedfs flag.

helm-unittest 1.1.2, cozystack-basics 83 of 83. Against the templates on
main the two new bool-false cases fail.

### Downstream repositories

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

### Release note

```release-note
fix(platform): an unquoted false in _cluster.ingress-enabled or _cluster.monitoring-enabled now turns off the tenant-root ingress key and the monitoring redirects.
```


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

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

## Summary by CodeRabbit

* **Bug Fixes**
* Ingress and monitoring redirects are no longer enabled when their
settings are explicitly `false` or empty. When settings are missing,
existing default behavior is preserved.

* **Tests**
* Added coverage for disabling ingress and monitoring redirects with
boolean `false`.

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

Backported-from: 18a9530b87
2026-11-25 09:58:13 +00:00
Myasnikov Daniil 59810ddf14 fix(kubernetes): remove cilium dependency from coredns HelmRelease (#5331)
## What this PR does

Closes #5315

Removes `spec.dependsOn` on Cilium from the tenant `coredns`
`HelmRelease`
(`packages/apps/kubernetes/templates/helmreleases/coredns.yaml`).

When Hubble Relay is enabled at tenant cluster creation, `hubble-relay`
waits on DNS resolution for `hubble-peer.cozy-cilium.svc.cluster.local`
before the Cilium `HelmRelease` becomes Ready. Because CoreDNS
previously declared `dependsOn` on Cilium, Flux blocked CoreDNS
installation until Cilium was ready, creating a circular deadlock.
Allowing both `HelmRelease` resources to reconcile concurrently lets
CoreDNS retry (`spec.install.remediation.retries: -1`) until Cilium
brings up cluster networking, unblocking CoreDNS and Hubble Relay.

### 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(kubernetes): remove cilium dependency from coredns HelmRelease to prevent a circular startup deadlock when Hubble Relay is enabled
```

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

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

## Summary by CodeRabbit

* **Updates**
* CoreDNS no longer waits for the release-specific Cilium HelmRelease
dependency before being managed. Its configured values remain unchanged,
and installation and upgrade remediation behavior is covered by
automated checks.

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

Backported-from: ff461cc41f
2026-11-25 09:58:13 +00:00
Yan Bondarenko 0de36b85ef fix(platform): honour a bool false in ingress-enabled and monitoring-enabled
Helm's default treats a bool false as empty, so an unquoted false in
either _cluster flag still rendered _namespace.ingress and the monitoring
redirects. Check for a missing key first and require "true" or a bool
true otherwise.

Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
(cherry picked from commit a314dacb86)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:13 +00:00
anikethinge 948ac0b46e fix(kubernetes): remove cilium dependency from coredns HelmRelease
When Hubble Relay is enabled at tenant cluster creation, hubble-relay waits on DNS resolution for hubble-peer.cozy-cilium.svc.cluster.local before the Cilium HelmRelease becomes Ready. Because the CoreDNS HelmRelease declared dependsOn on Cilium, Flux blocked CoreDNS installation until Cilium was ready, creating a circular deadlock.

Removing dependsOn from CoreDNS lets both HelmReleases reconcile concurrently: CoreDNS pods remain Pending without a CNI and retry via spec.install.remediation.retries: -1 until Cilium comes up, at which point CoreDNS starts and unblocks Hubble Relay.

Closes: #5315
Assisted-by: LLM
Signed-off-by: anikethinge <anikethinge4@gmail.com>
(cherry picked from commit a91689ad8a)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:13 +00:00
Myasnikov Daniil b9d5664ca1 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 -->

Backported-from: f5479e7093
2026-11-25 09:58:12 +00:00
Myasnikov Daniil 68d63dbbee fix(ingress-nginx): pick up the nginx rebuild with the HTTP/2 CVE fixes (#5377)
## What this PR does

Moves the ingress-nginx controller to `v1.11.6-cozystack.1`, the same
v1.11.6 controller with its nginx 1.25.5 rebuilt with two HTTP/2 fixes
from the nginx 1.30 stable branch:

| nginx commit | Fixes |
| --- | --- |
|
[`0c87dd1d`](https://github.com/nginx/nginx/commit/0c87dd1db413e440a4e3ef7ee8acc518509e8809)
| CVE-2026-123633, HTTP/2 use-after-free when `worker_connections` run
out |
|
[`b89c4100`](https://github.com/nginx/nginx/commit/b89c4100bf6762a45e4a6463eaf4b70368277c94)
| CVE-2026-123007, HTTP/2 flow control window overflow |

kubernetes/ingress-nginx is archived and will not publish another
1.11.x. The rebuild lives in the fork:
cozystack/ingress-nginx-with-protobuf-exporter#13. It compiles nginx
from upstream's own sources, patches and configure line, applies the two
commits last, and checks the result against the shipped binary.

Checked on the published image (`sha256:1d3f0e01…`, amd64 and arm64):

- `nginx -v` reports 1.25.5 with upstream's configure arguments, and
`nginx -t` passes on the controller's config;
- the nginx binary differs from the one in
`registry.k8s.io/ingress-nginx/controller:v1.11.6`;
- run as `www-data`, nginx binds port 80 and answers 200 over HTTP/2, so
`cap_net_bind_service` survived the rebuild.

`helm unittest` passes for the chart. Not run on a live cluster.

`nginx -v` still says 1.25.5, so scanners that match on the version will
keep flagging it.

### Screenshots

N/A, no UI changes.

### Downstream repositories

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

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

### Release note

```release-note
fix(ingress-nginx): the ingress-nginx controller now runs nginx 1.25.5 rebuilt with the HTTP/2 fixes for CVE-2026-123633 and CVE-2026-123007. nginx still reports version 1.25.5.
```

Backported-from: d7573c009c
2026-11-25 09:58:12 +00:00
Yan Bondarenko e509806cbf 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>
(cherry picked from commit d009a1e737)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:12 +00:00
Myasnikov Daniil acdca8d971 fix(lineage-webhook): keep an explicit tenantresource false (#4920)
## What this PR does

Lets a chart narrow the lineage webhook's
`internal.cozystack.io/tenantresource` verdict without being able to
widen it. The webhook computes the verdict from the
ApplicationDefinition's `secrets` selectors on first admission and
copied it over whatever label the chart rendered, so a Secret the
definition still selected was projected through
`core.cozystack.io/tenantsecrets` whatever the chart said. A `"false"`
rendered on a Secret the webhook admits for the first time (CREATE) is
now kept; a rendered `"true"` is still replaced by the computed verdict.
A re-admission (UPDATE with `managed-by-cozystack` dropped, which the
cacert controller does on a selector change) still gets the definition's
verdict, because the `"false"` it carries is the one this webhook wrote
earlier.

This is rollout step 2 of the accepted [user secrets API
proposal](https://github.com/cozystack/community/blob/main/design-proposals/user-secrets-api/README.md):
during a kind's conversion the converted chart renders the platform-only
`<release>-credentials` Secret with `tenantresource: "false"` while the
old definition may still select the name, and the label is what keeps
that Secret off the projection in the window. It ships on its own
because nothing else depends on it and the conversions do.

Behaviour otherwise unchanged: an object with no rendered label gets the
definition's verdict as before, and the re-admission short-circuit on
`managed-by-cozystack` is untouched.

Covered by a handler test: on CREATE, a rendered `false` kept where the
selector matches, a rendered `true` overwritten where it does not, and
no rendered label taking the verdict; on a re-admission UPDATE, a grant
where the selector now matches and a revoke where it no longer does.

### Screenshots

No UI change.

### Downstream repositories

Walked the trigger map against the diff: two files under
`internal/lineagecontrollerwebhook`, no CRD, no package, no chart, no
values, no `hack/` change. The ApplicationDefinition's selector
semantics gain one exception, but the website's ApplicationDefinition
page does not describe the projection verdict at that depth, so there is
nothing there to update.

- [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(lineage-webhook): a Secret created with `internal.cozystack.io/tenantresource: "false"` keeps that label even where its ApplicationDefinition selects the name, so a chart can take a Secret off the tenantsecrets projection; a rendered `"true"` is still overwritten by the definition's verdict.
```


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

## Summary by CodeRabbit

* **Bug Fixes**
* On resource creation, an existing `false` tenant-resource label is
preserved even when the configured selector matches. Otherwise, the
label reflects the selector’s verdict. On updates, the label is set
according to the selector.
* **Tests**
* Added coverage for tenant-resource label behavior on creation and
updates, including existing and missing labels.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Backported-from: 65cb73e380
2026-11-25 09:58:12 +00:00
Andrei Kvapil 4d7515ab3e fix(ingress-nginx): pick up the nginx rebuild with the HTTP/2 CVE fixes
The controller image v1.11.6 ships nginx 1.25.5, and the upstream
project is archived, so no 1.11.x with a fixed nginx will come. The
cozystack fork now rebuilds that same nginx with the two HTTP/2 commits
from the 1.30 stable branch (CVE-2026-123633, CVE-2026-123007), and
this moves the controller to that build.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
(cherry picked from commit 64cc6d2ff1)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:12 +00:00
Myasnikov Daniil e23dd27c27 fix(opensearch): disable the Base64 intrinsics hit by CVE-2026-114938 (#5373)
## What this PR does

CVE-2026-114938 ("Java4Shell") is an out-of-bounds write in the AVX-512
VBMI Base64 decoder of OpenJDK 17.0.6 and later. OpenSearch decodes the
Basic credentials of a request before it authenticates it, so on an
x86-64 node with AVX-512 VBMI a tenant's cluster can be attacked by
anyone who reaches its HTTP port.

Two of the three versions the `opensearch` application offers bundle an
affected JDK, and OpenSearch has not released a build on a patched one
yet:

| Image | Bundled JDK | Affected |
|---|---|---|
| `opensearchproject/opensearch:3.0.0` | 21.0.7 | yes |
| `opensearchproject/opensearch:2.11.1` | 17.0.8 | yes |
| `opensearchproject/opensearch:1.3.20` | 11.0.25 | no |

This PR starts the nodes with `-XX:-UseBASE64Intrinsics`, the mitigation
[RHSB-2026-018](https://access.redhat.com/security/vulnerabilities/RHSB-2026-018)
recommends: it removes the vulnerable code path and keeps the other
AVX-512 optimizations.

The flag is delivered as a `jvm.options.d` file mounted from a ConfigMap
through `general.additionalVolumes`, because neither obvious route
works:

- `bin/opensearch-env` unsets `JAVA_TOOL_OPTIONS`, so an env var never
reaches the JVM;
- setting `nodePools[].jvm` makes the operator stop sizing the heap from
the memory request and use the string as is.

The operator mounts `general.additionalVolumes` into the node pools and
the bootstrap pod alike, and `restartPods` restarts them when the file
changes.

Verified by starting 3.0.0, 2.11.1 and 1.3.20 with the file mounted:
each server JVM runs with `-XX:-UseBASE64Intrinsics`, and the heap
passed in `OPENSEARCH_JAVA_OPTS` still applies after it. `helm unittest`
passes (156 tests), including a new suite. Not tested through the
operator on a live cluster.

Notes for the reviewer:

- This is a mitigation, not a fix. A version bump has to wait for an
OpenSearch release on a patched JDK.
- Upgrading restarts every OpenSearch cluster once.
- The securityadmin update Job is left alone: it is a client and accepts
no inbound connections. OpenSearch Dashboards is Node.js.
- The commit picks onto `release-1.7` cleanly and conflicts in
`templates/opensearch.yaml` on `release-1.6` (checked with a merge-tree
dry run).

### Screenshots

N/A — no UI changes.

### Downstream repositories

Walked the trigger map against the diff: one template, one new template
and one unit test under `packages/apps/opensearch`; no values key,
`values.schema.json`, README, version enum or default changes.

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

### Release note

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

Backported-from: 026b015635
2026-11-25 09:58:12 +00:00
Timofei Larkin 5f025e9d80 fix(lineage-webhook): keep a rendered false only on create
The cacert controller re-runs admission after a selector change by
dropping managed-by-cozystack and keeping the other labels, so the
UPDATE carries the "false" this webhook wrote on an earlier admission.
Reading that as the chart's narrowing froze the old verdict: a
projection, once revoked, could not be granted again. The chart's
narrowing only matters on CREATE, since an existing Secret already
carries managed-by-cozystack and skips the webhook.

Assisted-by: LLM
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
(cherry picked from commit 730fd5ebf5)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:12 +00:00
Myasnikov Daniil e4bfcbf280 fix(kamaji): drop kubelet config fields older tenants do not know (#4896)
## What this PR does

Older tenant Kubernetes versions receive kubelet config fields they do
not know. The pinned Kamaji 26.9.4-edge build uses the Kubernetes 1.37
libraries to render `kube-system/kubelet-config`:

| Field | Known since | Rendered for tenants |
| --- | --- | --- |
| `memoryReservationPolicy` | 1.36 | v1.31 to v1.35 |
| `mergeDefaultEvictionSettings` | 1.33 | v1.31 to v1.32 |
| `crashLoopBackOff` | 1.32 | v1.31, as `crashLoopBackOff: {}` |

On a v1.35 tenant, `kubeadm join` logs:

```text
configset.go:176 error unmarshaling configuration schema.GroupVersionKind{Group:"kubelet.config.k8s.io", Version:"v1beta1", Kind:"KubeletConfiguration"}: strict decoding error: unknown field "memoryReservationPolicy"
```

Nodes still join, because kubeadm only logs this and decodes leniently,
dropping the field. Anything that decodes this ConfigMap strictly fails.

The compatibility patch drops these fields when the tenant version
predates them, including fields added by a user JSON patch. Supported
fields are kept. The version checks conservatively treat a pre-release
as older than its minor; early alpha releases can lack that minor's
fields. A running tenant gets the cleaned ConfigMap the next time Kamaji
uploads it.

JSON removals cannot fully replace this on the current build: Kamaji
decodes patched JSON back into a Go struct, restoring a removed
`crashLoopBackOff` as `{}`. The kubernetes chart also does not render
`kubelet.configurationJSONPatches`.

Upstream fixed JSON patch removal in 26.10.4-edge (clastix/kamaji#1347).
With that bump, the chart can render version-dependent removals and
replace this compatibility patch. This PR keeps the fix for 26.9.4-edge.

The regression tests cover field presence for tenants v1.31 to v1.37,
selected pre-releases, user patches, invalid versions, defaults and
`UploadKubeletConfig` with a fake client. The image build runs the tests
of packages touched by its patches.

Tested on Linux:

- Against upstream Kamaji commit
`1c3d84ae94473e94945ad01b2540ec319478bce4`, the new tests fail with the
current main patch in the three compatibility tests. With this patch,
the Go tests in every package touched by the patches pass, and the
Kamaji build succeeds.
- The repository unit lane passes.

I did not run a strict-decoding matrix against each Kubernetes minor for
this version.

### 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(kamaji): stop writing kubelet config fields that older tenant Kubernetes versions do not know, such as memoryReservationPolicy on tenants before v1.36, so strict decoders of the kubelet-config ConfigMap no longer fail.
```

Backported-from: 9813d13dcd
2026-11-25 09:58:12 +00:00
Andrey Kolkov bdac8ef210 fix(opensearch): disable the Base64 intrinsics hit by CVE-2026-114938
CVE-2026-114938 is an out-of-bounds write in the AVX-512 VBMI Base64
decoder of OpenJDK 17.0.6 and later, reachable on x86-64 hosts with
attacker-supplied Base64. OpenSearch decodes the Basic credentials of a
request before it authenticates it, so a tenant's cluster is exposed to
anyone who can reach its HTTP port.

Two of the three versions this chart offers bundle an affected JDK:
opensearchproject/opensearch:3.0.0 carries 21.0.7 and 2.11.1 carries
17.0.8. 1.3.20 carries 11.0.25, which is not affected. OpenSearch has
not released a build on a patched JDK yet.

Start the nodes with -XX:-UseBASE64Intrinsics, which removes the
vulnerable code path and leaves the other AVX-512 optimizations in
place. It is delivered as a jvm.options.d file mounted from a
ConfigMap, because neither obvious route works: bin/opensearch-env
unsets JAVA_TOOL_OPTIONS, and setting nodePools[].jvm makes the
operator stop sizing the heap from the memory request. The operator
mounts general.additionalVolumes into the node pools and the bootstrap
pod alike.

Rolling this out restarts every OpenSearch cluster once.

Tested with helm unittest, and by starting 3.0.0, 2.11.1 and 1.3.20
with the file mounted: each server JVM runs with the flag, and the heap
passed in OPENSEARCH_JAVA_OPTS still applies.

Assisted-by: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
(cherry picked from commit 65f0943710)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:12 +00:00
Timofei Larkin 84e68279f1 docs(lineage-webhook): cut the rationale from the verdict comment
Comments carry the mechanism, not the reason the change was made; the
reason is in the design doc and the PR.

Assisted-by: LLM
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
(cherry picked from commit d687e73fd4)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:12 +00:00
Myasnikov Daniil cd06f92845 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.
```

Backported-from: c49f58c4a4
2026-11-25 09:58:12 +00:00
Aleksei Sviridkin cf7f622089 fix(kamaji): drop kubelet config fields older tenants do not know
Kamaji is built on the Kubernetes 1.37 libraries and renders the
tenant's kube-system/kubelet-config from 1.37 defaults. That output
carries fields the kubelet config API of an older tenant does not
have: memoryReservationPolicy (added in 1.36),
mergeDefaultEvictionSettings (1.33) and crashLoopBackOff (1.32).
Strict decoding on such a tenant fails, for example kubeadm join on
v1.35 logs:

  strict decoding error: unknown field "memoryReservationPolicy"

kubeadm logs this as a warning and decodes leniently, dropping the
field, so the join succeeds, but any strict consumer of the ConfigMap
breaks.

Drop each field from the rendered object when the tenant version
predates it. The removal works on the encoded object because
crashLoopBackOff is a non-pointer struct: zeroing it still renders
"crashLoopBackOff: {}". A pre-release counts as older than its minor,
since the early alphas of a minor do not have its fields yet.

The patch ships a test for the rendered fields per tenant version,
run by the image build.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
(cherry picked from commit 932d1ac136)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:12 +00:00
Timofei Larkin 07a0819604 fix(lineage-webhook): keep an explicit tenantresource false
The webhook computes the tenantresource verdict from the ApplicationDefinition selectors on first admission and copies it over whatever label the chart rendered, so a chart cannot take a Secret the definition still selects off the tenantsecrets projection. The credentials conversion in design-proposals/user-secrets-api needs exactly that during its migration window: the converted chart renders the platform-only credentials Secret with tenantresource false while the old definition still selects the name.

A rendered false is now kept; a rendered true is still replaced by the computed verdict, so the object can only narrow what the definition grants, never widen it.

Assisted-by: LLM
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
(cherry picked from commit 7b214464ee)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:12 +00:00
Aleksei Sviridkin 9366997a4b fix(seaweedfs): declare the vendored chart dependency
Helm lint rejects the wrapper chart while its bundled seaweedfs chart is
undeclared. Reference the local chart without constraining its version
so vendoring remains the source of the dependency.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
(cherry picked from commit 65708a81b8)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:12 +00:00
Myasnikov Daniil e9b39e52dc fix(cozy-lib): render tenant hugepages quota only as requests (#5189)
## What this PR does

A tenant with `hugepages-2Mi` or `hugepages-1Gi` in `resourceQuotas`
gets both `requests.hugepages-<size>` and `limits.hugepages-<size>` in
`tenant-quota`. Kubernetes accepts huge pages in a ResourceQuota only as
`hugepages-<size>` or `requests.hugepages-<size>`
([`IsStandardQuotaResourceName`](https://github.com/kubernetes/kubernetes/blob/v1.34.1/pkg/apis/core/helper/helpers.go#L245)),
so the apiserver rejects `tenant-quota` and the tenant release fails to
install or upgrade. Huge pages are not counted in `limits.memory`
either, so today a VM whose memory is backed by huge pages runs outside
the tenant quota with no way to bound it.

`cozy-lib.resources.flattenResource` now drops the limits side for
`hugepages-*`, the same way it already does for `storage`, so the quota
carries only `requests.hugepages-<size>`. Both page sizes go through the
same rule. `sanitize` is unchanged: a pod spec still needs equal
requests and limits for huge pages.

`helm unittest .` passes 69 of 69 in `packages/tests/cozy-lib-tests` and
78 of 78 in `packages/apps/tenant`. The new case fails on `main` on both
`limits.hugepages-*` keys. Admission reads hugepages usage from
`requests.*` after #5184, which matches what this renders.

### Screenshots

Not a UI change.

### Downstream repositories

Template change in `cozy-lib`, one new test case and one line in the
hand-written part of `packages/apps/tenant/README.md`. No values key,
schema or default changes. The website tenant reference page is
regenerated from that README on release, so no trigger map entry needs a
manual follow-up.

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


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

## Summary by CodeRabbit

* **Bug Fixes**
* Huge-page quotas now apply only to requests, avoiding unsupported
limit entries in Kubernetes resource quotas. Quota entries for 2 MiB and
1 GiB huge pages are retained as requests, while corresponding limit
entries are omitted.
* **Documentation**
* Clarified that 2 MiB and 1 GiB huge-page resources are represented as
requests in resource quotas, not limits, because Kubernetes does not
support huge-page limits quotas.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Backported-from: 060686cbc0
2026-11-25 09:58:11 +00:00
Aleksei Sviridkin c9a20d45d4 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>
(cherry picked from commit 78e21fefcc)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:11 +00:00
Myasnikov Daniil cd3c08be6a fix(etcd): scope tenant alerts to their scrape job (#5183)
## What this PR does

scopes every tenant etcd alert to its release scrape job. previously
each release evaluated every tenant, so one failing peer could produce
alerts from unrelated releases. tenant peer RTT is evaluated by the
tenant rules, while the remaining global etcd checks stay in place.

validation: both affected chart test runs pass, 46 tests in 17 suites.
both charts render. an expression-only simulated leader-loss check
against existing metrics selected 18 members across six namespaces
before scoping and only the three intended members afterwards.
thresholds are unchanged.

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

no API fields, metric names, package interfaces or documented
workarounds change.

### Release note

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


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

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

## Summary by CodeRabbit

* **Bug Fixes**
* Etcd alerts now match metrics from the exact etcd scrape job,
including slow HTTP requests, reducing the chance of unrelated metrics
triggering alerts.
* The peer communication latency alert excludes tenant etcd scrape jobs,
which are covered by tenant-specific rules.
* **Tests**
* Added checks to validate etcd alert job matching and tenant-job
exclusions.

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

Backported-from: 416abfd8e2
2026-11-25 09:58:11 +00:00
Yan Bondarenko f9b34ab681 fix(cozy-lib): render tenant hugepages quota only as requests
A tenant with hugepages-2Mi or hugepages-1Gi in resourceQuotas got both
requests.hugepages-<size> and limits.hugepages-<size> in tenant-quota.
A ResourceQuota accepts huge pages only as hugepages-<size> or
requests.hugepages-<size>, so the apiserver rejects tenant-quota and the
tenant release fails to install or upgrade. Huge pages are not counted
in limits.memory either, so without this key a VM whose memory is
backed by huge pages runs outside the tenant quota.

The limits side is dropped for hugepages-* the same way it already is
for storage. sanitize still emits equal requests and limits, which is
what a pod spec needs for huge pages, so only the quota rendering
changes.

Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
Assisted-by: LLM
(cherry picked from commit 38a32445f7)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:11 +00:00
Myasnikov Daniil 8ff59084aa feat(monitoring): alert when pods of one workload share a node (#4993)
## What this PR does

On three 3-node clusters running v1.6.4 and v1.6.5 we found a tenant
etcd with two of its three members on one node, a tenant Redis with two
of its three Sentinels on the node that also ran the master, and several
VictoriaMetrics and VictoriaLogs pairs (vmstorage, vmselect,
vmalertmanager, vlstorage) sharing a node. Nothing alerted. Losing one
of those nodes would have cost the etcd or Sentinel quorum, or both
copies of a storage tier. Spread constraints keep new pods apart once
they are in place (#4986 for etcd, #4989 for monitoring, #4990 for
Redis), but a placement that already exists, or that comes from a soft
rule or a drain, stays as it is, because the scheduler does not move
running pods.

This adds `PodReplicasColocated`, a warning in a new
`workload-placement` group under
`packages/system/monitoring-agents/alerts/`. It fires when two or more
running pods of one StatefulSet, ReplicaSet, CNPG `Cluster` or
`StrimziPodSet` have been on one node for an hour while the cluster has
at least as many schedulable nodes as the workload has running pods, so
five replicas on three nodes stay quiet. The alert carries `cluster`,
`namespace`, `owner_kind`, `owner_name` and `node`, plus the `severity`,
`exported_instance` and `service` labels the other platform alerts set,
and its value is the number of pods on that node. DaemonSets, Jobs and
every other owner kind are not in the list, so a DaemonSet surge pod
next to its predecessor does not count.

etcd-operator gives every member pod its own `EtcdMember` as controller
owner
([etcdmember_controller.go#L546](https://github.com/cozystack/etcd-operator/blob/v0.5.6/controllers/etcdmember_controller.go#L546)),
so grouping by owner would see one pod per group. Members get their
names from `GenerateName: <cluster>-`
([etcdcluster_controller.go#L434](https://github.com/cozystack/etcd-operator/blob/v0.5.6/controllers/etcdcluster_controller.go#L434),
[#L839](https://github.com/cozystack/etcd-operator/blob/v0.5.6/controllers/etcdcluster_controller.go#L839)),
and members adopted from the old StatefulSet keep names like `etcd-0`
([adopt.go#L103](https://github.com/cozystack/etcd-operator/blob/v0.5.6/internal/migrate/adopt.go#L103)).
The rule drops the last dash-separated part of the member name and
reports the group as `EtcdCluster <name>`. With the etcd package that is
one group per tenant namespace, and two etcd clusters in one namespace
would still be told apart. CNPG instance pods carry a controller
reference to their `Cluster`
([cluster_create.go#L1580](https://github.com/cloudnative-pg/cloudnative-pg/blob/v1.30.0/internal/controller/cluster_create.go#L1580)),
and Strimzi pods one to their `StrimziPodSet`
([StrimziPodSetController.java#L369](https://github.com/strimzi/strimzi-kafka-operator/blob/0.45.1-rc1/cluster-operator/src/main/java/io/strimzi/operator/cluster/operator/assembly/StrimziPodSetController.java#L369)).

Owner and node both come from `kube_pod_info`. kube-state-metrics fills
`created_by_kind` and `created_by_name` from the controller owner
reference and `node` from `spec.nodeName`
([pod.go#L638-L653](https://github.com/kubernetes/kube-state-metrics/blob/v2.15.0/internal/store/pod.go#L638-L653)).
`kube_pod_owner` and `kube_pod_status_phase` have no node label of their
own, and the kube-state-metrics scrape adds `node` from
`__meta_kubernetes_pod_node_name` with `honorLabels: true`
(`templates/kube-state-metrics-scrape.yaml`), so on those series `node`
is the node of the kube-state-metrics pod. The test data keeps that
label on the phase series. A pod counts while
`kube_pod_status_phase{phase="Running"}` is 1, so a Failed or Pending
pod on the same node does not. `kube_pod_labels` does carry every pod
label here (`--metric-labels-allowlist=pods=[*]`), but the rule does not
depend on it.

A node counts as schedulable unless it has a `NoSchedule` or `NoExecute`
taint. A cordon shows up as the
`node.kubernetes.io/unschedulable:NoSchedule` taint
([node_lifecycle_controller.go#L549-L555](https://github.com/kubernetes/kubernetes/blob/v1.33.12/pkg/controller/nodelifecycle/node_lifecycle_controller.go#L549-L555)),
and not ready and unreachable nodes get theirs from their conditions
([#L87-L99](https://github.com/kubernetes/kubernetes/blob/v1.33.12/pkg/controller/nodelifecycle/node_lifecycle_controller.go#L87-L99)),
so one clause covers all three, and a tainted control plane does not
count either. Pods that a drain had to put together on the remaining
nodes therefore stay quiet while the node is out, and the hour starts
once it is back.

The alert waits an hour. A replacement pod runs next to its terminating
predecessor only for the predecessor's grace period, and node
maintenance takes the drained node out of the count, while a placement
that has held for an hour does not fix itself. The alert is about a risk
rather than an outage, so the wait costs nothing. The VMAlert sets both
`remoteWrite` and `remoteRead`, so the pending state survives a vmalert
restart ([vmalert
docs](https://docs.victoriametrics.com/victoriametrics/vmalert/#alerts-state-on-restarts)).

Not covered are workloads that run one pod per owner, such as ClickHouse
with one StatefulSet per replica
([patterns.go#L45-L53](https://github.com/Altinity/clickhouse-operator/blob/release-0.25.2/pkg/model/chi/namer/patterns.go#L45-L53))
and the KubeVirt VMs behind a tenant Kubernetes node group. They would
need grouping by pod labels, which this rule avoids. The node count is
cluster-wide, so a workload that a node selector or affinity restricts
to fewer nodes than it has pods fires too.

`hack/workload-placement-alerts.bats` takes `.spec` of the VMRule and
replays it through `vmalert-tool` v1.136.0 pinned by digest, the release
vm-operator v0.68.4 deploys by default
([config.go#L38](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/config/config.go#L38))
and the same image #4963 and #4985 use.
`hack/testdata/workload-placement-alerts/unittest.yaml` has 13 cases
with 24 checks. Two of three StatefulSet pods on one node fire at 61
minutes and not at 59, with labels and annotations pinned. Spread pods,
five ReplicaSet pods on three nodes, a DaemonSet surge pod, two pods of
one Job, a Failed pod next to a running one, and one pod each in two
clusters that share workload and node names stay quiet. etcd members
fire as one `EtcdCluster` per namespace, for generated and adopted
member names. A replacement pod next to its terminating predecessor for
twenty minutes stays quiet, and the same overlap held past the hour
fires and resolves when it ends. A cordoned node keeps the alert quiet
until it is uncordoned, and a node with unreachable taints keeps it
quiet throughout. ReplicaSet, CNPG `Cluster` and `StrimziPodSet` pods
fire with their owner kind.

```console
$ bats hack/workload-placement-alerts.bats
1..1
ok 1 workload placement alerts pass their vmalert-tool cases
```

With the expression replaced by one that never fires, the suite prints
`not ok 1` and vmalert-tool reports 5 of the 24 checks, which are all
the checks that expect an alert. On main, where the rule file does not
exist, the suite fails as well. Each of these changes to the rule fails
at least one check, with the number of failing checks in brackets. `for:
15m` (5), no phase filter (1), no node count (6), no `cluster` label
(6), DaemonSet and Job in the kind list (3), no taint clause (4), `<`
instead of `<=` (5), etcd members grouped per member (1).

With Bats 1.14.0 at the commit CI pins, the suite passes together with
`alert-severity-contract`, `bats-strict-setup`,
`bats-no-negated-assert`, `bats-no-exit-trap`, `bats-runner-coverage`,
`bats-runner-contract`, `image-pin-consistency` and
`check-commit-trailers`, 109 of 109, and the severity contract lists the
new alert as `warning`. helm-unittest 1.1.2, the version CI pins, passes
the monitoring-agents chart with 19 of 19 tests in 6 suites, and `helm
template` with Helm 3.17.3 renders the VMRule the same as the file. Like
the migration suites the new suite needs docker, and only the image pull
touches the network. I have not run the rule in vmalert on a live
cluster.

On release-1.6 kube-state-metrics 2.15.0, its scrape config, the alerts
template, the VMAlert and vm-operator v0.68.4 are the same, and
etcd-operator v0.5.5 and CNPG 1.28.2 set the same owners and member
names. The new files apply there without changes. That backport is a
separate PR with one more commit that drops the `load test_helper` line,
because release-1.6 runs `hack/*.bats` through `hack/cozytest.sh`.

### Screenshots

Not a UI change.

### Downstream repositories

A new alert file under `packages/system/monitoring-agents/alerts/`, a
Bats suite under `hack/` and its test data. No values, schema, README,
image or `ApplicationDefinition` change, and the website does not list
platform alerts by name, so no trigger map entry applies.

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

### Release note

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


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

## Summary by CodeRabbit

* **New Features**
* Added monitoring for workloads whose running pod replicas are
colocated on the same node.
* Alerts include workload, node, cluster, and severity details, along
with quorum-loss guidance.
* Coverage includes StatefulSets, ReplicaSets, Clusters, StrimziPodSets,
and EtcdMembers.

* **Tests**
* Added validation for workload-placement alerts across scheduling,
availability, cluster-isolation, and pod-replacement scenarios.

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

Backported-from: 4fa6bfe30b
2026-11-25 09:58:11 +00:00
Yan Bondarenko 7d3dad2717 fix(etcd): scope tenant alerts to their scrape job
Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
(cherry picked from commit 81fd5fa872)
Signed-off-by: cozystack-ci[bot] <274107086+cozystack-ci[bot]@users.noreply.github.com>
2026-11-25 09:58:11 +00:00
Myasnikov Daniil e22103a5a7 test(harbor): pin the resources of the nginx proxy and the portal (#5025)
## What this PR does

#4095 gave the Harbor nginx proxy the `t1.small` preset and moved the
portal from `t1.nano` to `t1.micro`, so neither falls back to the
LimitRange default of a tenant namespace, 250m CPU and 128Mi. It came
without a test. This adds a helm-unittest suite that pins both presets
in the nested HelmRelease and checks that they stay the same when the
other components are resized, so dropping them or tying them to another
component's values fails the suite.

Both containers run nginx with `worker_processes auto`, which starts one
worker per CPU of the node whatever the container's CPU limit is. With
the proxy config the chart renders and `goharbor/nginx-photon:v2.15.1`,
96 workers idle at about 205 MiB, so on a node with many CPUs the proxy
is OOMKilled at 128Mi before it serves a request. That is what happened
on a v1.6.5 cluster, where both nginx pods of a default Harbor restarted
5 and 6 times within minutes, because `release-1.6` never got #4095. The
backport, with this suite and the measurements, is a separate PR.

`helm unittest .` in `packages/apps/harbor` passes 47 of 47 with
helm-unittest 1.1.2. With the #4095 hunk reverted the three new cases
fail and the 44 existing ones pass. Each of seven template mutations
fails at least one new case. They drop the nginx block, give nginx
`t1.micro` or the portal `t1.nano`, tie nginx to the core values or the
portal to the jobservice values, misspell the `resources` key under
nginx, and make core ignore its preset, which the resize case checks so
that it cannot pass on overrides that never reach the release.

### Screenshots

Not a UI change.

### Downstream repositories

One new helm-unittest suite in `packages/apps/harbor/tests`. No
template, values key, schema, default, README or package change, so no
trigger map entry applies.

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

### Release note

```release-note
NONE
```

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

## Summary by CodeRabbit

* **Tests**
* Added Helm coverage verifying default resource settings for Harbor’s
nginx and portal components.
* Added coverage confirming nginx and portal memory allocations remain
consistent when related service resources are customized.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Backported-from: 614847976f
2026-11-25 09:58:11 +00:00