mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-01 04:35:40 +09:00
cdec07d0bd853d64b2c4b812e3eb4f46ca8b5dba
3152
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
37486083b9 |
feat(vm-instance): choose a cozyplane route table
cozyplane routes a pod by the RouteTable its sdn.cozystack.io/route-table annotation names, and the VPC's default table when it names none. A VM had no way to pass one, so a route such as 0/0 to the internet could only be reached by annotating the VM by hand. routeTable renders the annotation next to the VPC one, and fails the render where no VPC or no cozyplane would read it. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
a24bdb758b |
feat(vm-instance): join a cozyplane VPC by pod annotation
On the cozyplane networking variant there is no multus, so a VM that listed a network rendered a multus attachment that can never resolve and sat Pending forever. When the cluster serves sdn.cozystack.io — detected by API discovery, the same way the Kube-OVN IP pinning is — the chart now stamps sdn.cozystack.io/vpc: virtualprivatecloud-<networks[0].name> on the virt-launcher pod (the bare name resolves in the VM's own namespace) and renders no multus networks and no secondary interfaces: the VM keeps its single pod interface and the CNI gives it its VPC identity. A cozyplane pod joins exactly one VPC, so more than one network entry fails the render by name rather than attaching silently to the first. The Cilium-variant multus path is unchanged, and the suite pins both branches. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
e4ac5dbb9c |
feat(vpc): cozyplane variant of the VPC application
The kubevirt flavor of virtualprivatecloud is kube-ovn/multus-backed, so the cozyplane networking variant skipped it and the VirtualPrivateCloud catalog kind was simply absent there. This adds an alternative flavor serving the same kind from sdn.cozystack.io: the chart creates a namespaced VPC, the owner-namespace VPCBinding (attachment is default-deny even for the owner), one VPCPeering half per declared peer, and an optional VPCGateway as the north-south boundary. Delivery follows the networking variant: the PackageSource gains a cozyplane variant whose ordering edge is the aggregated sdn apiserver instead of multus, the iaas bundle selects the flavor by networkingVariant, and virtualprivatecloud-rd installs the matching ApplicationDefinition. Each flavor's definition must point at its own variant's ExternalArtifact, which is why hack/update-crd.sh now honors VARIANT from the environment instead of always reading variants[0]. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
907d369813 |
feat(postgres): add an audit toggle for access and statement logging (#5404)
## What this PR does Managed Postgres can already load pgaudit through the `sharedPreloadLibraries` allowlist and set `pgaudit.log`/`log_connections` through `postgresql.parameters`, but that leaves an orchestrator such as a customer-facing panel depending on internal parameter names to answer "who connected and what did they run". This adds an `audit` block that bundles access and statement auditing behind a single switch. With `audit.enabled`, the chart adds `pgaudit` to `shared_preload_libraries` and seeds `pgaudit.log` (set by `audit.log`, default `write, ddl, role`), `log_connections` and `log_disconnections`. The audit parameters are seeded as defaults, so an explicit `pgaudit.log` or `log_connections` in `postgresql.parameters` still takes precedence. The audit records go to the instance log, which the platform log stack already collects, so they are queryable per database by its labels without extra wiring. `audit` is off by default, and toggling it restarts PostgreSQL because pgaudit is a preloaded library. Postgres only; MariaDB, MongoDB and ClickHouse auditing are left for follow-ups. ### Screenshots Not applicable — no UI change. ### Downstream repositories Walked the trigger map against the diff. One repository is reached: `cozystack/terraform-provider-cozystack` hand-models each postgres `values.schema.json` field, and this diff adds the `audit` block to that schema, so the provider would need the field added to its postgres schema and its expand/flatten pair. That is separate work there, tracked in cozystack/terraform-provider-cozystack#87. The website postgres reference page regenerates from the package `README.md` on release, so it needs no manual follow-up, and `ansible-cozystack` carries no postgres values key. - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [x] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: cozystack/terraform-provider-cozystack#87 - [ ] [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(postgres): managed PostgreSQL gains an `audit` toggle that enables pgaudit statement auditing and connection logging, with the audited classes set by `audit.log` (default `write, ddl, role`). ``` |
||
|
|
ba0ff0f8e8 |
fix(kafka)!: require SCRAM-SHA-512 on the external listener (#5156)
<!-- 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
With `external: true` the chart renders a Strimzi listener `external` on
port 9094, `type: loadbalancer`, with TLS on by default but **no
`authentication` block**. Anyone who can reach the public LoadBalancer
address can produce and consume on every topic; TLS only encrypts the
session. The entity operator's User Operator is already deployed, but
nothing declares a KafkaUser.
This PR:
- adds `authentication: {type: scram-sha-512}` to the `external`
listener. The internal listeners (9092 plain, 9093 TLS) are unchanged;
- adds a `users` map. Each key renders a `KafkaUser`
(`kafka.strimzi.io/v1`, `strimzi.io/cluster: <release>`,
`authentication.type: scram-sha-512`) named `<release>.<user>`; the dot
keeps it from spelling any Secret Strimzi derives from a cluster name,
this release's or another's. That name is also the SCRAM username and
the name of the Secret into which the User Operator writes the generated
password (`password`, `sasl.jaas.config`). The release prefix keeps two
Kafka instances in one tenant namespace from colliding;
- refuses user names that are not valid object names;
- lets the tenant read each user's Secret via the existing
`<release>-dashboard-resources` Role, and shows it in the tenant-secret
API: the Kafka ApplicationDefinition selects Secrets labelled
`strimzi.io/kind: KafkaUser`. The instance scope comes from the Secret's
ownership; a templated label value would never match, since only
`resourceNames` are rendered
(`internal/lineagecontrollerwebhook/kafka_rd_secrets_test.go` runs the
Strimzi Secrets through the matcher);
- rewrites the `tls.enabled` description, which said Strimzi provides no
authentication on this listener. Without TLS the data and the SCRAM
exchange are exposed, not the password itself;
- documents the client settings (SASL, truststore from
`<release>-cluster-ca-cert`) and two upgrade sequences in the README.
Passwords are always generated by Strimzi. I did not add a `password`
field like RabbitMQ's; that can come later.
**Known limit:** no ACLs. The cluster has no `authorization`, so every
authenticated user can read and write every topic. Per-user ACLs are a
follow-up.
**Breaking:** an instance with external access refuses unauthenticated
clients after the upgrade. The previous chart cannot create the users
from `users`, so the README gives two sequences: a maintenance window
(declare `users`, upgrade, then configure clients), or credentials
staged ahead by a cluster administrator through `KafkaUser` objects
carrying Helm's ownership metadata, which the upgrade adopts with their
passwords unchanged. Neither has been run on a live cluster.
**Tests**
- New `tests/external_authentication_test.yaml` (11 cases).
- The listener assertions in `kafka_test.yaml` and `kafka_tls_test.yaml`
now include the `authentication` block.
- `helm unittest packages/apps/kafka`: 114 passed.
- Not deployed on a live cluster.
**Backport:** none. Refusing existing clients after an upgrade does not
belong in a patch release, so this stays on `main` and lands in the next
minor (`backport/skip`).
### 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:
- [x]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up: cozystack/terraform-provider-cozystack#86 (issue: model the
`users` map on the Kafka resource and data source)
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:
### Release note
<!-- Write a release note:
- Explain what has changed internally and for users.
- Start with the same `type(scope):` prefix as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->
```release-note
fix(kafka)!: the external listener (port 9094, enabled by external: true) now requires SCRAM-SHA-512 authentication instead of accepting anonymous clients. Declare clients in the new users map; each gets a KafkaUser named <release>.<user> whose generated password is in the Secret of the same name. External clients of an instance with external access are refused after the upgrade until they authenticate; see "Upgrading an instance that has external access" in the Kafka README for a maintenance-window sequence and one that stages the credentials ahead.
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **New Features**
* Configure SCRAM-SHA-512 users for external Kafka access. Each user
receives generated credentials and read/write access to all topics;
credential Secrets are available to tenant resources.
* Invalid, reserved, or overlong user names are rejected.
* **Documentation**
* Clarified that external access requires SCRAM-SHA-512 authentication,
even when TLS is disabled. Without TLS, data is unencrypted and the
authentication exchange is exposed, but the password is not.
* Added external-client connection guidance, certificate trust
information, and upgrade instructions for configuring credentials.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
||
|
|
d65fe65f0f |
fix(kubernetes): refuse Proxmox template tags naming another Talos
On Proxmox the template the tags select is the worker's boot disk, and talos.version reaches only the installer in the machineconfig. The bump of the default changes that machineconfig and rolls every pool, so a pool still tagged for the previous release would clone the old template and keep the vulnerable kernel while its config names the fixed one. The template script tags each template talos-<version>, which is the one link the chart can check; a tag set naming no release is left to the operator. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
470e4c55a7 |
fix(kubernetes): bump tenant worker Talos to v1.13.12 (CVE-2026-99999)
Tenant worker VMs default to Talos v1.13.6, whose kernel predates the
upstream fix for CVE-2026-99999 (PwnEscape), Linux commit 6785011f8b16
("ipv4: validate checksum_start before completing checksum"). The bug
lets a guest escape into its host, and a tenant worker is a host
whenever the tenant runs nested virtualization inside it. The fix was
backported in Linux 6.18.57, which Talos v1.13.12 ships.
The workers stay on the v1.13 line rather than following the host
nodes to v1.14: Talos v1.14 drops Kubernetes 1.31 and 1.32, which the
tenant chart still offers, so a v1.14 default would fail the
support-matrix guard and break the render of those clusters. The v1.13
matrix entry is unchanged.
The new release changes the worker machine config and the golden image
name, so the content-hashed TalosConfigTemplate names and the default
golden DataVolume name pinned in the chart tests move with it.
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
Assisted-by: LLM
|
||
|
|
7b9b4347b2 |
fix(ingress-nginx): turn off TLS session tickets for CVE-2026-97629 (#5407)
## What this PR does Turns off TLS session tickets in the ingress-nginx controller (`ssl-session-tickets: "false"`). [CVE-2026-97629](https://nginx.org/en/security_advisories.html): with session tickets on and no fixed ticket key, nginx rotates its ticket keys and, before 1.30.6 and 1.31.7, leaves one of them uninitialized in the worker processes, which may allow a session to be forged. The platform sets tickets on and no `ssl-session-ticket-key`, so it runs exactly that path, and the controller nginx 1.25.5 does not carry the fix ([`fdedba03`](https://github.com/nginx/nginx/commit/fdedba031b)) yet. It will come with the next rebuild of the controller image; this change closes the hole without waiting for it. What it costs is small. TLS session resumption keeps working through `ssl_session_cache`, which the controller has on. And with no fixed ticket key every pod had its own keys, so a ticket never resumed a session on another replica anyway. `make test` in the chart passes. ### Screenshots N/A, no UI changes. ### Downstream repositories Walked the trigger map against the diff: one controller ConfigMap value in `packages/system/ingress-nginx/values.yaml`. No package, platform 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): TLS session tickets are turned off in the ingress-nginx controller (CVE-2026-97629). TLS session resumption keeps working through the shared session cache. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Security** * SSL session tickets are now disabled for ingress connections. TLS session resumption remains available through the shared session cache, so existing session reuse behavior continues without session tickets. This changes how session resumption is handled while preserving the cache-based option. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
3002f3183b |
fix(ingress-nginx): turn off TLS session tickets for CVE-2026-97629
With tickets on and no fixed ticket key, nginx rotates the keys and, before 1.30.6 and 1.31.7, leaves one of them uninitialized in the worker processes, which may let a session be forged. The controller's nginx 1.25.5 does not have the fix yet. Resumption still works through the shared session cache, and with no fixed key tickets never resumed across replicas anyway. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com> |
||
|
|
442768abb7 |
feat(kubernetes): give each tenant Kubernetes cluster its own etcd (#4817)
## What this PR does A tenant Kubernetes cluster could not start until an ancestor `Tenant` had `spec.etcd: true`. The chart read the datastore name from `_namespace.etcd` and, with none, rendered only a `<release>-awaiting-etcd` ConfigMap. Every cluster below that tenant then shared one etcd, one CA and one disk, separated by key prefix only. Whoever creates a cluster usually may not edit the `Tenant`, so anything ordering clusters on a tenant's behalf (the portal's controller, for one) had to flip `etcd: true` first. This PR makes the `Kubernetes` application carry its own etcd. It implements phases 1 and 2 of the per-cluster etcd design proposal, [cozystack/community#25](https://github.com/cozystack/community/pull/25), as three commits that can be split later: 1. `refactor(etcd)`: the etcd chart's `EtcdCluster`, cert-manager PKI, `DataStore`, `WorkloadMonitor`, defrag `CronJob`, VPA and `VMPodScrape` move into named templates in `cozy-lib` (`packages/library/cozy-lib/templates/_etcd.tpl`), parameterised by the cluster name. `packages/extra/etcd` calls them with `"etcd"`, and its rendered output is byte-identical before and after (see Verification). 2. `feat(kubernetes)`: a new cluster renders its own `EtcdCluster` and `DataStore` from those templates, and a cluster that already runs on a shared tenant etcd keeps it. 3. `feat(platform)`: migration 63 → 64 reports which clusters stay on a shared etcd and changes nothing. Phases 3 and 4 (deprecating, then removing `Tenant.spec.etcd`, `_namespace.etcd` and `cozy-lib.ns-etcd`) are left for later. ### Design **Names.** For release `kubernetes-<name>` in namespace `<ns>`: | Object | Name | |---|---| | `EtcdCluster`, its headless Service, members `<…>-xxxxx`, `<…>-client` Service | `kubernetes-<name>-etcd` | | Secrets | `kubernetes-<name>-etcd-{ca,client,server,peer,peer-ca}-tls` | | `DataStore` (cluster-scoped) | `<ns>.kubernetes-<name>` | | DataStore endpoint | `kubernetes-<name>-etcd.<ns>.svc:2379` | **Shared templates.** `cozy-lib.etcd.cluster` takes optional `labels` and `annotations` and renders them into the `EtcdCluster`'s `spec.additionalMetadata`, which etcd-operator copies onto every member Pod and PVC. With neither set, it renders no `additionalMetadata` at all. **Values.** One new field, `etcd.replicas`: `3` (default) or `1`. The schema bounds it to 1..3 and the chart refuses 2 at render time. Size (4Gi), resources (1000m / 512Mi limits to start with) and the etcd version (3.6.11, the etcd chart's default) are chart-internal. Where a VerticalPodAutoscaler runs, it sizes each member's requests as it is recreated, up to 5000m CPU / 8Gi memory divided by the platform's CPU and memory allocation ratios (500m / 8Gi at the default ratios of 10 and 1), with the limits scaled in proportion; NOTES.txt and the README say so. **StorageClass.** Two new platform values, `kubernetesEtcd.storageClassLocal` and `kubernetesEtcd.storageClassReplicated`, reach the chart as `_cluster.etcd-storage-class-local` (used with 3 members) and `_cluster.etcd-storage-class-replicated` (used with 1 member). Empty keys fall back to the namespace default StorageClass. `spec.storage.storageClassName` is immutable on an `EtcdCluster`, so the chart reads the live object's class on every render after the first and never re-derives it; scaling 1 → 3 keeps the class the cluster started with. Dropping from 3 members to 1 is refused at render time when the etcd is on the class the platform names for 3 members, or off the class it names for 1, because a single member would then hold the only copy of the control-plane state on storage that does not replicate it. An etcd that was created with one member keeps rendering whatever its class. **New clusters vs existing ones.** The chart decides from the live `KamajiControlPlane`, looked up by release name: - no `KamajiControlPlane`, or one whose `spec.dataStoreName` is the cluster's own name: own etcd; - one that names any other `DataStore`: that `DataStore` is kept, and the chart renders no etcd of its own. Clusters stuck in the old awaiting-etcd state have no `KamajiControlPlane`, so they get their own etcd on their next reconcile. `_namespace.etcd` is deliberately not the signal. `packages/system/cozystack-basics/templates/cozystack-values-secret.yaml` hardcodes `etcd: tenant-root`, and `packages/apps/tenant/templates/namespace.yaml` passes it down, so every tenant publishes a value whether or not an etcd runs behind it. Honouring it for new clusters would change nothing for anyone. Following it for existing clusters is also wrong: today, switching on `spec.etcd` for a mid-level tenant silently moves every cluster below it to a new datastore, which is a Kamaji datastore migration. With this PR, the live binding sticks. An existing cluster renders exactly what it rendered before, pre-delete hook included, apart from randomly generated Talos tokens, so the upgrade rolls no control-plane pods. New clusters carry `policy.cozystack.io/allow-to-etcd-cluster` instead of `policy.cozystack.io/allow-to-etcd`, which only admits a cluster to its tenant's shared etcd. Both lookups the decision rests on read the chart's own live objects: the binding its `KamajiControlPlane` already records, and the immutable `storageClassName` of its `EtcdCluster`. Each gives the same output on every render, and their empty branch is the new-cluster render offline `helm template` sees, which is the kind of `lookup` the chart guidelines allow. **What goes away.** The `awaiting-etcd` beacon goes, along with the `_namespace.etcd` gate on the ~25 addon and satellite templates (`helmreleases/*`, `csi/deploy.yaml`, `kccm/manager.yaml`, `cluster-autoscaler/deployment.yaml`, `ingress.yaml`, the Proxmox CCM and CSI). A datastore now always exists, so these gates were always true. **Deletion.** The pre-delete hook deletes the `TenantControlPlane` and waits up to 120s, and it exits 0 whatever is left, because a failing pre-delete hook keeps the release and retries the same teardown; the one exception is below. Kamaji's `finalizer.kamaji.clastix.io` drops the tenant's etcd role, prefix and user and the datastore-config Secret's finalizer, and it runs only while the `DataStore` is Ready and answers, so a `TenantControlPlane` whose own etcd never came up or has lost quorum would never finish deleting. On a cluster that owns its etcd, those three objects live in the etcd this uninstall deletes next. So when such a `TenantControlPlane` outlives the wait, the hook (Step 4a) removes that one finalizer with a JSON patch that tests it at the index it was read at, waits another 60s, and lets Step 4b clear the Secret's finalizer as before. A `TenantControlPlane` on a shared `DataStore` is left to Kamaji, since that etcd outlives the cluster. The hook also deletes the etcd's five Certificates and then their Secrets (Step 8), which cert-manager issues without an owner, in the same order and for the same reason as Step 7 deletes the Talos PKI. Then: - Helm removes the `EtcdCluster`, `DataStore` and the remaining objects; - the member PVCs go by garbage collection, because the operator owns them through the `EtcdMember`s. If Step 4a's patch is rejected, or the `TenantControlPlane` cannot be read, the hook prints its residue summary and fails before Step 8: Helm would otherwise delete the etcd while Kamaji's finalizer still waits on it, so the uninstall is retried with the etcd and its PKI in place. Steps 4a and 8, that check and their RBAC (a `patch` on this release's `TenantControlPlane`, and `delete` on the etcd Certificates and Secrets by name) render only for a cluster that owns its etcd. ### Deviations from cozystack/community#25 - **DataStore name** is `<namespace>.<release>`, not `<namespace>-<release>`. Tenant names are alphanumeric and nest with dashes, so the dashed form collides: Kubernetes `foo` in `tenant-a` gives `tenant-a-kubernetes-foo`, which is also the namespace, and therefore the shared `DataStore` name, of tenant `foo` under tenant `kubernetes` under `tenant-a`. A namespace cannot contain a dot. Kamaji copies the `DataStore` name into the pod label `component.kamaji.clastix.io/datastore`, so the name is capped at 63 characters, truncated with an 8-character hash past that. - **No truncate-and-hash for `kubernetes.etcdName`.** The app name is now capped at 32 characters (`@maxLength 32`, added with the nodes split), so `kubernetes-<name>-etcd` is at most 48 characters. That is inside the 56 the operator needs: the `<name>-client` Service and the generated member names must fit in 63. The helper fails the render past 56 rather than rename anything. - **"Honour an explicit `_namespace.etcd`"** means keeping a cluster on the `DataStore` its live control plane names, for the reason above. It does not mean following `_namespace.etcd` for new clusters. - **`etcd.replicas` validation** is a schema range of 1..3 plus a render-time refusal of 2, rather than a schema enum. `cozyvalues-gen` v1.7.0, the version CI pins and the latest release, emits string members for an integer enum, which would reject the default `3`. The aggregated API does not validate an application's spec against its schema at all, so neither an enum nor a CEL rule would refuse 2 at admission; Helm's `values.schema.json` check and the render are where it is refused. - **The delete-hook branch** keys on the same live-`KamajiControlPlane` condition as the render, as #25 asks, and additionally checks at run time that the `TenantControlPlane` names this cluster's own `DataStore` before touching Kamaji's finalizer. Helm deletes release resources only after the pre-delete hook, so the etcd outlives Kamaji's normal finalization without any ordering inside the hook. - **TLS** reuses the etcd chart's `secretRef` shape (chart-issued certificates) rather than the operator's `certManager` mode. Kamaji's `DataStore` needs the CA private key to sign each tenant's client certificate, and `secretRef` keeps that key in a Secret the chart controls. The server certificate also carries the operator's `<name>-client` Service names, which the etcd chart's does not. - **Satellites.** The `PrometheusRule` stays in the etcd chart only, so a cluster's own etcd has no alert rules. `VMPodScrape`, VPA and the `CiliumNetworkPolicy` render only where their APIs are served. The etcd chart's `VMPodScrape` now selects `app.kubernetes.io/instance: etcd` instead of `app.kubernetes.io/name: etcd`: etcd-operator stamps the latter on every member it runs, so a tenant etcd would otherwise also scrape the cluster etcds in its namespace and count their members as its own. - **Name budget.** The defrag `CronJob` is `<etcd name>-defrag`, which reaches 55 characters for a 32-character app name while the apiserver caps CronJob names at 52; past 52 the template truncates it and appends an 8-character hash. The etcd chart's `etcd-defrag` is unaffected. - **Defrag image.** The defrag container pulls `ghcr.io/ahrtr/etcd-defrag:v0.13.0` through `cozy-lib.image`, pinned to the multi-architecture index digest, so a configured registry mirror applies; `_etcd.tpl` is tracked by Renovate and listed in `IMAGE_REF_EXTRA_FILES`. This changes the etcd chart's CronJob too, after the extraction commit. Contributed by @yankawai in #5387 and folded in. - **Migration.** The opt-in migration runbook is not implemented here (see below), and no `talosconfig` is issued. The numbered migration only reports, as #25 suggests. ### Gaps #25 did not cover - **Backups.** Covered through the `Kubernetes` backup strategy (#4931), which `cozy-default` routes `apps.cozystack.io/Kubernetes` to. It resolves the datastore from the `TenantControlPlane`, so it dumps the cluster's key prefix from its own etcd or a shared one alike. Its dump Job runs in the application namespace, and the deny policy below would refuse it, so the strategy's pod template now carries `policy.cozystack.io/allow-to-etcd-cluster: {{ .Release.Prefix }}{{ .Release.Name }}-etcd`, which is inert for a cluster on a shared etcd. The strategy's Velero half does not select the etcd's PVCs or TLS Secrets and does not need to: the dump restores into whatever etcd the control plane runs on. - **Per-cluster network policy.** A `CiliumNetworkPolicy` named after the etcd selects its member pods with `ingressDeny` on 2379/2380 against two sets of pods and one entity. The first is pods in the tenant namespace that are neither members nor carry `policy.cozystack.io/allow-to-etcd-cluster: <etcd name>`, a label set on the control-plane pods, the defrag Job and the backup dump Job. The second is pods in any other namespace except `kube-system` and namespaces labelled `cozystack.io/system: "true"`, which is where Kamaji, its migrate Job and etcd-operator run. The entity is `world`, which the tenant's `allow-external-communication` admits to every endpoint, so sources off the cluster, such as Proxmox workers, are denied too. The node's own `host` and `remote-node` traffic is not. Deny rules are needed because the tenant's own policies allow all traffic within a namespace and from ancestor tenants, and allow rules only add. Metrics on 2381 stay open. The pods also carry `cozystack.io/service: kubernetes-etcd` rather than `cozystack.io/service: etcd`, so the tenant-wide `<tenant>-ingress-etcd` policy does not admit child tenants' control planes to them. The policy renders only where Cilium serves `cilium.io/v2/CiliumNetworkPolicy`. - **Platform ordering.** `cozystack.kubernetes-application` now `dependsOn` `cozystack.etcd-operator`. Both come with the isp-full variants, the only ones the iaas bundle allows. The selective-install fixture is unchanged (`hack/select-install.sh --disabled postgres` produces the same set). The same edge makes an etcd-operator change select the `kubernetes-latest`, `kubernetes-previous` and `computeplane` e2e suites besides `etcd`, and `hack/select-e2e_test.bats` now expects that. - **e2e.** - `hack/e2e-install-cozystack.bats` no longer turns on tenant-root's etcd, which only Kubernetes clusters used, and no longer waits for it. A cluster that fell back on a shared etcd would therefore not come up. - `run_kubernetes_test` asserts the control plane names `tenant-test.kubernetes-<name>` and that `kubernetes-<name>-etcd` reaches `Available`. - `kubernetes-latest` runs the shipped defrag CronJob once and asserts the Job completes (from #5387), then probes the etcd client port with `nc -z`: an unlabelled Pod in `tenant-test` and a labelled Pod in `tenant-root` must be refused, and a labelled Pod in `tenant-test` must connect as the control. Each Pod ends `Succeeded` only when its verdict matches, so a probe that cannot run fails the step. - `cozy_cleanup` waits up to 3m until the `EtcdCluster`, `DataStore`, member PVCs and Secrets are gone, each read bounded by that deadline; both Kubernetes suites' teardown op grows from 22m to 25m to cover it. - The Proxmox suite's tenant drops `etcd: true` and the comment calling it mandatory. - The ComputePlane suite's comment no longer cites #4726. - `hack/admin-kubeconfig-invariant.bats` drops its two awaiting-etcd cases, and the now-unused `tests/values-ci-no-etcd.yaml` goes with them. - **Generated artifacts** come from the tooling. `make -C packages/apps/kubernetes generate` produced `values.schema.json`, the README table, `api/apps/v1alpha1/kubernetes/types.go` and `packages/system/kubernetes-rd/cozyrds/kubernetes.yaml`. Root `make generate` regenerated `zz_generated.deepcopy.go`, and `pkg/generated/openapi` did not change. `make generate` in every touched package leaves the tree clean. - **Existing clusters.** Migration 63 → 64 lists every `KamajiControlPlane` whose `DataStore` its own release did not render, judged by Helm's release annotations on the `DataStore`, with that `DataStore`'s endpoints. It writes nothing but the version stamp. Slot check on 2026-11-23: - `main` ships through 62 (#5239) with `targetVersion: 63`; - `release-1.7` ships through 60 (target 61), and `release-1.6` through 53 (target 54); - so this PR takes 63 and sets `targetVersion: 64`. - **README.** `packages/apps/kubernetes/README.md` now describes the cluster's own etcd, the case of a cluster that keeps its tenant's shared one, the VPA sizing and the backup path. The ComputePlane README no longer lists a tenant etcd as a prerequisite. ### Migrating an existing cluster (designed, not implemented) Nothing here moves a cluster, and nothing should until the runbook below has an e2e. It combines #25's runbook with SerjioTT's Talos measurements of 2026-09-03 (about 20s copy, 43s from patch to Ready, reads uninterrupted) and with what Kamaji 26.9.4-edge's code does. 1. **Opt-in.** The opt-in has to make the chart render the cluster's own etcd beside the shared one, without switching `dataStoreName`. The likely shape is a chart-internal value, or an annotation the chart reads, that the operator sets. Wait for `Available=True`. 2. **Snapshot the source etcd.** This is the rollback path. 3. **Pre-flight reachability from the cluster's namespace, not Kamaji's** (SerjioTT finding 1). Kamaji's migrate Job runs in Kamaji's namespace and can reach any etcd, so the copy "succeeds" toward a target the control-plane pods cannot dial; the new apiserver generation then crash-loops and the cluster stays write-frozen. Run `nc -zv <target> 2379` from a pod carrying the control plane's labels in the cluster namespace. For the per-cluster target this holds by construction (same namespace, and the deny policy admits the control plane), but the check stays because rollback goes the other way. 4. **Switch.** Point `KamajiControlPlane.spec.dataStoreName` at `<ns>.<release>`, with the CAPI provider re-projecting it onto the `TenantControlPlane`. `kamaji.clastix.io/migration-timeout` can go on the `KamajiControlPlane`, because the provider copies annotations to the `TenantControlPlane`. Before switching, delete any leftover `migrate-<TCP UID>` Job in Kamaji's namespace: - a leftover with identical arguments is taken as success and switches the datastore without copying; - one with different arguments is deleted and recreated, with the freeze already installed. 5. **Verify writes, not status** (SerjioTT finding 2). Kamaji installs a `kamaji-freeze` ValidatingWebhookConfiguration in the guest, and only its soot controller removes it, only when the `TenantControlPlane` status is exactly `Ready`. A paused `TenantControlPlane`, or one sitting in `WriteLimited`, `Sleeping` or `Upgrading`, keeps the freeze. Node leases are exempt and reads are untouched, so nodes and `kubectl get` look healthy. The success criterion is a canary write through the guest API; if `kamaji-freeze` is still in the guest after the `TenantControlPlane` is `Ready`, delete it. 6. **Restart every worker kubelet, one node at a time** (SerjioTT finding 3). Until it restarts, a kubelet keeps running existing pods but never starts a newly bound one, so the cluster looks healthy and silently stops starting workloads. The per-node check is a new pod starting on that node. - On Talos there is no operator path to the workers' API today: the chart has a per-cluster `talos-ca` Issuer but issues no client credentials from it, so the fallback is `virtctl restart` per VM. - Issuing an operator `talosconfig` from that CA alongside the admin kubeconfig is the follow-up that makes this step cheap. It is not in this PR: it is a separate credential with its own exposure question. - Any pod-based restarter must be deployed before the switch, because a deaf kubelet will not start it. 7. Retain the source prefix and the snapshot for a cool-off period, then reclaim. Kamaji does not clean the old prefix after a migration. Rollback is the same procedure in reverse, against the retained snapshot. ### Test plan Done here, on today's `main`, no cluster involved: - [x] `helm template` of `packages/extra/etcd` before and after the extraction (commit 1) is byte-identical: 14 renders (default; 1 member + local SC + 10Gi; resources with CPU and memory allocation ratios + another version; a global topology spread; a hard affinity with 5 members and 512Mi; leftover `backup.*` values with 0 members; 1 member at 8Gi with a CPU allocation ratio, for the defrag quota flag), each in `tenant-root` and `tenant-abc`, all identical by sha256. After commit 2 the one difference in each is the `VMPodScrape` selector. - [x] `helm template` of `packages/apps/kubernetes` with Cilium served. With `_namespace.etcd` set to `tenant-root`, or empty, both with 3 members: `EtcdCluster/kubernetes-demo-etcd` replicas=3 on the namespace default StorageClass, and `DataStore/tenant-demo.kubernetes-demo` pointing at `kubernetes-demo-etcd.tenant-demo.svc:2379`. The `KamajiControlPlane` names that `DataStore`, and the policy renders. - [x] With the platform StorageClass keys set: 1 member uses `replicated` and 3 members use `local`. 2 members is refused at render time; 5 is refused by the schema. - [x] An existing cluster (live-`KamajiControlPlane` lookup stubbed to return `tenant-root`) renders identically to `main` with `values-ci.yaml`, pre-delete hook included, apart from random Talos tokens. A new cluster's render differs from `main` only by the old shared `dataStoreName`, the shared-etcd pod label and the added etcd objects. - [x] helm-unittest: - `packages/apps/kubernetes`: 392 tests. The 28-case `tests/etcd_test.yaml` covers names, the second cluster in one namespace, the 63-character `DataStore` cap, the 52-character defrag `CronJob` cap at the longest app name, the defrag quota for a 4Gi etcd, StorageClass choice and stickiness, the refused and the allowed drops to one member, refusal of 2, the policy with its `world` deny, and the hook's Step 4a/8 RBAC. For an existing cluster it covers staying on the shared `DataStore`, ignoring a changed `_namespace.etcd`, keeping the shared-etcd label, no own etcd and no Step 4a/8. - `packages/extra/etcd`: 29, including the new scrape-selector case. `packages/core/platform`: 335. `cozy-lib-tests`: 90. `packages/system/backupstrategy-controller`: 67, now asserting the dump Job's label. `packages/apps/tenant`: 89. `packages/extra/computeplane`: 18. - [x] bats, 867 cases, all passing (`helmrelease-readiness` and `bats-runner-coverage` included): every `hack/run-kubernetes*_test.bats` (including two new cases pinning the teardown reads to their deadline), `kubernetes-pre-delete-hook` (13, split into the shared and the own-etcd branch, including the fail-closed exit before Step 8), `check-render-matrix`, `chainsaw-op-budgets`, `migration-62-shared-etcd-report` (new, 4), `admin-kubeconfig-invariant`, `check-hook-request-timeout`, `app-cleanup-hooks_test`, `bats-no-negated-assert`, `bats-no-exit-trap`, `select-install_test`, `select-e2e_test`, `linstor-storage-mode_test`, `cozystack-version-stamp` and `md-no-hardwrap`. - [x] `go build ./...` and `go vet` on the `api/apps/v1alpha1` Kubernetes package. - [x] `make generate` in every touched package and at the root leaves no diff; `hack/check-commit-trailers.sh origin/main..HEAD` passes. Needs a live cluster: - [ ] The e2e lanes: `kubernetes-latest`, `kubernetes-previous` and `computeplane`, now without tenant-root's etcd. The Proxmox lane on its self-hosted runner. - [ ] Upgrade from `main` with an existing cluster on tenant-root's etcd. It must stay on `tenant-root` with no control-plane rollout, and migration 63 must list it. No CI lane runs a cluster on a shared etcd, because the chart no longer creates one; an upgrade lane that installs the previous release first is a follow-up. - [ ] The deny policy beyond what `kubernetes-latest` now probes: from a guest worker VM and from outside the cluster, `nc -zv kubernetes-<name>-etcd.<ns>.svc 2379` must be refused. The control plane, the defrag Job, a `Kubernetes` backup dump Job, an `EtcdSnapshot` Job, Kamaji and etcd-operator must still connect, including a freshly started control-plane pod (Cilium can briefly classify a new pod IP as `world`). - [ ] Delete a cluster whose own etcd never became Available (for example, the quota case below). Step 4a must release the `TenantControlPlane` and the uninstall must finish without manual work. - [ ] A tenant whose `ResourceQuota` cannot fit 3 × 1000m/512Mi limits and 3 × 4Gi requests must surface the quota error on the etcd member pods. - [ ] A backup and a restore through the `Kubernetes` strategy of a cluster that owns its etcd, including the rebuild of a deleted cluster. ### Follow-ups, not opened These are listed here at the maintainer's request rather than filed: - **cozystack/website**: - `content/en/docs/next/operations/configuration/platform-package.md` gains `kubernetesEtcd.storageClassLocal` and `kubernetesEtcd.storageClassReplicated`; - `content/en/docs/next/kubernetes/relocate-etcd.md` describes the shared tenant etcd as what a cluster uses; - tenant and Kubernetes docs telling users to set `etcd: true` for a cluster, which is now an obsolete workaround; - the Kubernetes app reference is regenerated from the README on the next stable tag. - **cozystack/terraform-provider-cozystack**: `internal/provider/kubernetes_schema.go` and `kubernetes_model.go` need `etcd.replicas`, with the default of 3, a 1..3 range and the expand/flatten pair. - **cozystack/cozystack**, after this lands: - an upgrade e2e lane that keeps a cluster on a shared etcd across the upgrade; - alert rules for a cluster's own etcd; - the opt-in migration path and its e2e; - an operator `talosconfig`; - phases 3 and 4. ### Screenshots Not a UI change. ### Downstream repositories Follow-ups are listed above under "Follow-ups, not opened". By the maintainer's decision they are not filed from this draft, so no box is ticked. - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: listed above, not yet filed - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: listed above, not yet filed - [ ] [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(kubernetes): each new tenant Kubernetes cluster now gets its own etcd (EtcdCluster `kubernetes-<name>-etcd` and Kamaji DataStore `<namespace>.kubernetes-<name>`), created and deleted with the cluster, so no ancestor Tenant needs `etcd: true` and the `awaiting-etcd` state is gone. The new `etcd.replicas` field chooses 3 members (default) or 1. Each member starts at 1000m CPU and 512Mi memory limits with a 4Gi volume, counted against the tenant's quota, and a VerticalPodAutoscaler may resize it as it is recreated. The platform values `kubernetesEtcd.storageClassLocal` and `kubernetesEtcd.storageClassReplicated` choose the StorageClass for 3 members and 1 member respectively. Existing clusters keep the shared tenant etcd they run on, unchanged; the upgrade lists them in the migration log. The `Kubernetes` backup strategy covers a cluster's own etcd as it covers a shared one. The tenant etcd's metrics scrape now selects only its own members. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * New Kubernetes clusters now use dedicated etcd by default, with one- or three-replica configurations and platform-selected storage. * Clusters already using shared etcd continue to use it. Installation notes show where control-plane state is stored and summarize resource limits. * Kubernetes add-ons can render independently of tenant-shared etcd settings. * **Bug Fixes** * Cluster removal now waits for dedicated etcd resources to be reclaimed. * Platform upgrades report clusters still using shared etcd without modifying them. * **Documentation** * Updated Kubernetes and ComputePlane guidance on dedicated etcd, storage options, and migration considerations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
16da53637e |
feat(kubernetes): give each new cluster an etcd of its own
A tenant Kubernetes cluster could only start once an ancestor Tenant had an etcd module turned on, which nobody creating a cluster may do, and every cluster below that tenant then shared one etcd, one CA and one disk. Anything that orders clusters on a tenant's behalf had to flip the tenant's etcd on first. A new cluster now renders its own EtcdCluster and DataStore, from the cozy-lib shapes the etcd chart uses, and is created and deleted with them. The awaiting-etcd state goes, since a datastore always exists. An existing cluster stays on the DataStore its live KamajiControlPlane names, and renders what it rendered before. Changing that name starts a Kamaji datastore migration, which freezes the tenant's writes and leaves every worker kubelet needing a restart, so no upgrade may do it. _namespace.etcd cannot decide this: tenant-root publishes one to every tenant whether or not an etcd runs behind it. On uninstall, Kamaji's datastore finalizer drops the tenant's role, prefix and user from an etcd this release deletes next, and it never completes while that etcd is down. The pre-delete hook therefore removes it from a TenantControlPlane on the cluster's own DataStore that outlives the wait, and deletes the etcd's PKI, which cert-manager issues without an owner. If the finalizer stays on, or the TenantControlPlane cannot be read, the hook fails before the PKI goes, so the uninstall is retried with the etcd still in place. A TenantControlPlane on a shared DataStore is left to Kamaji as before. A Cilium deny policy keeps the rest of the tenant namespace, ancestor tenants and off-cluster sources off the etcd ports; the Kubernetes backup strategy's dump Job carries the label it admits. The tenant etcd's scrape now selects its own members by instance, because every member etcd-operator runs carries app.kubernetes.io/name: etcd. The platform waits for etcd-operator before offering the application. The defrag job both charts share pulls its image through the configured registry, pinned by digest to the multi-architecture index, so a mirrored installation does not depend on ghcr.io for it. Tested with helm-unittest on both the own and the shared branch, the pre-delete hook's bats suite run against a stub kubectl for both, and a render of an existing cluster that matches main byte for byte. The guest e2e runs the defrag CronJob once, and probes the etcd client port from a labelled Pod, an unlabelled one and one in tenant-root. Co-authored-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Assisted-by: LLM Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
86ad3870d1 |
fix(cozystack-basics): make the tenant super-admin VirtualMachine grant read-only (#4797)
<!-- 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 `cozy:tenant:super-admin:base` granted `'*'` on `kubevirt.io/virtualmachines`, so a tenant super-admin could create a `VirtualMachine` of any size in their namespace, or edit the one a `VMInstance` release rendered and raise its guest size. Such a VM is not a HelmRelease the tenant ordered, so nothing that accounts for applications sees it. The grant arrived in #516 together with a `'*'` on `helmreleases`; that one was removed since, this one was not. Nothing in tree needs the write. Power goes through the `virtualmachines/start|stop|restart` subresources and console/VNC through the VMI subresources, both granted at the `use` level; size, disks and networking go through `VMInstance` values; Forklift's Plan admission check runs against the migration-controller's own service account, not the tenant. The rule becomes `get`, `list`, `watch`. `watch` stays on purpose: the dashboard's power controls and VNC/serial tabs watch the `VirtualMachine` for its live state, and no other tenant role grants it. The tenant roles are aggregated from ClusterRoles in several packages (`cozystack-basics`, `backup-controller`, `migration-controller`, `cozystack-scheduler`), so a write path can reach a tenant without touching the role that names it. A new test in `hack/e2e-install-cozystack.bats`, right after `tenant-test` is created, reads the effective rules of the `tenant-test-super-admin` group back from the apiserver in a single `SelfSubjectRulesReview`, fails if that review reports itself incomplete or carries an `evaluationError` (both of which `kubectl auth can-i --list` lets through with exit 0), subtracts what a bare `system:authenticated` identity already holds, and fails on any write verb that `hack/e2e-tenant-super-admin-write-verbs.yaml` does not name. A line covered by a wildcard grant is folded into it, so a new `apps.cozystack.io` kind does not need an allowlist edit. An allowlisted entry the cluster does not grant is printed without failing, for lanes that disable a package through `COZY_DISABLED_PACKAGES`. The allowlist sits under `hack/e2e-*.yaml`, which `select-e2e.sh` already escalates to the full suite. A helm-unittest on the role catches the same regression on the unit lane. Verified outside CI on a throwaway k3s v1.33 loaded with the rendered tenant ClusterRoles and the tenant RoleBindings, through `hack/cozytest.sh`: with `main`'s roles the test fails and names `virtualmachines.kubevirt.io - *`; with this change it passes; with the migration-controller roles removed it passes and prints the eight `forklift.cozystack.io` entries as not granted. The two awk programs give the same result under mawk and dash (`ubuntu:24.04`) as on macOS. The new helm-unittest fails against `main`'s template and passes here. `hack/bats-runner-coverage.bats`, `hack/bats-no-exit-trap.bats` and `hack/select-e2e_test.bats` pass. This change is the standalone fix of the RBAC prerequisite described in the tenant-quota design proposal, cozystack/community#48, where review asked for it to land on `main` independently of that design. ### Screenshots No UI change. ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [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: Walked the trigger map against the diff: an RBAC narrowing in `cozystack-basics` plus e2e harness files touch no values key, CRD, `ApplicationDefinition`, package list or tooling path. The one website page that patches `virtualmachines.kubevirt.io` directly, `networking/virtual-router.md`, is a procedure that "requires a Cozystack administrator account", which this change does not affect. ### Release note ```release-note fix(cozystack-basics): tenant super-admins can no longer create, edit or delete `kubevirt.io` VirtualMachines directly; they keep read and watch. Virtual machines are managed through VMInstance and VMDisk applications, power through the start/stop/restart actions. The install e2e now fails when a tenant super-admin gains a write verb outside a checked-in allowlist. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Access Control** * Tenant super-admins can view KubeVirt virtual machines with read-only permissions through the base role; it no longer grants broad write access to these resources. * Tenant super-admin write permissions are checked against an explicit allowlist. Permissions outside the approved list cause the end-to-end check to fail, while approved permissions not currently granted do not. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
4bc9084ad7 |
feat(bucket): offer Object Lock without a default retention (#5050)
## What this PR does A locked bucket can only be provisioned from the `-lock` BucketClass, whose default retention is COMPLIANCE for 365 days. Backup tools such as Veeam, restic and Kopia set the retention of each object themselves, and other users want a shorter default or GOVERNANCE, which a bucket owner can already set through the S3 API once the bucket exists. Nothing let them start from a locked bucket without that year-long default, so users left Object Lock off. This adds a `-lock-noretention` BucketClass next to every `-lock` class: in the COSI chart patch, for the Client topology, and for each storage pool. It enables Object Lock and sets no default rule. The bucket app gets a `lockingDefaultRetention` flag that selects it together with `locking`. The flag defaults to `true`, so existing buckets and values keep `-lock`, and it is read at creation only. The new class keeps `deletionPolicy: Retain` like `-lock`. The driver deletes a bucket through the filer without checking retention ([seaweedfs/seaweedfs-cosi-driver#17](https://github.com/seaweedfs/seaweedfs-cosi-driver/issues/17)): on a lab cluster (SeaweedFS 4.31, driver v0.3.1), a BucketClass with `objectLockEnabled` and `Delete` removed a bucket holding an object still under COMPLIANCE retention, which S3 itself had refused to delete. A pool named `x-lock-noretention` renders the same class name as the `-lock-noretention` class of a pool `x`. That suffix is not reserved, since such pools already exist and must keep upgrading; the template instead checks every BucketClass and BucketAccessClass name the pools render, across `volume.pools` and every zone's pools, against each other and against the base classes, and fails only on an actual duplicate. The same check catches pools named exactly `lock`, `readonly` or `lock-noretention`. Tested with helm-unittest in the three charts, each new suite checked to fail with the template change reverted. On the same lab cluster, a bucket from a class with only `objectLockEnabled` accepted a default retention set afterwards with `PutObjectLockConfiguration`, per-object `PutObjectRetention`, and Legal Hold. The class itself has not run on a SeaweedFS 4.48 backend yet. ### Screenshots No template change in the dashboard. The new field reaches the bucket form through the schema, like `locking`. ### Downstream repositories - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: https://github.com/cozystack/website/pull/821 - [x] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: https://github.com/cozystack/terraform-provider-cozystack/issues/73 (issue) - [ ] [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 bucket app gains a field in its `values.schema.json`, so `terraform-provider-cozystack` needs it in its bucket resource with a default of `true`; filed as an issue there rather than a PR, since whether the attribute should force a replacement is the provider maintainers' call. The website's Buckets guide is hand-written and described only the `-lock` class with its default retention, so it is updated in cozystack/website#821. No other repository in the trigger map is reached by this diff. ### Release note ```release-note feat(bucket): add `lockingDefaultRetention` to provision a locked bucket with Object Lock enabled and no default retention, from the new `-lock-noretention` BucketClass, so the retention can be chosen through the S3 API. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * When bucket locking is enabled, choose whether newly created buckets receive the default COMPLIANCE retention period of 365 days. Default retention remains enabled by default. * Turn off default retention to enable Object Lock without a preset retention period. Retention can then be configured for the bucket or individual objects through the S3 API. * This setting is applied only when a bucket is created; changing it later does not alter existing buckets. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
61e0839e0e |
fix(postgres): validate audit.log and match audit keys case-insensitively
Review on #5404 surfaced three issues with the audit toggle: - audit.log was a free string, so a mistyped class (write, ddl, rol) rendered unchanged and pgaudit fell back to none at the next restart, silently disabling auditing. Add a schema pattern over the pgaudit class list so a bad class is rejected at admission. - The explicit-parameter-wins guard matched keys case-sensitively, so a user key like pgaudit.LoG landed beside the lowercase seed and PostgreSQL, which is case-insensitive, picked the seed. Match the user keys lowercased. - The connection-logging and empty-log guards were untested. Cover log_disconnections, an empty pgaudit.log, an empty audit.log and a case-variant key. Also note in the field docs that write/all record statement text, so the audit trail is readable by anyone with access to the log stack. Assisted-by: LLM Signed-off-by: IvanHunters <xorokhotnikov@gmail.com> |
||
|
|
64c55898aa |
fix(postgres): make an explicit parameter win over the audit default
Seeding pgaudit.log and the connection-logging parameters through the $defaults merge let a falsy explicit value lose: a tenant setting log_connections: 0 while audit is on had it silently overwritten with on, because sprig merge reads a zero value as unset. Seed each key only when postgresql.parameters does not already set it, so an explicit value wins unconditionally. Also enumerate the valid pgaudit.log classes in the field description, since an unrecognised class makes pgaudit fall back to none and silently disables auditing. Assisted-by: LLM Signed-off-by: IvanHunters <xorokhotnikov@gmail.com> |
||
|
|
902909dbe7 |
feat(postgres): add an audit toggle for access and statement logging
Managed Postgres could already load pgaudit through the sharedPreloadLibraries allowlist and set pgaudit.log and log_connections through postgresql.parameters, but that leaves an orchestrator depending on internal parameter names to answer who connected and what they ran. This adds an audit block that bundles access and statement auditing behind one switch. With audit.enabled the chart adds pgaudit to shared_preload_libraries and seeds pgaudit.log (from audit.log, default "write, ddl, role"), log_connections and log_disconnections. The parameters are seeded as defaults, so an explicit pgaudit.log or log_connections in postgresql.parameters still wins. The audit trail goes to the instance log, which the platform log stack already collects, so it is queryable per database without extra wiring. Postgres only; the other managed databases are left for follow-ups. Assisted-by: LLM Signed-off-by: IvanHunters <xorokhotnikov@gmail.com> |
||
|
|
7614829293 |
Merge branch 'main' into feat/bucket-lock-noretention
Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
8800d0177b |
fix(platform): bump system PostgreSQL to 17.12
The system databases (Keycloak, Harbor, Grafana, Alerta, SeaweedFS) are pinned to PostgreSQL 17.7, which is affected by CVE-2026-116331: a type confusion in the min/max aggregate optimisation lets a role that can create objects run code as the operating system user of the server. The 17.x line fixes it in 17.12. Move the pin to 17.12-standard-trixie. The image variant and the Debian release stay the same, so glibc and ICU do not change under the data directory. Clusters on another major keep their image, as before. Assisted-by: LLM Signed-off-by: Andrey Kolkov <androndo@gmail.com> |
||
|
|
1ab20ea96e |
fix(cluster-api): name the kubeconfig the upgrade hook runs with (#5398)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Fixes merged to `main` reach the release lines the backport batch runs for automatically, so do not open backport PRs by hand: https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md --> ## What this PR does The "Unit & controller tests" job fails on `main` and on every PR rebased on it: `hack/check-hook-request-timeout.bats` reports "no in-cluster kubectl call carries a non-zero --request-timeout" against `packages/system/capi-providers-core/files/upgrade-providers.sh`. #4902 added that script and #5360 extended the check to `files/` a few hours apart, so neither ran against the other. It is a false positive. The hook Job exports `KUBECONFIG=/scripts/kubeconfig` and the script talks to the API only through that explicit kubeconfig, which is exactly the case the check exempts, but the exemption keys on the file naming `KUBECONFIG` and the script only named `KUBE_CONTEXT`. The single commit makes the script require `KUBECONFIG` with its other inputs, so the dependency is explicit and the script refuses to fall back to the in-cluster config. The check and the 10s per-call timeout are left as they are. It adds a test that the script exits before any API call when `KUBECONFIG` is unset, and asserts in the chart test that the Job sets `KUBECONFIG` to the mounted kubeconfig. Reverting the script change makes both the check and the new test fail. ### Screenshots <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note fix(cluster-api): the provider upgrade hook script now requires the kubeconfig its Job mounts, which also unblocks the unit test job on main. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Upgrade operations now require `KUBECONFIG` to be set and stop with an error if it is missing, before making API calls. * Added checks that the upgrade job uses the expected kubeconfig path and that the configured current context is `capi-upgrade`. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
ad47521c95 |
fix(cozystack-basics): make the tenant super-admin VirtualMachine grant read-only
cozy:tenant:super-admin:base carried '*' on kubevirt.io virtualmachines. A VirtualMachine written directly is sized outside any application: it is not a HelmRelease the tenant ordered, so nothing that accounts for applications sees it, and the same verbs let a super-admin raise the guest size of a VM a VMInstance release rendered. Nothing in tree needs the write: power goes through the virtualmachines start/stop/restart subresources, console and VNC through the VMI subresources, size, disks and networking through VMInstance values. The grant arrived together with a '*' on helmreleases that was later removed; this one was missed. watch stays, because the dashboard watches the VirtualMachine for its live power state and no other tenant role grants it. The tenant roles are aggregated from ClusterRoles in several packages, so a write path can reach a tenant without touching the role that names it; the install e2e now guards against that. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
9ecff91b74 |
fix(kafka)!: require SCRAM-SHA-512 on the external listener
With external access on, the chart opens a listener on port 9094 of a public LoadBalancer address, and it rendered that listener without any authentication: whoever reached the address could produce and consume on every topic. TLS on that listener only encrypts the session. The KafkaUser name carries the release name because it is also the SCRAM username and the name of its Secret, and two instances in one namespace may declare the same user. A dot joins the two because a user Secret readable by the tenant must never take the name of a Secret Strimzi derives from a cluster name, and neither a release name nor any of those Secrets can hold a dot. BREAKING CHANGE: an instance with external access enabled refuses clients that do not authenticate. The Kafka README gives the upgrade sequences. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
836f280426 |
fix(monitoring): spread monitoring replicas over nodes (#4989)
## What this PR does
The monitoring chart renders its VMCluster, VLCluster, VTCluster and
VMAlertmanager without `affinity` or `topologySpreadConstraints`, and
vm-operator v0.68.4, which main and release-1.6 ship, copies both fields
onto the pods as written and adds none of its own
([build/statefulset.go#L11-L36](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/factory/build/statefulset.go#L11-L36),
[build/deployment.go#L11-L36](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/factory/build/deployment.go#L11-L36)).
Nothing keeps two replicas of one tier off the same node.
Seen on three three-node clusters, on v1.6.4 and v1.6.5, which both
render these resources without a placement rule and ship the same
operator. In the root tenant of one of them both vmstorage replicas of
`longterm` and both vmselect replicas of `shortterm` shared a node, with
their volumes on the node-local `local` class. On another both vlstorage
replicas shared a node, on `replicated`. On all three, two of the three
Alertmanager replicas shared a node. With `replicationFactor: 2` both
copies of every `longterm` series sit on that node, and vmalert
evaluates its rules through the vmselect of the first metrics storage,
`shortterm` by default, so losing that node also stops alert evaluation.
A StatefulSet pod on a lost node is not replaced until its Pod or Node
object is deleted, so this holds for the Alertmanager replicas too,
which have no volume.
This PR gives every tier a per-node spread keyed to the
`app.kubernetes.io/name` and `app.kubernetes.io/instance` labels the
operator puts on that component's pods
([ClusterSelectorLabels](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/api/operator/v1beta1/vmextra_types.go#L108-L124),
[VMAlertmanager](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/api/operator/v1beta1/vmalertmanager_types.go#L323-L330)).
- The tiers that run as StatefulSets, vmstorage, vmselect, vlstorage,
vtstorage and the Alertmanager, get `maxSkew: 1` on
`kubernetes.io/hostname` with `whenUnsatisfiable: DoNotSchedule` and
`nodeTaintsPolicy: Ignore`, as #4986 proposes for etcd members and #4947
for the SeaweedFS masters, for the reasons given there. A preference
only adds to a node's score and #4986 shows other scores outweighing it,
while a replica placed wrong on a node-local volume stays there. More
replicas than nodes still start, and a replica evicted by a drain goes
to a node without a peer or waits for its own node instead of joining a
peer. As in #4986, a node the pods can never run on, such as a tainted
control plane, still counts as an empty node, so next to such a node the
three Alertmanagers need three schedulable nodes.
- The tiers that run as Deployments, vminsert, vlinsert, vlselect,
vtinsert and vtselect, get the same spread with `ScheduleAnyway`. A
Deployment replaces their pods on another node by itself, and a
requirement would only add Pending pods during drains on small clusters.
- When `_cluster.scheduling.globalAppTopologySpreadConstraints` is set,
every tier gets that policy instead, with the tier's selector added to
each constraint that has none and a selector the policy sets itself left
as written, the rule the keycloak chart applies to its database
constraints. A value that does not parse or holds no non-empty
`topologySpreadConstraints` list fails the render, as an empty
`logsStorages` already does, instead of silently leaving the policy out.
The `traces-central` VMAuth keeps the spread it already has.
### On upgrade
The new pod templates make the operator update every tier once.
StatefulSets default to `OnDelete` in the operator
([build/defaults.go#L84-L87](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/factory/build/defaults.go#L84-L87)),
and it replaces their pods itself, one at a time because the chart sets
no `rollingUpdateStrategyBehavior`, in ordinal order through the
Eviction API, waiting for each new pod to become Ready
([reconcile/statefulset.go#L156-L176](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/factory/reconcile/statefulset.go#L156-L176),
[#L215-L359](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/factory/reconcile/statefulset.go#L215-L359)).
The wait is `VM_PODWAITREADYTIMEOUT`, 80s by default
([config.go#L578-L587](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/config/config.go#L578-L587)),
which the victoria-metrics-operator package leaves alone. Deployments
roll through the Deployment controller
([reconcile/deploy.go#L26-L80](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/factory/reconcile/deploy.go#L26-L80)).
Within a VMCluster the order is vmstorage, vmselect, vminsert
([vmcluster.go#L81-L143](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/factory/vmcluster/vmcluster.go#L81-L143)),
within a VLCluster vlstorage, vlselect, vlinsert
([vlcluster.go#L65-L74](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/factory/vlcluster/vlcluster.go#L65-L74)).
A replica without a volume, like the Alertmanager, or with a volume that
can be attached on another node, like vlstorage on `replicated`, is
placed again under the new rule during that rollout, so given enough
nodes those tiers end up spread with nothing else to do.
A replica on a node-local volume cannot leave its node, and `local` is
the default class for the metrics storage in the documented layout. If a
peer of the same tier runs on that node while another node has none, the
new pod cannot be scheduled, since the volume allows only that node and
the spread refuses it, so it stays Pending. The operator gives up the
wait after 80s and keeps the resource `expanding`, because a wait
timeout counts as retryable
([reconcile.go#L141-L143](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/factory/reconcile/reconcile.go#L141-L143),
[controllers.go#L343-L353](https://github.com/VictoriaMetrics/operator/blob/v0.68.4/internal/controller/operator/controllers.go#L343-L353)),
and tries again on the next reconcile. The later tiers of that VMCluster
or VLCluster are not updated meanwhile, and the peer keeps serving. For
a VLCluster the monitoring HelmRelease waits on that status through its
`healthCheckExprs`, so the release upgrade times out as well.
Such a replica does not move by itself, and this PR does not move it.
Moving it means recreating its volume on another node. For vmselect that
drops a cache. For vmstorage it drops that replica's copy, and with
`replicationFactor: 2` the series written before the move keep one copy
until they age out of retention. vlinsert shards logs over vlstorage
rather than replicating them, so for vlstorage it drops the logs on that
volume. A platform that wants to defer the move can set
`globalAppTopologySpreadConstraints` to a `ScheduleAnyway` policy, which
the other charts that read it pick up too.
#4947 gives the same tiers a preferred pod anti-affinity in its second
commit and argues against a required rule because of exactly this case.
Since then the Alertmanager layout showed up on a third cluster, and
#4986 found tenant etcd members on one node despite a `ScheduleAnyway`
spread on the same storage classes, so this PR takes the other side for
the tiers that keep state and states the cost. The two touch
neighbouring lines but merge cleanly, and the monitoring suite passes on
the merge, 27 suites and 327 tests. If you prefer this approach, the
monitoring commit of #4947 is no longer needed.
### Tests
`tests/topology_spread_test.yaml` pins the whole constraint list of
every tier for the default, for a second VMCluster name, for an empty
platform policy, for a zone policy, for a policy with two constraints,
for a policy constraint that brings its own selector, and for a
constraint without a selector after and before one with its own, with
`matchLabels` and with `matchExpressions`.
`tests/topology_spread_invalid_policy_test.yaml` pins the failure for a
policy that does not parse, a bare list, an empty list and a map.
Against the templates on main all 18 cases fail, and against
|
||
|
|
4131169c3c |
fix(redis, valkey, harbor): spread sentinels and data pods over nodes (#4990)
## What this PR does The RedisFailovers rendered by the `redis` and `valkey` apps and by the Harbor system chart set no placement, so the operator applies its default, a preferred pod anti-affinity on `kubernetes.io/hostname` ([generator.go#L795-L816](https://github.com/freshworks-oss/redis-operator/blob/v3.3.5/operator/redisfailover/service/generator.go#L795-L816), the same in spotahome v1.3.0-rc1 that release-1.6 ships). A preference only decides where a pod starts. A sentinel evicted by a drain is recreated while both other nodes already run one, and a rollout of the sentinel Deployment adds each new sentinel before it removes an old one, so either can leave two sentinels on one node, and nothing moves them back. Seen on a three-node cluster running v1.6.4 and on clusters running v1.6.5. A tenant Redis with three replicas had its three Redis pods on three nodes and two of its three sentinels on one node, and Harbor's Redis had two of its three sentinels on one node too. Losing that node leaves one sentinel, below the quorum of two, so no failover can happen while it is down. The operator does not step in either, because it skips its checks while a pod of the instance is Pending or terminating ([checker.go#L101-L111](https://github.com/freshworks-oss/redis-operator/blob/v3.3.5/operator/redisfailover/checker.go#L101-L111)), and the pods of a lost node stay terminating, so if the master was on that node the instance has no master until the node is back. This PR gives the sentinels and the data pods a spread with `maxSkew: 1` on `kubernetes.io/hostname`, `whenUnsatisfiable: DoNotSchedule` and `nodeTaintsPolicy: Ignore`, the default #4986 proposes for tenant etcd. The selector is the `app.kubernetes.io/name` and `app.kubernetes.io/component` pair the operator puts on every pod, without `redisfailovers-role`, which the operator switches between `master` and `slave` at runtime. No `affinity` is set, so the operator's anti-affinity stays. When `_cluster.scheduling.globalAppTopologySpreadConstraints` is set it replaces the default, and the selector is added to each of its constraints that has none, as the keycloak chart does for its database constraints. The etcd and postgres charts add it under the last constraint only, and a constraint without a selector counts no pods ([helpers.go#L36-L39](https://github.com/kubernetes/kubernetes/blob/v1.33.12/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go#L36-L39)), so with a zone and a node constraint the zone one would spread nothing. A policy that does not parse or has no non-empty `topologySpreadConstraints` list fails the render. The sentinels get a hard constraint because of the quorum. A sentinel that waits Pending while its node is away leaves two sentinels on two nodes, which still form the quorum, while two sentinels on one node turn the loss of that node into a lost quorum. With `Ignore` a cordoned node still counts, so an evicted sentinel waits for its node instead of starting next to another one. The data pods get the same constraint because on a node-local StorageClass a pod that starts next to another one stays there with its volume. An instance with more pods than nodes still starts, because the skew is counted between the nodes that exist ([filtering.go#L338-L356](https://github.com/kubernetes/kubernetes/blob/v1.33.12/pkg/scheduler/framework/plugins/podtopologyspread/filtering.go#L338-L356)). The sentinel constraint also has `matchLabelKeys: [pod-template-hash]`. The operator sets no strategy on the sentinel Deployment ([generator.go#L546-L551](https://github.com/freshworks-oss/redis-operator/blob/v3.3.5/operator/redisfailover/service/generator.go#L546-L551)), so a rollout of three sentinels adds one new pod at a time while the old ones run. Counted together with the old pods, a new sentinel can start on a node that already has another new one, and that pair stays once the old pods are gone. With the key, new pods are counted only against each other ([common.go#L95-L105](https://github.com/kubernetes/kubernetes/blob/v1.33.12/pkg/scheduler/framework/plugins/podtopologyspread/common.go#L95-L105)), and the ReplicaSet removes old pods that share a node with another pod first ([replica_set.go#L863-L878](https://github.com/kubernetes/kubernetes/blob/v1.33.12/pkg/controller/replicaset/replica_set.go#L863-L878), [controller_utils.go#L859-L865](https://github.com/kubernetes/kubernetes/blob/v1.33.12/pkg/controller/controller_utils.go#L859-L865)), so a rollout on three or more nodes ends with one sentinel per node. `matchLabelKeys` is beta and on by default since Kubernetes 1.27 ([kube_features.go#L1502-L1505](https://github.com/kubernetes/kubernetes/blob/v1.33.12/pkg/features/kube_features.go#L1502-L1505)). The RedisFailover CRD on main has both fields, and the redis-operator package replaces the CRD on upgrade. On upgrade the operator writes the StatefulSet and the sentinel Deployment in the same pass ([ensurer.go#L49-L57](https://github.com/freshworks-oss/redis-operator/blob/v3.3.5/operator/redisfailover/ensurer.go#L49-L57)). The Deployment controller rolls the sentinels one at a time and removes an old one only after its replacement is ready, so three sentinels stay available. The StatefulSet uses `OnDelete` ([generator.go#L376-L379](https://github.com/freshworks-oss/redis-operator/blob/v3.3.5/operator/redisfailover/service/generator.go#L376-L379)) and the operator replaces its pods itself ([checker.go#L14-L83](https://github.com/freshworks-oss/redis-operator/blob/v3.3.5/operator/redisfailover/checker.go#L14-L83)). It waits while any Redis or sentinel pod is Pending or terminating ([check.go#L547-L559](https://github.com/freshworks-oss/redis-operator/blob/v3.3.5/operator/redisfailover/service/check.go#L547-L559)) or a replica is not in sync, so the Redis pods are normally replaced after the sentinel rollout, one outdated replica per pass and the master last. The master's preStop hook asks the sentinels to fail over before the pod stops ([generator.go#L263-L267](https://github.com/freshworks-oss/redis-operator/blob/v3.3.5/operator/redisfailover/service/generator.go#L263-L267)), so an instance with replicas goes through one failover during the upgrade, and a single-pod instance restarts its pod. The charts do not set `disableMasterRollout`. The Cozystack patches to the operator do not change any of this. This has two costs. With `Ignore` a node the pods can never run on, such as a tainted control plane, counts as an empty node, so on such a cluster each usable node takes one pod at most and the rest stay Pending, and for Redis a Pending pod also stops the operator's checks for the instance, including the choice of the first master of a new one. And data pods that already share a node on a node-local volume cannot be separated by a reschedule. The replica the operator recreates there during the rollout cannot be placed, the rollout stops before the master, and the instance runs one replica short, with the operator's checks stopped, until that replica's volume is recreated on another node. On storage that attaches from any node the recreated replica moves to a free node instead. A platform that wants the old behaviour can set `scheduling.globalAppTopologySpreadConstraints` to `ScheduleAnyway`, which the other charts that read it pick up too. #4880 adds a zone spread to the same two blocks of Harbor's RedisFailover and leaves the per-node part to the operator's anti-affinity, so whichever of the two lands second has to merge them. #2665 adds `affinity` values to the redis app, which would replace the operator's anti-affinity and do not touch the spread. The valkey app had no `test` target, so this PR adds the same three lines as #4346. New suites `packages/apps/redis/tests/topology_spread_test.yaml`, `packages/apps/valkey/tests/topology_spread_test.yaml` and `packages/system/harbor/tests/redis_spread_test.yaml` pin both default constraints, that no `affinity` is rendered, that a cluster-wide policy renders in place of the default with the selector added to every constraint that has none, that a selector the policy sets itself is kept, and that a malformed policy fails the render. Against the templates on main every new case fails, 9 for redis, 5 for valkey and 5 for Harbor, and against the first commit the 12 cases the second commit adds fail. Each of 21 mutations fails at least one case. In the default constraints they are `ScheduleAnyway` or no `matchLabelKeys` for the sentinels, `Honor` or `redisfailovers-role` in the selector for the data pods, `maxSkew: 2` in valkey and the Harbor sentinel selector set to `redis`. In the cluster-wide branch they are the policy ignored, `nodeTaintsPolicy` added to it, the selector added to no constraint, a selector the policy sets overwritten, the sentinel selector set to `redis`, the Harbor name without its `-redis` suffix, the policy check dropped or reduced to the empty list, and the parse error left out of the message. ```console $ docker run --rm -v "$PWD":/apps -w /apps/packages/apps/redis helmunittest/helm-unittest:4.2.3-1.1.2 . Test Suites: 6 passed, 6 total Tests: 77 passed, 77 total $ docker run --rm -v "$PWD":/apps -w /apps/packages/apps/valkey helmunittest/helm-unittest:4.2.3-1.1.2 . Test Suites: 1 passed, 1 total Tests: 5 passed, 5 total $ docker run --rm -v "$PWD":/apps -w /apps/packages/system/harbor helmunittest/helm-unittest:4.2.3-1.1.2 . Test Suites: 3 passed, 3 total Tests: 14 passed, 14 total $ hack/check-render-matrix.sh packages/apps/redis packages/apps/valkey packages/apps/harbor check-render-matrix: 3 rendered, 0 skipped ``` On main the redis chart has 68 tests in 5 suites and Harbor 9 in 2. With the render fixtures `helm template` of the three charts differs from main only in the added constraints, apart from the values they generate on every render. I have not rolled this out on a cluster, and the scheduling was not exercised against a running kube-scheduler. The files are the same on release-1.7. release-1.6 ships spotahome v1.3.0-rc1, whose CRD has neither `nodeTaintsPolicy` nor `matchLabelKeys` and is not replaced on upgrade, so its backport is a separate PR without those two fields. ### Screenshots Not a UI change. ### Downstream repositories Templates and tests of `packages/apps/redis`, `packages/apps/valkey` and `packages/system/harbor`, plus a `test` target in the valkey Makefile. No values, schema, default, README or `ApplicationDefinition` change. The website already describes `globalAppTopologySpreadConstraints` as applied to all managed applications and documents no placement workaround for Redis, 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 fix(redis, valkey, harbor): spread Redis, Valkey and Harbor Redis data pods and sentinels with DoNotSchedule. The operator rolls existing instances, including one failover when replacing a replicated master. With nodeTaintsPolicy: Ignore, untolerated tainted nodes count as empty domains: if fewer nodes are usable than sentinels, some pods stay Pending. The operator skips its checks while any pod is Pending, so a new instance may never get its first master and an upgrade may stall. Node-local PVCs can also strand recreated replicas beside a peer. Before upgrading, set scheduling.globalAppTopologySpreadConstraints to a topologySpreadConstraints list with maxSkew: 1, topologyKey: kubernetes.io/hostname and whenUnsatisfiable: ScheduleAnyway to opt out. The override also applies to other charts that consume it. For an already stranded instance, apply that override, let the chart and operator reconcile, and verify all pods are Ready and a master is selected. This avoids deleting data. Keeping hard spreading instead requires enough usable nodes and a separate storage-migration plan for any stranded node-local replica. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit - **New Features** - Added support for configuring topology spread constraints across Redis, Valkey, Sentinel, and Harbor Redis workloads. - By default, pods are spread across hostnames with workload-specific selectors. - Custom constraints apply to Redis and Sentinel pods. Existing selectors are preserved; component-specific selectors are added when none is provided. - **Bug Fixes** - Invalid or empty topology spread configurations now fail validation during rendering. - **Chores** - Added a test command for the Valkey chart. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
5e6772ec3f |
fix(cluster-api): name the kubeconfig the upgrade hook runs with
The provider upgrade hook reaches the API through the kubeconfig its
Job mounts at /scripts/kubeconfig and exports as KUBECONFIG, never
through the in-cluster config. The script only named KUBE_CONTEXT,
so hack/check-hook-request-timeout.bats, which since it started
reading files/ exempts a script only when it names KUBECONFIG, took
its "kubectl --context ... --request-timeout=10s" for an in-cluster
call and failed "no in-cluster kubectl call carries a non-zero
--request-timeout" on main.
Require KUBECONFIG alongside the other inputs instead of loosening the
check or dropping the timeout: the per-call timeout is safe because
the explicit kubeconfig is what serves it, and the script now refuses
to fall back to the in-cluster config, where the timeout would hit the
bug the check guards against.
Tested with bats on hack/check-hook-request-timeout.bats,
hack/capi-upgrade_test.bats and hack/capi-upgrade-chart_test.bats; with
the script change reverted, the check and the new missing-KUBECONFIG
test both fail.
Fixes:
|
||
|
|
7d64fb7a53 |
fix(linstor): run the NFS server wait init container on the platform CSI image (#5358)
## What this PR does Closes #5307 The LinstorCluster in `packages/system/linstor/templates/cluster.yaml` had no `nfsServer.podTemplate`. The NFS server DaemonSet's `linstor-wait-node-online` init container therefore ran piraeus-operator's default `quay.io/piraeusdatastore/piraeus-csi` image, at the operator's own tag. Every other container on the CSI image is pinned to `linstorCSI.image`. Changes: - Adds `nfsServer.podTemplate`, which pins that init container to `{{ .Values.linstorCSI.image.repository }}:{{ .Values.linstorCSI.image.tag }}`, the same way `csiNode` pins its `linstor-wait-node-online`. - Sets `nfsServer.enabled: true` explicitly. In piraeus-operator v2.12.1, `ComponentSpec.IsEnabled()` is `c == nil || c.Enabled`. An absent `nfsServer` is enabled today, and the CRD also defaults `enabled` to `true`. Stating it keeps the DaemonSet deployed exactly as now and doesn't rely on that default. - Adds a helm-unittest case in `tests/linstor_test.yaml`, next to the existing CSI image pins. It checks that the init container's image is the cozystack-built `linstor-csi` and that `nfsServer.enabled` is `true`. I checked the container name against upstream `pkg/resources/cluster/nfs-server/nfs-server-daemon-set.yaml` at v2.12.1, the vendored operator version. The operator applies `podTemplate` as a strategic merge patch keyed on the container name (see `ComponentPodTemplate("DaemonSet", "linstor-csi-nfs-server", ...)`), so only the image changes. ### How I checked it - `helm unittest .` in `packages/system/linstor`: 6 suites and 25 tests pass. With the template change reverted, the new case fails. - `helm template` renders `nfsServer` with the pinned `ghcr.io/cozystack/cozystack/linstor-csi:v1.6.0@sha256:…` image. - I haven't tried it on a running cluster. ### 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: This only changes one rendered LinstorCluster field in `packages/system/linstor`. No values keys, images or versions change. ### Release note ```release-note fix(linstor): the NFS server's linstor-wait-node-online init container now runs the platform-built linstor-csi image instead of the operator's default. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * LINSTOR clusters now enable the NFS server. Its startup check uses the image repository and tag configured for LINSTOR CSI, including when those values are overridden. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
a2c986d770 |
Merge branch 'main' of github.com:cozystack/cozystack into pr5050-sync
Signed-off-by: Mattia Eleuteri <mattia@hidora.io> # Conflicts: # packages/apps/bucket/README.md # packages/system/bucket-rd/cozyrds/bucket.yaml |
||
|
|
7a2d532d16 |
feat(seaweedfs): bump chart to 4.48 and backport Gateway API HTTPRoutes (#4879)
## What this PR does
This adds Gateway API HTTPRoutes for the SeaweedFS S3 endpoint and the
filer, as groundwork for moving tenant ingress to Gateway API (#4788).
This builds on #4893, which is now merged and keeps Object Lock working
for COSI credentials once SeaweedFS is on 4.48. Nothing is switched.
Both routes are off by default, and the route commit leaves the rendered
release unchanged.
The chart is bumped from 4.45 to 4.48 first, together with the in-tree
SeaweedFS image, so the patched binary matches the chart. Every carried
chart patch still applies. `s3-grpc-tls.patch` is dropped because 4.48
ships the same `[grpc.s3]` section. The in-tree image also drops
`volume-layout-crowded-lock.diff` from main. 4.48 already has that fix
(seaweedfs/seaweedfs#11216), so the patch no longer applies. CI rebuilds
the in-tree image and stamps its digest into the E2E and installer
artifacts.
The image also fixes peer discovery during startup. Peer changes could
be lost between the bootstrap scan and consumer setup, leaving S3
gateways subscribed to only one filer's metadata. Before the reconnect
fix I checked a CI image binary for the handoff and bootstrap replay
floor. The image for this head has not been checked that way.
The checked-in image ref is from an earlier build. Main and
release-candidate builds rebuild SeaweedFS and stamp its actual ref into
the packages before publication. To get this fix from a chart installed
straight from git, build the image first.
With this package's values, the render changes only in image references,
chart labels and new `checksum/*` annotations on master and s3 pods, so
those pods roll once on upgrade. With lifecycle enabled, the admin
container also gets an explicit `-ip=0.0.0.0`. Names, selectors and
volumeClaimTemplates stay the same. Suites that render master or s3 now
list the templates the checksum annotations include, because
helm-unittest only loads the templates a suite names.
The routes come from upstream commit seaweedfs/seaweedfs@68af030e38,
first released in 4.49. This package stays on 4.48, so they arrive as a
new patch. Only the s3 and filer routes and their values are taken. One
line differs from upstream on purpose. The s3 route's default backend is
`<name>-s3`, built from `seaweedfs.name` like the Service that
`s3-service-name.patch` renders. Upstream uses `componentName`, which
matches that Service only while the fullname equals `seaweedfs.name`, so
the new tests override `fullnameOverride` and fail on upstream's form.
The patch is temporary. Drop `patches/httproute-backport.patch` and its
Makefile line when bumping to 4.49 or later. From that release on, `make
update` fails on the patch, because it creates both templates. Before
dropping it, move the s3 backend name change into
`s3-service-name-consumers.patch` and the BackendTLSPolicy note into
`s3-tls-main-port.patch`. Upstream also ships master, volume and admin
routes, which I left out on purpose. The patch header carries the same
note.
Enabling the s3 route needs one more thing. With security on and no
`httpsPort`, the standalone s3 gateway serves TLS on its main port
(`s3-tls-main-port.patch`), so the Gateway needs a BackendTLSPolicy to
reach it. The chart does not render one, and a note next to
`s3.httpRoute` says so.
Extracting the chart from the 4.48 source archive and applying the
patches in `make update` order reproduces the committed `charts/` byte
for byte. Both in-tree image patches apply to the 4.48 source, and the
chart tests pass.
The tests reproduce peer changes lost during startup, and a peer kept
from an earlier master stream after a reconnect. With the current
patches, the filer, wdclient and server suites and focused race checks
pass on Linux. Before the reconnect fix I tested a native build with two
filers, shared PostgreSQL and two S3 gateways. Both filers returned the
identities, and both gateways accepted valid keys and rejected an
unknown key. These checks do not cover COSI driver RPCs or establish the
original failed run's persisted IAM state.
The E2E run on
|
||
|
|
e86ef94185 |
feat(api, kubernetes, virtual-machine): declare tenant quota reservations on ApplicationDefinitions (#5349)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Fixes merged to `main` reach the release lines the backport batch runs for automatically, so do not open backport PRs by hand: https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md --> ## What this PR does Second phase of the accepted [tenant quotas as reservation limits](https://github.com/cozystack/community/pull/48) design, after the evaluator in #4983. An `ApplicationDefinition` can now declare what an application of its kind reserves from its tenant's budget, as CEL over its defaulted values, and the four IaaS kinds (`vm-instance`, `vm-disk`, `kubernetes`, `kubernetes-nodes`) declare theirs. Nothing reads the declarations yet: the usage oracle and the generalized admission gate are the next phase, behind a flag. - `fix(api)`: the evaluator could not sum quantities. The Kubernetes CEL library returns a pointer from `add` and `sub`, which the evaluator did not recognize, so any declaration summing components failed. Found while writing the `kubernetes` declaration, which sums four control-plane components. - `fix(api)`: the evaluator refused exact products. `resource.Quantity.Mul` returns false once the product leaves an int64 coefficient, not when it is wrong, so any fractional binary size above about 8.5Gi (`20.5Gi × 3`) failed as an overflow. - `fix(api)`: a null value stayed present wherever the schema had no default to replace it, so `has()` saw a key Helm deletes, and evaluation failed on a spec the chart renders. - `feat(api)`: `spec.consumption` on `ApplicationDefinition` (`exempt`, ordered `let` bindings, `resources` per quota key), owned as a whole so that a binding and the expressions reading it are replaced together. The evaluator's `Declaration` is now an alias of the API type. The CRD rejects an exempt declaration that still carries expressions and a non-exempt one that names no resource. - `refactor(extra)`: ComputePlane's default `md0` pool now writes its ceiling, instance type and disk size into its release instead of relying on the pool chart's schema defaults, so the release alone says what the pool can reserve. The rendered pool does not change. - `feat(api, kubernetes, virtual-machine)`: the four declarations, each following its chart's own precedence, plus a test that evaluates the shipped declarations against the shipped instance types and preset table, with the failures that must stay errors. Validated locally: `go test ./pkg/reservation/` with each commit built and tested on its own, `helm unittest` on computeplane and the touched `-rd` charts, the four definitions plus three invalid ones validated against the generated CRD schema and its CEL rules, and `make generate` in the touched packages left the tree unchanged (with `cozyvalues-gen` v1.7.0, the version CI pins). Decisions worth a reviewer's look: - **Proxmox worker pools reserve nothing.** Their VMs and disks run on the external hypervisor, so they draw nothing from this cluster's capacity. The `kubernetes` kind reserves one `services.loadbalancers` on Proxmox, for its published apiserver Service, and one on KubeVirt when the ingress addon is exposed by a load balancer, which the tenant cluster's cloud controller realizes in the tenant namespace. - **GPUs are not declared.** Their quota key is the device name (`nvidia.com/<model>`), and `resources` keys are fixed strings. Expressing them needs either a dynamic-key form in the declaration or a class key for GPUs; I would rather settle that in its own change than guess here. Until then the namespace `ResourceQuota` keeps bounding them. - **A spec the chart refuses to render is refused, not estimated.** A partial `resources` block on a VM or a worker pool, a non-whole core count or a memory below 1M fails the evaluation with the declaration's reason, through a `fail(reason)` function the evaluator now offers, so the gate in the next phase can answer with the same reason the render would give. Two decisions left for the next phase, both about what values alone cannot see: - A `vm-disk` whose `storage` is lowered keeps its larger volume, because the chart only ever grows it, while its declaration reads the lowered value. The admission gate has to refuse a storage decrease on Update before it relies on this declaration. - A worker pool's rollout runs one surge worker and its disk next to the old ones (`maxUnavailable: 0` by default), which `maxReplicas` does not cover. Whether that overlap counts against the tenant's budget or is platform margin decides whether a tenant at its ceiling can roll a pool at all. Refs: cozystack/community#48 ### 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 I walked the trigger map against the diff. Two repositories are affected, and each has a follow-up issue: - `cozystack/website`: the map lists "Change `ApplicationDefinition` semantics". This adds a field nothing reads yet; documenting it seems more useful once the gate in the next phase gives it an effect. - `cozystack/external-apps-example`: the map lists changes to the `ApplicationDefinition` CRD. The field is optional, so nothing breaks there now, but the next phase refuses orders of a kind that declares neither its consumption nor an exemption, so out-of-tree catalogs will need a declaration before that phase is switched on. - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: cozystack/website#820 - [ ] [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: - [x] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: cozystack/external-apps-example#6 - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note feat(api, kubernetes, virtual-machine): ApplicationDefinitions can declare the tenant quota reservation of their kind, and the VM, disk, Kubernetes and worker pool kinds declare theirs. Nothing enforces the declarations yet. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Application definitions can declare resource consumption for CPU, memory, storage, and load balancers, with reservations based on configured sizing and substrate choices. * Kubernetes worker-pool reservations reflect replica counts, resource overrides, instance types, and disk size; control-plane reservations reflect component sizing and replica counts. * VM instance and disk definitions report resource and storage consumption. * Default compute clusters now specify a node-pool limit of 10, an instance type, and a disk size. * **Validation** * Invalid or incomplete resource sizing and consumption declarations now produce errors, including mismatched CPU and memory settings. Consumption declarations also enforce limits on resource entries and bindings. * **Bug Fixes** * Null values are treated as absent when calculating reservations, and quantity calculations support larger and fractional results. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
82f6cab63f |
feat(apps): per-app schedulingClass field for selective workload placement (#2622)
<!-- 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
Closes the per-application gap of the SchedulingClass system. Today a
SchedulingClass can only be attached to a `Tenant`, which propagates it
to every workload in the namespace through the namespace label. The
lineage webhook already prefers the owner Application's class over the
namespace label ("owner Application field takes priority, then fall back
to namespace label" in `applySchedulingClass`), but
`Application.SchedulingClass()` was a `TODO` that always returned `""`,
so that path was unreachable.
### Changes
1. `feat(api)`: `Application.SchedulingClass()` reads the top-level
`schedulingClass` key from `Spec.Raw`. A nil spec, an empty or missing
field, and invalid JSON all return `""`, so the webhook falls back to
the namespace class.
2. `feat(apps)`: every managed application whose pods go through the
webhook gets an optional `schedulingClass` field. Under
`packages/apps/`: bucket, clickhouse, foundationdb, harbor, kafka,
kubernetes, mariadb, mongodb, nats, openbao, opensearch, postgres,
qdrant, rabbitmq, redis, tcp-balancer, valkey, vm-disk, vm-instance,
vpn. Under `packages/extra/`: bootbox, etcd, external-dns, ingress,
monitoring, seaweedfs. Skipped: `tenant` (already has the field), `vpc`
and `info` (no pods), `gateway` (not an Application), `computeplane` (it
only wraps `kubernetes` and `kubernetes-nodes` releases), and
`kubernetes-nodes` itself, whose worker pods resolve to the parent
Kubernetes application, so a class set on a pool would be ignored.
3. `fix(apps)`: the field is capped at 63 characters (`maxLength: 63` in
the schemas, `+kubebuilder:validation:MaxLength=63` in the Go types),
because its value becomes a Pod label value while a SchedulingClass name
may be up to 253 characters. As defence in depth, `applySchedulingClass`
skips only the label when the resolved name is not a valid label value,
keeping `schedulerName` and the annotation, so a long-named class
degrades to annotation-only injection instead of having the apiserver
reject every Pod.
4. `test(lineage-webhook)`: covers the owner-Application path, which the
existing tests never exercised (they all pass a nil owner): the app
class overriding the namespace class, the fallback when the field is
absent, empty or the spec is missing, and the label guard for an
over-long name.
5. `feat(tenant)`: the tenant chart gains `allowedSchedulingClasses`,
empty by default, written to the
`namespace.cozystack.io/allowed-scheduling-classes` namespace
annotation. A parent tenant with a class or a non-empty list passes its
list down unchanged, so a child tenant cannot widen it.
6. `fix(lineage-webhook)`: an application class applies only when the
namespace allows it and the SchedulingClass exists. Otherwise the pod
keeps the tenant class, where it previously got no scheduler at all when
the named class did not exist.
7. `feat(api)`: a ValidatingAdmissionPolicy on `apps.cozystack.io`
(tenants excluded) refuses a `spec.schedulingClass` that is neither the
tenant's own class nor in its allowed list. An update that keeps the
class is not refused, so an application whose class was later removed
from the list stays editable; the webhook keeps its pods on the tenant
class.
8. `docs(apps)`: the field description names the tenant setting that
decides which classes are accepted.
### Precedence
The tenant class is the administrator's placement constraint, so an
application may replace it only with a class the tenant allows. The
administrator lists those classes in the tenant's
`allowedSchedulingClasses`, which is empty by default: per-application
placement stays off until it is enabled, and every application runs
under the tenant class. Naming the tenant's own class is accepted
without an entry, since it is the same as leaving the field empty. Any
other value is refused at admission, and the webhook enforces the same
rule at pod admission, falling back to the tenant class rather than
dropping it.
### Use case
The tenant administrator allows the class (`allowedSchedulingClasses:
[co-region-prod]` on the Tenant). Combined with the
`scheduler.cozystack.io/scheduling-class` Pod label added in #2621, a
class name can double as a co-affinity group:
```yaml
apiVersion: cozystack.io/v1alpha1
kind: SchedulingClass
metadata: { name: co-region-prod }
spec:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
scheduler.cozystack.io/scheduling-class: co-region-prod
topologyKey: topology.kubernetes.io/region
---
apiVersion: apps.cozystack.io/v1alpha1
kind: Postgres
metadata: { name: db, namespace: tenant-acme }
spec:
schedulingClass: co-region-prod
---
apiVersion: apps.cozystack.io/v1alpha1
kind: VMInstance
metadata: { name: app, namespace: tenant-acme }
spec:
schedulingClass: co-region-prod
```
The Postgres pods and the virtual machine land in the same region,
without pinning a specific one.
### Out of scope
Placement per replica role (primary or standby of a clustered database).
The role is assigned by the operator after election, while the webhook
acts at pod creation, so the future primary is unknown at that point.
### Verification
- `go test ./pkg/apis/... ./pkg/registry/... ./pkg/cmd/server/...
./internal/lineagecontrollerwebhook/...` passes. The behavioural webhook
tests were checked against the reverted code: without the label guard,
with `SchedulingClass()` returning `""`, and with the previous
resolution that skipped injection for an unknown application class, each
fails.
- The admission policy's decisions are evaluated against the chart
template with the apiserver's CEL compiler
(`pkg/registry/apps/application/scheduling_class_policy_test.go`), and
on a lab cluster through the aggregated cozystack-api: a class outside
the list is refused, a listed class or the tenant's own class is
accepted, and an update that keeps a class removed from the list is
accepted while one that changes it is refused
(https://github.com/cozystack/cozystack/pull/2622#issuecomment-7042784997).
- The tenant chart's inheritance of the list is covered by
`packages/apps/tenant/tests/namespace_allowed_scheduling_classes_test.yaml`,
which fails when a child tenant may widen its parent's list.
- `make generate` at the root and in every touched package
(cozyvalues-gen v1.7.0, the CI pin) leaves no diff.
- `make helm-unit-tests` passes; `hack/check-rd-presets.sh` and
`hack/check-commit-trailers.sh` 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. -->
No UI change.
### Downstream repositories
<!--
Cozystack is upstream for repositories that are NOT kept in sync with it
automatically, and nothing in CI compares the two sides, so a change
here can break them silently.
Which change forces what, and which file to touch, is the trigger map in
docs/agents/contributing.md under "Downstream Repositories". Walk it
before you tick anything.
IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM
TO FILL IN:
1. Walk the trigger map against the actual diff of this PR, file by
file. Do not decide from the PR title or from your memory of what you
changed.
2. For every repository you tick, open the follow-up PR there and link
it on the same line. A ticked box with no link claims work that does not
exist, which is worse than an empty box. Search that repository for an
open PR or issue covering it first, and link that instead of filing a
duplicate.
3. When the follow-up is out of scope, or needs a decision that is not
yours to make, open an issue in that repository instead, link that, and
say so in the PR body.
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.
-->
Two repositories are reached by this diff. Both follow-ups are issues
rather than PRs, because each one only applies once this PR is merged:
`terraform-provider-cozystack` needs the field on every application it
models and `allowedSchedulingClasses` on the tenant, and `website` needs
the hand-written SchedulingClass guide to cover the per-application
field, the tenant's allowed list that gates it, and the Pod label.
- [ ] No downstream repository is affected by this change
- [x] [cozystack/website](https://github.com/cozystack/website) -
follow-up: cozystack/website#749
- [x]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up: cozystack/terraform-provider-cozystack#69
- [ ]
[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(apps): managed applications (bucket, clickhouse, foundationdb, harbor, kafka, kubernetes, mariadb, mongodb, nats, openbao, opensearch, postgres, qdrant, rabbitmq, redis, tcp-balancer, valkey, vm-disk, vm-instance, vpn, plus the bootbox, etcd, external-dns, ingress, monitoring and seaweedfs extras) accept a top-level `spec.schedulingClass` field, capped at 63 characters, which applies the named SchedulingClass to that application's pods in place of the tenant-level class. Only the tenant's own class or one listed in the tenant's new `allowedSchedulingClasses` (empty by default) is accepted; any other value is refused. This lets applications in the same tenant be co-located through a SchedulingClass podAffinity on the `scheduler.cozystack.io/scheduling-class` Pod label. An application whose class does not exist now keeps the tenant class instead of losing it.
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **New Features**
* Added `schedulingClass` configuration across applications to select an
eligible scheduling class for newly created pods. Empty settings inherit
the tenant’s class; existing pods keep their assigned class until
recreated.
* Added tenant-level controls for which scheduling classes applications
may select. Invalid selections are rejected, and new pods fall back to
the tenant’s class if permission is removed.
* Added scheduling-class settings to application configuration displays.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
||
|
|
f5ceed0e24 |
feat(linstor, platform): upgrade snapshot-controller to v8.7.0 and enable VolumeGroupSnapshots (#5239)
## What this PR does Windows VMs with three or more disks cannot get an application-consistent Velero backup on Cozystack today. Velero takes one CSI snapshot per PVC, one after the other, while virt-freezer holds the guest frozen, and on LINSTOR each snapshot takes 2 to 4 s. With three disks or more the freeze runs past the 10 s that Windows VSS allows, VSS aborts with `0x80042314`, and the backup fails. The only workaround is `kubevirt.io/skip-backup-hooks=true` on the VM, which gives up application consistency. The fix is a VolumeGroupSnapshot: one snapshot request for all the PVCs of a VM, taken inside the freeze. linstor-csi has implemented the CSI GroupController since v1.11 (the package ships v1.11.2), and it creates the whole group in a single LINSTOR `Resources.CreateSnapshots` call, so every volume of the VM is captured at the same instant and the freeze lasts one snapshot instead of N. Velero 1.18 drives VolumeGroupSnapshots through `groupsnapshot.storage.k8s.io/v1beta2`. What is missing is on the Cozystack side: snapshot-controller v8.0.1 serves the group snapshot API only as v1alpha1 and runs without the `CSIVolumeGroupSnapshot` gate, and piraeus-operator turns the gate off on the csi-snapshotter sidecar when it does not find v1beta2. This PR: - Upgrades the vendored Piraeus `snapshot-controller` chart from 3.0.5 (v8.0.1) to 5.4.0 (v8.7.0) with the package's `make update`. The `snapshot.storage.k8s.io` CRDs stay at v1. The `groupsnapshot.storage.k8s.io` CRDs go from v1alpha1 only to v1beta1, v1beta2 and v1, with v1beta2 as the storage version. The controller runs with `--feature-gates=CSIVolumeGroupSnapshot=true`, the chart's default. The validating webhook is gone upstream, replaced by CEL rules in the CRDs. The new optional conversion webhook stays disabled, as upstream ships it, since no cluster holds group snapshot objects to convert. - Sets `keepCRDs: true`. The chart now renders its CRDs from a template instead of `crds/`, so without it an uninstall of the release would delete every VolumeSnapshot with the CRDs. - Patches the vendored CRD template (`patches/skip-foreign-crds.diff`, applied by `make update`) so a CRD is rendered only when it is absent or already carries this release's `meta.helm.sh/release-name` and `meta.helm.sh/release-namespace`. A CRD a distribution ships, or that another release owns, stays out of the manifest, so helm-controller neither takes it over nor rewrites it on upgrade. On a fresh install, and for the CRDs migration 62 adopts, the output is unchanged. - Adds migration 62 and bumps `migrations.targetVersion` to 63 (renumbered from 61 after upstream took migration 61 for the Strimzi v1 conversion). The CRDs `crds/` created carry no Helm ownership metadata, and the patched chart renders only the CRDs that do, so the migration annotates the three `snapshot.storage.k8s.io` CRDs the release installed for adoption, which keeps them in its manifest. The three group snapshot CRDs cannot be adopted: the apiserver rejects an update that drops v1alpha1 while it is listed in `status.storedVersions`. The old controller never ran with the gate, so no v1alpha1 object was ever acted on, and the migration deletes each of these CRDs when it is empty and creates it again straight away at v1beta2, from copies `make image-migrations` renders out of the snapshot-controller chart with the release's ownership metadata (as it already bakes the etcd-operator CRDs for migration 50). Every HelmRelease waits for this pre-upgrade hook, so the linstor release renders against the v1beta2 API even when it upgrades before snapshot-controller. A CRD that still holds objects is kept and recorded on the `cozystack-version` ConfigMap as `cozystack.io/migration-62-needs-attention`, and the CRD stays out of the release, which carries no Helm ownership on it, so snapshot-controller still upgrades with that group snapshot API at v1alpha1 and group snapshots off. Nothing re-renders either release once the CRD is cleaned up, so the migration's warning gives the whole recovery: delete the objects and the CRD, force a snapshot-controller HelmRelease upgrade so the chart creates the CRD at v1beta2, restart the snapshot-controller Deployment, which sets up its group snapshot watches only when it starts, then force a linstor HelmRelease upgrade. The migration only touches CRDs that helm-controller labelled as installed by `cozy-snapshot-controller/snapshot-controller`, and the chart leaves the others out of the release, so a distribution that ships its own snapshot CRDs keeps them in both places. Whether the release is installed is read from its HelmRelease rather than from those labels, so a retry after a failed create still recreates the group CRDs it deleted when only they carried the labels; without the HelmRelease the migration changes nothing. The version is stamped only once every release-owned v1beta2 group snapshot CRD is Established, whichever path brought it there, so a retry after a timed-out wait waits again rather than letting linstor render before the API is served. - Sets `FEATURE_GATE_CSI_VOLUME_GROUP_SNAPSHOT=true` on the linstor-csi `csi-snapshotter` sidecar through the LinstorCluster pod template. piraeus-operator v2.10.2 probes for the v1beta2 API once, when it starts, and adds a patch that sets the variable to `false` when the probe fails. On a cluster upgraded from v1alpha1 the operator started before the new CRDs existed, so the gate would stay off until the operator next restarted. The pod template is merged after the operator's own patch. The variable is always set, to `true` only when the apiserver serves all three `groupsnapshot.storage.k8s.io/v1beta2` kinds and to `false` otherwise: the operator's probe looks at VolumeGroupSnapshot alone, and csi-snapshotter with the gate on and a group API missing waits for its group snapshot caches before it starts the ordinary snapshot workers. The class below renders under the same check. - Adds a default `VolumeGroupSnapshotClass` `linstor-group-snapshots` for `linstor.csi.linbit.com`, next to the existing `linstor-snapshots` VolumeSnapshotClass, with the `velero.io/csi-volumegroupsnapshot-class: "true"` label Velero selects a group snapshot class by. Only on a cluster where migration 62 kept a populated v1alpha1 CRD do they wait for the forced linstor upgrade at the end of that recovery. Not in this PR: grouping a VM's PVCs for Velero. Velero builds a group from the PVCs that share the value of the `velero.io/volume-group` label, so the `vm-instance` and `vm-disk` charts would have to set it to the VM name on every disk. That is a separate change, and an operator can set the label by hand meanwhile. Testing: - Kubernetes v1.34.3, Velero 1.18.1, linstor-csi v1.11.2, piraeus-operator v2.10.2. On that cluster the group snapshot CRDs are v1alpha1 only, list `["v1alpha1"]` in `storedVersions`, hold no object, and carry the helm-controller labels of `cozy-snapshot-controller/snapshot-controller`. The csi-snapshotter sidecar runs with `FEATURE_GATE_CSI_VOLUME_GROUP_SNAPSHOT=false`, set by the operator's patch. - `hack/migration-62-snapshot-crds.bats` (16 cases) runs migration 62 in the migrations base image against a fake kubectl that keeps the CRDs in a state file: adoption and deletion, a second run that changes nothing, a CRD holding objects, CRDs another installer owns, CRDs that already serve v1beta2, a cluster without the release, a release without the group CRDs, a failing HelmRelease read, CRD read or delete that aborts before the stamp, a failed diagnostic record that still stamps, a failed create that aborts and is completed by the retry, release labels on the group CRDs alone, with and without a failed first create, a timed-out Established wait whose retry must wait again before stamping, and a v1beta2 CRD that still stores v1alpha1, which is recorded rather than adopted. With the delete removed from the migration, the first case fails; with the release identity taken from the CRD labels instead of the HelmRelease, the failed-create case with group-only labels stamps 63 without recreating the CRDs and fails. Without the wait on the adoption path, the timed-out-wait case stamps 63 on the retry without waiting and fails. - New helm-unittest suites: `packages/system/snapshot-controller/tests/crds_test.yaml` pins `keepCRDs`, v1beta2 served and stored on the three group snapshot CRDs and the controller gate; `packages/system/snapshot-controller/tests/crd_ownership_test.yaml` mocks the live CRDs and checks that one without Helm ownership and one owned by another release are left out while an absent one and one this release owns are rendered (it fails with the patch reverted); `packages/system/linstor/tests/volume_group_snapshot_test.yaml` pins the sidecar gate on with and without strict topology, off when only VolumeGroupSnapshot or no group API is served, and the VolumeGroupSnapshotClass rendered only when the v1beta2 API is served. `csi-topology_test.yaml` now counts the `csi-snapshotter` entry in the pod template. - `helm unittest` passes for `packages/system/linstor` (30 tests), `packages/system/snapshot-controller` (7) and `packages/core/platform` (285). `hack/cozystack-version-stamp.bats` and `hack/check-migrations-target.sh` pass. - Not yet run end to end: the upgrade of a live cluster through migration 62, and a Velero backup with a VolumeGroupSnapshot through linstor-csi. ### Screenshots Not a UI change. ### Downstream repositories - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: The only change to `packages/core/platform/values.yaml` is the value of `migrations.targetVersion`. The website's `platform-package.md` lists that key without a value, so it needs no change. No website page mentions VolumeGroupSnapshots or documents the snapshot-controller webhook. The rest of the diff is a vendored chart, two system packages, a migration and its tests, none of which the trigger map reaches. ### Release note ```release-note feat(platform): snapshot-controller is upgraded to v8.7.0 and serves VolumeGroupSnapshots as groupsnapshot.storage.k8s.io/v1beta2, and linstor-csi takes group snapshots with a default VolumeGroupSnapshotClass labelled for Velero. A platform migration hands the snapshot CRDs over to the release and removes the empty v1alpha1 group snapshot CRDs. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added LINSTOR volume group snapshot support when all required APIs are available, including a default snapshot class. * Updated the snapshot controller to support newer snapshot APIs and a conversion webhook. * Added safer CRD installation and upgrade handling, preserving CRDs with existing objects and recording items that need attention. * **Bug Fixes** * Improved snapshot-controller upgrade reliability, including recovery from certain CRD creation failures. * **Documentation** * Updated chart guidance for CRD management, conversion webhooks, and snapshot class configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
f6bccbe23f |
feat(platform): make the Keycloak public host configurable (#5112)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Add the label `kind/backport` if it's a bugfix that needs to be backported to a previous version. --> ## What this PR does The Keycloak chart already accepts `ingress.host`, but every OIDC consumer rebuilds the issuer as `https://keycloak.<root-host>/realms/<realm>` on its own: the dashboard and linstor-gui gatekeepers (`--oidc-issuer-url`, `--login-url`, `--whitelist-domain`, external logout URL), Grafana SSO (`auth_url`, `token_url`, `api_url`), the info kubeconfig (`--oidc-issuer-url`) and tenant Kubernetes clusters in `oidc.mode: System` (AuthenticationConfiguration issuer). Serving Keycloak on any other hostname (for example `auth.example.org`) therefore changes the `iss` of every token while those consumers keep expecting the old one, and SSO breaks across the platform. This adds `authentication.oidc.keycloakHost` to the platform values. The platform resolves it once (empty means `keycloak.<root-host>`), validates it as a bare lowercase hostname (no scheme, port or path, since it is spliced into URLs and `--whitelist-domain`), and publishes it as `_cluster.keycloak-host`. The Keycloak chart (Ingress, HTTPRoute, `KC_HOSTNAME`) and the five consumers read that key, each falling back to `keycloak.<root-host>` when it is absent so a chart rendered without the platform Secret behaves as before. `ingress.host` on the Keycloak chart keeps working and still wins, and its comment now points at the platform value. Existing clusters render unchanged: with `keycloakHost` empty, every URL is byte-identical to today's. Changing the value on a live cluster is an issuer change, so sessions and refresh tokens minted under the old host stop being accepted and the management apiserver (configured out of band via talm `oidcIssuerUrl`) must trust the new issuer first; the values comment says so. Tests: one new suite each for the platform wiring and validation and for the Keycloak chart, plus a custom-host case in the dashboard, linstor-gui, info, monitoring and kubernetes suites. Reverting the templates makes every new case fail; `helm unittest` passes on all seven touched charts. ### Screenshots <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: https://github.com/cozystack/website/issues/778 (issue rather than PR: the table row should land once this PR merges) - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note feat(platform): add authentication.oidc.keycloakHost to serve Keycloak on a custom public hostname; the Keycloak Ingress, KC_HOSTNAME, the dashboard and linstor-gui gatekeepers, Grafana SSO, the info kubeconfig and tenant Kubernetes clusters in oidc.mode System all follow it. Empty keeps keycloak.<root-host>. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added an optional public Keycloak hostname, defaulting to `keycloak.<cluster-root-domain>` when unset. * The configured hostname is used for Keycloak access, OIDC issuer and login URLs, and related browser-facing authentication settings across supported services and kubeconfig. * Existing Keycloak hostname overrides remain supported when compatible with the platform hostname. * **Bug Fixes** * Invalid configured hostnames—including values with schemes, paths, ports, or invalid DNS lengths—and conflicting explicit Keycloak and platform hostnames now prevent rendering. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
2acba8bf60 |
fix(linstor): roll affinity controller and scheduler on client cert rotation (#5160)
<!-- 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 `linstor-affinity-controller` and the `linstor-scheduler` extender read their LINSTOR API client certificate from `secretKeyRef` env vars, which kubelet resolves only when the container starts. cert-manager renews these 90-day certificates every 60 days, but neither workload is restarted on rotation, so a pod that outlives its certificate keeps presenting the expired one. The controller refuses every new TLS handshake and the Go client logs a bare `Get "https://linstor-controller:3371/v1/resource-definitions?": EOF`, while the CLI inside the controller pod keeps working, which makes it look like an API problem. Observed on a production cluster: an affinity controller pod running for 91 days failed every 15 s from 25 minutes after its certificate expired (an existing keep-alive connection survived until then), so PV node affinities stopped following replica moves. One of the two scheduler replicas had been failing silently for 19 days for the same reason; it was not the leader, so scheduling was not hit yet, but a lease failover would have handed scheduling to an extender that cannot reach LINSTOR. Changes: - `packages/system/linstor/templates/cluster.yaml`: add the `reloader.stakater.com/auto` patch for `Deployment/linstor-affinity-controller`, like the existing ones for `linstor-controller`, `linstor-csi-controller` and `linstor-csi-node`. - `packages/system/linstor-scheduler`: annotate the scheduler `Deployment` with `secret.reloader.stakater.com/reload: <linstor.clientSecret>`, carried as a third edit in the existing `patches/cozystack-scheduler-deployment.patch` so `make update` keeps it. `podAnnotations` would have been enough for Reloader v1.3.0, which falls back to pod-template annotations, but the vendored chart applies `podAnnotations` to the admission `Deployment` too, which would roll on a secret it does not use. - Regression tests: `linstor/tests/reloader_test.yaml` and `linstor-scheduler/tests/deployment_test.yaml`. Both fail with the fix reverted and pass with it. The patch was checked to apply with `patch -p4` on the pristine 0.3.1 chart and to reproduce the vendored template byte for byte. The existing `admission.reloadOnCertChange: false` comment is left as is: it is about the webhook's serving certificate, which the extender reloads on its own, not about the LINSTOR client certificate. ### Screenshots No UI change. <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note fix(linstor): linstor-affinity-controller and linstor-scheduler now restart when their LINSTOR client certificate is rotated, instead of failing every LINSTOR API call with EOF once the certificate they loaded at startup expires. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * LINSTOR controller, CSI, and affinity-controller deployments now support automatic reloading. * Scheduler deployments reload when their configured client Secret changes, including when a custom Secret name is used. * Scheduler deployments now identify their component and use a Kubernetes-version-aware default image tag. * **Bug Fixes** * Scheduler Secret references and reload behavior remain aligned when the client Secret name is overridden. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
9ca20d00f7 |
feat(monitoring, kubernetes): add destinations to the monitoring agents without replacing the defaults (#5376)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Fixes merged to `main` reach the release lines the backport batch runs for automatically, so do not open backport PRs by hand: https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md --> ## What this PR does To send a copy of metrics or logs to a store of their own, a user today has to override `vmagent.remoteWrite.urls` or `fluent-bit.config.outputs`. Both are replaced wholesale on merge, so the override must restate the platform's own destinations; one that does not silently cuts the tenant's VictoriaMetrics and VictoriaLogs off, with the application still `Ready`. A plain URL list cannot carry credentials either. This adds two keys to the monitoring-agents chart, appended after the defaults instead of replacing them: - `vmagent.extraRemoteWrite`: VMAgent `remoteWrite` entries passed as is, so an entry can carry `basicAuth`, `bearerTokenSecret`, `headers` or `tlsConfig`. - `fluent-bit.config.extraOutputs`: `[OUTPUT]` sections appended by the outputs template. On a managed Kubernetes cluster both are set through `addons.monitoringAgents.valuesOverride`, for example: ```yaml addons: monitoringAgents: enabled: true valuesOverride: vmagent: extraRemoteWrite: - url: https://metrics.example.org/api/v1/write basicAuth: username: {name: remote-write-auth, key: username} password: {name: remote-write-auth, key: password} fluent-bit: config: extraOutputs: | [OUTPUT] Name http Match kube.* Host logs.example.org port 443 tls On ``` `extraOutputs` is appended by a hook at the end of the default `outputs`, because the vendored fluent-bit chart builds `fluent-bit.conf` from `outputs` alone. Overriding `outputs` therefore means keeping that hook (`{{- with .Values.config.extraOutputs }}` / `{{ . }}` / `{{- end }}`) or moving the extra destinations into `outputs` itself. Setting `extraOutputs` together with an `outputs` override that lacks the hook fails the render, in the system chart and in the tenant HelmRelease template, instead of dropping the destinations in silence. Depends on #5375, which makes the app apply `valuesOverride` at all; its commit is the first one here and drops out once it merges. The commits after it belong to this PR. With neither key set, both the system chart render and the tenant render (the app's HelmRelease values fed into the system chart) are byte-identical to before. The example above was rendered end to end: the tenant's VMAgent gets its own vminsert plus the extra entry with its credentials, and `fluent-bit.conf` gets the tenant's vlinsert output followed by the extra one. Open point for reviewers: the tenant outputs carry the hook as escaped template text, because the app chart renders that string before the fluent-bit subchart renders it again. The alternative was appending at app render time from `valuesOverride`, which would leave root and tenant installs with two different mechanisms for the same key. ### Screenshots <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note feat(monitoring): the monitoring agents accept `vmagent.extraRemoteWrite` and `fluent-bit.config.extraOutputs` to send metrics and logs to additional destinations without replacing the default ones; on managed Kubernetes clusters they are set through `addons.monitoringAgents.valuesOverride`. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Monitoring agents can send metrics to additional remote-write destinations, including destinations that use Basic Auth. * Fluent Bit can include custom output sections alongside its default outputs. * Monitoring-agent value overrides can customize selected settings while retaining other default configuration. * **Bug Fixes** * Rendering now reports an error when custom Fluent Bit outputs omit the required hook while extra outputs are configured. Retaining the hook allows default and custom destinations to be rendered. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
4190aa82f5 |
fix(seaweedfs): point the Lance catalog consumers at the renamed s3 Service (#5356)
## What this PR does Closes #4878 `s3-service-name.patch` renames the S3 Service to `<name>-s3`. The Lance catalog came with chart 4.45, and its two consumers still build the name with `seaweedfs.componentName`, which gives `<fullname>-s3`: - the Lance ingress backend (`templates/s3/s3-lance-ingress.yaml`) - the Lance namespace URL the worker gets (`seaweedfs.worker.lanceNamespaceUrl` in `templates/shared/_helpers.tpl`) Changes: - Both places now use the `<name>-s3` form that the S3, Iceberg and COSI consumers already use. The ingress uses `{{ template "seaweedfs.name" . }}-s3` like the Iceberg ingress, and the URL uses `printf "%s-s3" (include "seaweedfs.name" .)`. - The two hunks are appended to `patches/s3-service-name-consumers.patch`, so `make update` keeps them. - Two cases are added to `tests/s3_service_name_consumers_test.yaml`. They set a non-zero `lancePort` and `fullnameOverride: seaweedfs-system`, like the existing cases do. Nothing changes with the shipped values. `lancePort: 0` keeps both consumers from rendering, and `fullnameOverride: seaweedfs` makes both names equal anyway. ### How I checked it - `helm unittest .` in `packages/system/seaweedfs`: 23 suites and 135 tests pass. With the template changes reverted, the two new cases fail and the rest still pass. - `make test-guard-fail-closed` passes. - I reversed the full patch chain from the `update` target on a copy of `charts/`, newest first, then applied it forward again. Every patch applied cleanly, and the result matched the committed `charts/` exactly. - I couldn't run `make test-image-version` locally because `yq` isn't installed here. This PR doesn't touch the Dockerfile or the chart 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: This touches only a vendored chart patch and its tests under `packages/system/seaweedfs`. Nothing in the trigger map of `docs/agents/contributing.md` applies. ### Release note ```release-note fix(seaweedfs): the Lance catalog ingress and the worker's Lance namespace URL now point at the renamed `<name>-s3` Service. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Corrected S3 service names used by ingress routes, worker namespace URLs, and COSI endpoint URLs to consistently use the release name. * COSI endpoint URLs now use the configured S3 port, including when using the fallback S3 configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
9680ed64df |
feat(cluster-api)!: update Cluster API to v1.14.4 (#4902)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list. Pick the most specific scope for the change. - Breaking changes: append `!` after type/scope or add a `BREAKING CHANGE:` footer. - If it is a work in progress, consider creating this PR as a draft. - Ask for opinion and review in the community chats when needed. - Fixes merged to main reach supported release lines through the backport batch automatically. Do not open backport PRs by hand. --> ## What this PR does Updates the Cluster API stack with an automatic intermediate upgrade for existing v1.10 providers. The core chart upgrades them through v1.13.8 before Helm applies the final manifests. The hook fails on API errors, conflicting changes or timeouts. The hook image goes through cozy-lib. The core chart's PackageSource declares that library, otherwise the packaged chart can't render the hook. Fresh installations skip the intermediate providers. Helm keeps the intermediate ConfigMaps, so they stay in the cluster after the next change of the intermediate version, and that bump has to remove them. Each provider now selects exactly one repository. The bridge and final ConfigMaps carry `provider.cluster.x-k8s.io/version` with the full version, including the role suffix, and the core and kubeadm selectors include it. The operator's finalize step hashes every ConfigMap the selector matches and rejects more than one. During an upgrade it also checks the selector of every other installed provider. So the bridge ConfigMaps carry only the version label, and the v1.10 selectors, which have no version, never match them. The hook switches the version and the selector in one guarded patch and selects a bridge by that label alone. It also narrows an existing bridge selector to that label. A provider whose first installation never finished takes the fresh-install path. Kamaji, CAPK, capmox and IPAM keep their existing pins and temporary v1beta1 compatibility. The autoscaler keeps its explicit v1beta1 selection. An infrastructure provider's v1beta1 `failureReason` no longer immediately fails a Machine or triggers remediation. The provider conditions still show the cause. The vendored operator chart gets six local patches, and `make update` reapplies them. The core components get a startup probe patch. The sync-period patch from main stays. I kept the one-minute resync setting until restart recovery is tested. CAPI Bats, the bootstrap and platform Helm suites and the rendering checks pass locally. On envtest against cluster-api-operator v0.30.0, legacy v1.10 core and kubeadm providers go through v1.13.8 to v1.14.4 with these ConfigMaps. With the old bridge labels core stayed on v1.10. I have not run a live upgrade, restart or eviction test on this revision. The [earlier Proxmox report](https://github.com/cozystack/cozystack/pull/4902#pullrequestreview-5510737333) covers the v1.13 candidate only. ### Screenshots <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> Not a UI change. ### Downstream repositories <!-- Cozystack is upstream for repositories that are not kept in sync automatically. Check the trigger map in docs/agents/contributing.md against the diff. Keep every checkbox. Tick an affected repository only after linking an existing or newly opened follow-up. Do not claim no downstream impact when it is unknown. --> - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: cozystack/website#751 - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: The existing website follow-up needs the management-cluster minimum updated to v1.33. No tenant API fields, version enums, installer values or platform variants change. ### Release note ```release-note feat(cluster-api)!: update Cluster API core and kubeadm bootstrap to v1.14.4, cluster-api-operator to v0.30.0 and Talos bootstrap to v0.6.13. Legacy core and kubeadm installations are upgraded through v1.13.8 before the final manifests are applied. The core and kubeadm bootstrap charts reject management Kubernetes older than v1.33. The upgrade is one-way: Cluster and Machine CRDs use v1beta2 storage and downgrades are not supported. The preferred Cluster API version becomes v1beta2. Clients relying on v1beta1 fields must select that version explicitly. The operator no longer serves operator.cluster.x-k8s.io/v1alpha1. The autoscaler stays on the v1beta1 Cluster API. ``` |
||
|
|
5daa04ea6e |
feat(networking): cozyplane eBPF CNI + cozyplane-kpr networking variant (drops Cilium) (#3149)
## What this PR does Adds an **opt-in** `bundles.system.networkingVariant: "cozyplane"` for the `isp-full` (Talos) bundle: it replaces kube-ovn, Cilium and kube-proxy with the [cozyplane](https://github.com/lllamnyp/cozyplane) eBPF CNI, its aggregated `sdn.cozystack.io` API server, and the `cozyplane-kpr` socket-LB kube-proxy replacement. The default `kubeovn-cilium` path renders identically to main; the selector is refused outright on every other bundle variant (slim variants included), where it would half-apply. Components: three wrapper charts around cozyplane's upstream charts — the CNI (`packages/system/cozyplane`), the kube-proxy replacement (`cozyplane-kpr`) and the aggregated apiserver with its etcd-operator-managed, PVC-backed etcd (`cozyplane-apiserver`) — plus the Cilium policy CRDs shipped inert so stock charts install (`cozyplane-cilium-crds`), a `cozystackAPI.serveSDN` toggle in cozystack-api, and the platform wiring. The wiring threads the platform's `networking.podCIDR`/`serviceCIDR` (and `clusterDNS`, the service network's address plus 10 when unset) into the cozyplane component, drops the packages that assume the replaced stack (kubeovn-webhook/-plunger, multus, securitygroup-controller, the virtualprivatecloud app), refuses the default `cilium` gateway class and `networking.encryption.enabled` on the variant, and turns off sdn serving in cozystack-api. Bootstrap ordering: the CNI installs first with the kube API as its only dependency and ships only the LOCAL group's CRDs (`local.sdn.cozystack.io`, underlay IPAM); the tenant kinds (VPC, Port, SecurityGroup, …) have **no CRDs** and are served only by the aggregated apiserver, which installs later behind cert-manager, etcd-operator and storage. Until it lands, `sdn.cozystack.io` is simply not served; there is no takeover. On Talos the agent and kpr bootstrap against KubePrism, since with no kube-proxy the `kubernetes.default` ClusterIP is unserved until kpr itself runs. Each cozyplane package follows the umbrella pattern: the upstream chart is vendored verbatim under `charts/<name>` by `make update` from a ref pinned in the wrapper's Makefile, and everything Cozystack-specific lives in the wrapper — the Talos overlays, the apiserver's etcd storage class and replica count, and two ClusterRoles that carry cozyplane's own tenant roles into the `cozy:tenant` tiers by aggregation, so the list of tenant kinds stays upstream's to maintain. Image pins are the digests upstream pins for that ref, with multi-arch legs verified there. The wrappers carry helm-unittest suites pinning the platform contract, the egress args the platform threads included, and the platform suite covers the variant's package set, the guards and the CIDR threading. The variant is experimental: it has no e2e lane yet and is not for production clusters, which the operator-facing values comment says. **CiliumNetworkPolicy objects apply but are not enforced on this variant** — tenant network isolation on the default network, the Cilium host firewall and the platform components' own Cilium policies (several of them `ingressDeny` rules native NetworkPolicy cannot express) are not in effect, as stated in the values comment, the networking source and the threat model; rebuilding them on what cozyplane does enforce (native NetworkPolicy, its operator-only HostFirewall) is a follow-up. cozystack-api's SecurityGroup (a restricted interface over CiliumNetworkPolicy) is not served on the variant; cozyplane's own SecurityGroup is the first-class tenant instrument for traffic inside and across VPCs. The tenant-facing VPC application lands in #4508, stacked on this PR. ### Screenshots Not a UI change. ### Downstream repositories The trigger map fires for cozystack/website (a new platform variant and new `platform.values` keys); cozystack/website#815 documents both. It arguably fires for terraform-provider-cozystack too (the SecurityGroup spec differs per variant); that box is left unticked so a human decides. - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: cozystack/website#815 - [ ] [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(platform): opt-in networkingVariant "cozyplane" for the Talos bundle — replaces kube-ovn, Cilium and kube-proxy with the cozyplane eBPF CNI, its aggregated sdn.cozystack.io API server and a socket-LB kube-proxy replacement; CiliumNetworkPolicy objects are not enforced on this variant ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added an opt-in Cozyplane networking variant with cluster DNS configuration, CNI, and service routing. * Added a Cozyplane API service for tenant networking resources, with tenant edit and view permissions. * Added control over whether the existing SDN API is served. * Gateway configurations using an unavailable class are now rejected with guidance. * **Important Limitations** * Cozyplane does not enforce existing Cilium network policies or platform Cilium rules. Tenant traffic isolation may require native NetworkPolicies; some platform rules require operator-managed HostFirewall policies. * Cozyplane networking does not support encryption or the default Cilium Gateway class, and requires pod and service CIDRs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
ae3dd71e68 |
feat(bucket): offer Object Lock without a default retention
The only lock class, -lock, sets a fixed default retention of COMPLIANCE for 365 days. Backup tools such as Veeam, restic and Kopia set the retention of each object themselves, and other users want a shorter default or GOVERNANCE, which a bucket owner can set through the S3 API once the bucket exists. Nothing let them start from a locked bucket without that year-long default. The new lockingDefaultRetention flag defaults to true, so existing buckets and values keep -lock. The new class keeps deletionPolicy Retain like -lock: the driver deletes a bucket through the filer without checking retention, so Delete would destroy objects still under COMPLIANCE. Pools named with a -lock-noretention suffix already exist, so that suffix is not reserved, which would block their upgrade; only class names that actually clash between pools, or with the base classes, are refused. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
64fa40e255 |
feat(monitoring): add destinations to the agents without replacing the defaults
Sending a copy of metrics or logs to a store of one's own meant overriding vmagent.remoteWrite.urls or fluent-bit.config.outputs. Both are replaced wholesale on merge, a list and a single string, so the override had to restate the platform's own destinations, and one that did not silently cut the tenant's VictoriaMetrics and VictoriaLogs off. A plain URL list could not carry credentials either. vmagent.extraRemoteWrite takes VMAgent remoteWrite entries appended after urls and passed as is, so an entry can carry basicAuth, bearerTokenSecret, headers or tlsConfig. fluent-bit.config.extraOutputs takes [OUTPUT] sections appended by the outputs template itself, which the fluent-bit subchart renders with tpl, so .Values there is the subchart's own. The managed Kubernetes app replaces outputs for tenant clusters, so its outputs carry the same hook, escaped to survive the app chart's render. On a tenant cluster both are set through addons.monitoringAgents.valuesOverride. With neither key set, the system chart render and the tenant render (app HelmRelease values fed to the system chart) are byte-identical to before. Unit tests cover both keys in the system chart and the hook in the tenant HelmRelease; each fails without the change. Both charts refuse to render when extraOutputs is set and the effective outputs does not emit it, so an outputs override that drops the hook fails loudly instead of losing the extra destinations. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
d89bce58e8 |
feat(linstor): enable VolumeGroupSnapshots for linstor-csi
linstor-csi implements the CSI GroupController since v1.11 and creates the snapshots of a group in one LINSTOR call, so the volumes of a multi-disk VM are captured at the same instant. Velero needs that for application-consistent backups of Windows VMs with three or more disks: taken one by one, the snapshots outlast the 10 s VSS allows a freeze. piraeus-operator decides the csi-snapshotter gate from an API probe it runs only at startup, so on an upgraded cluster the gate would stay off until the operator restarted. The gate is set in the LinstorCluster pod template instead, and a default VolumeGroupSnapshotClass carries the label Velero selects a group snapshot class by. Both render only when the apiserver serves all three v1beta2 group snapshot kinds. With the gate on and the API missing, csi-snapshotter waits for its group snapshot caches before it starts the ordinary snapshot workers, so every VolumeSnapshot would stall, and a v1beta2 VolumeGroupSnapshotClass would fail the upgrade. Otherwise the operator's own probe decides the gate. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
892d9c9b34 |
feat(platform): upgrade snapshot-controller to v8.7.0
snapshot-controller v8.0.1 serves VolumeGroupSnapshots only as v1alpha1 and runs without the CSIVolumeGroupSnapshot gate, so no CSI driver on the platform can take a crash-consistent snapshot of several volumes at once. Velero 1.18 and piraeus-operator both look for groupsnapshot.storage.k8s.io/v1beta2, which v8.7.0 serves and which the upstream chart enables by default. The upstream chart renders its CRDs as ordinary templates instead of shipping them in crds/, and helm-controller takes over existing objects by default. A patch makes the chart render a CRD only when it is absent or already carries this release's ownership, so a distribution that ships its own snapshot CRDs keeps them as they are. keepCRDs is set because an uninstall would otherwise delete every VolumeSnapshot along with the CRDs. Migration 62 hands the CRDs this release installed over to it, read from its helm-controller labels, and checks the HelmRelease rather than those labels to decide whether the release exists, so a retry after a failed create still recreates what the first attempt deleted. The apiserver refuses to drop v1alpha1 from a CRD that lists it in storedVersions, so the empty v1alpha1 group snapshot CRDs are deleted and created again at v1beta2 from copies the image build renders out of the chart. Every HelmRelease waits for the pre-upgrade hook, so linstor renders against the v1beta2 API even when it upgrades first; the version is stamped only once every release-owned v1beta2 group snapshot CRD is Established, which a retry after a timed-out wait must check again. A CRD that still holds v1alpha1 objects is kept, recorded on the cozystack-version ConfigMap, and its warning spells out the manual recovery, since nothing renders either release again once it is gone. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
d3804ebea9 |
feat(api): refuse an application scheduling class its tenant does not allow
The lineage webhook keeps a pod on the tenant class when the application names a class the tenant does not allow, but it can only log that, on a pod the user never looks at. Refusing the application at admission puts the error where the field was set, with the list of classes that would be accepted. An update that keeps the class is not refused, so an application whose class was removed from the list after admission stays editable; the webhook already keeps its pods on the tenant class. Tenants are left out, because their spec.schedulingClass is the child tenant's class, which the tenant chart's inheritance governs. Users read the field description in the dashboard form and the API schema, so it names the tenant setting that decides which classes are accepted, says that only setting another value is refused, and that a pod gets its class when it is created, so running pods keep theirs. The field sits in its own README section, since a reader looking for placement would not look under the unrelated heading it was appended to. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
4034f9eeb9 |
feat(tenant): let an administrator list the classes applications may pick
An application's spec.schedulingClass replaces the tenant class for its pods, and the tenant class is the administrator's placement constraint. Without a list of permitted alternatives, anyone who can create an application in the tenant can move it onto any class the cluster defines. allowedSchedulingClasses names those alternatives and defaults to empty, so per-application placement stays off until an administrator opts in. The tenant chart writes it to a namespace annotation, the place the admission policy and the lineage webhook can read it from. A parent that constrains placement passes its list down unchanged, so a child tenant cannot allow a class its parent does not, the same way it cannot replace the parent's class. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
0132457260 |
feat(apps): expose schedulingClass across all managed applications
Placement could only be set per tenant, so two applications of the same tenant could not be kept together, or apart, unless each had a tenant to itself. With a class per application and the scheduling-class Pod label, a SchedulingClass name can serve as a co-affinity group: a database and the virtual machine that uses it can be kept in the same region without pinning which one. The field is capped at 63 characters. A SchedulingClass name may be up to 253, but the webhook writes the class into a Pod label, and this is the first source of the class the apiserver has not already validated as a label value; capping it is cheap while the field is new and a breaking change once released. A class created with a longer name must still not break Pod admission, so for it only the label is left out. kubernetes-nodes gets no field: the ownership walk from a worker Pod reaches the parent Kubernetes application, never the pool, so a class set on a pool would be accepted and silently ignored. Placement per replica role (primary or standby of a clustered database) is out of scope: the operator assigns the role after election, once the webhook has already seen the pod. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
9a2830badf |
feat(api, kubernetes, virtual-machine): declare the IaaS kinds' reservation
VMs, disks, Kubernetes control planes and worker pools are where the virtualization overhead that breaks pod-unit quota accounting lives, so they are the first kinds to state their reservation in the terms a tenant buys: guest cores and memory by instance-type class, declared disk sizes, and the load balancers a spec publishes. Each declaration follows its chart's own precedence rather than one rule for all: a VM is sized by resources only when cpu, sockets and memory are all set, a worker pool when cpu and memory are non-zero, and a control-plane component fills its preset per key. A worker pool reserves maxReplicas because the cluster-autoscaler grows it without writing the pool, and reserves nothing on Proxmox, whose workers run on the external hypervisor. GPUs are not declared: their quota key is the device name, which a fixed key cannot express. The test evaluates the shipped declarations against the shipped instance types and preset table, including the failures that must stay errors rather than smaller figures. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
fa7c94507a |
feat(api): carry a consumption declaration on ApplicationDefinition
Tenant quotas are to be enforced against what an application declares rather than against the pods it renders, and the apiserver must hold no per-kind knowledge of how to compute that, so that a kind shipped from an out-of-tree catalog can take part. The declaration therefore lives on the kind's definition, next to the schema it is evaluated against. The evaluator's Declaration becomes an alias of the API type, so a definition is compiled exactly as it was read, with no conversion that could drift from it. The CRD refuses an exempt declaration that still carries expressions and a non-exempt one that names no resource, so an omission cannot pass for a zero reservation. Nothing reads the field yet. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
93a49eda63 |
feat(platform): make the Keycloak public host configurable
Keycloak's own chart already accepts ingress.host, but the OIDC consumers rebuild the issuer as keycloak.<root-host> on their own. Moving Keycloak to another hostname therefore changed the issuer of every token while the dashboard and linstor-gui gatekeepers, Grafana, the info kubeconfig and tenant clusters in oidc.mode System kept expecting the old one, and SSO broke everywhere at once. authentication.oidc.keycloakHost resolves the host once in the platform and publishes it as _cluster.keycloak-host, which Keycloak (Ingress, HTTPRoute, KC_HOSTNAME) and every consumer read. Left empty it resolves to keycloak.<root-host>, so existing clusters render unchanged. The kind is checked before any default, since `default` treats false and 0 as unset and would silently fall back to the derived host. An explicit host must also respect the RFC 1123 label and total length limits. Setting the chart's ingress.host and a different non-default keycloakHost is refused, as KC_HOSTNAME and the consumers' issuer would disagree; a legacy ingress.host alone keeps working. Any valid DNS name is accepted, including all-digit labels and words such as true, so the host is quoted wherever it is rendered; unquoted it turns into a YAML number or bool and the Ingress no longer decodes. The Gateway path's whole-apex cert modes render listeners for the apex only, and the Keycloak chart cannot see the TenantGateway cert mode to refuse an out-of-apex host, so that constraint is documented next to the setting. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
f7c1850017 |
fix(linstor): roll affinity controller and scheduler on client cert rotation
linstor-affinity-controller and the linstor-scheduler extender read their LINSTOR API client certificate from secretKeyRef env vars, which kubelet resolves only when the container starts. cert-manager renews these 90-day certificates every 60 days, but neither workload is restarted on rotation, so a pod that lives longer than the certificate keeps presenting the expired one. The controller then refuses every new TLS handshake and the Go client reports a bare EOF. For the affinity controller this means PV node affinities stop following replica moves; for the scheduler, once a pod with an expired certificate holds the leader lease, pods with LINSTOR volumes are no longer placed next to their replicas. Add the Reloader auto annotation to linstor-affinity-controller through the LinstorCluster patches, as already done for the controller and the CSI workloads, and annotate the linstor-scheduler Deployment with the client secret it consumes. The scheduler annotation goes on the Deployment rather than podAnnotations, which the admission Deployment shares and would roll for a secret it does not use. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
382169be52 |
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 --> |
||
|
|
18a9530b87 |
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 --> |
||
|
|
0c44188eb5 |
Merge branch 'main' into mattia/pwnescape-kvm-cozystack-talos-dec626
Signed-off-by: Aleksei Sviridkin <f@lex.la> |