mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
7b9b4347b2950db2df355cddeda72d51427356c8
451
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
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 |
||
|
|
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 --> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
c98a345aa1 |
docs(api): clarify health check parsing and evaluation (#4495)
## What this PR does Clarifies the lifecycle of HelmRelease CEL health checks. helm-controller parses and validates these expressions and creates a status reader factory before choosing how to wait. The factory constructs the concrete status reader when the selected wait path creates its resource manager. Invalid configuration can therefore stall the HelmRelease with reason InvalidCELExpression even when the release.cozystack.io/helm-install-disable-wait annotation is set or the legacy wait strategy is selected. Once setup succeeds, only helm-controller's poller evaluates expressions: while a Helm action waits under the poller strategy, and for Helm hooks, which are still waited on when the annotation disables wait. Without the annotation, the legacy strategy never evaluates them. With it, hooks are evaluated whatever the strategy, because disabling wait takes precedence. The monitoring template comment now also distinguishes an existing status object without `updateStatus` from a completely absent top-level `status` key. The former evaluates the predicates to false, while the latter can produce an evaluation error and an Unknown result. The poller continues waiting in both cases. The CEL expressions and runtime behavior are unchanged. The generated ApplicationDefinition CRD description was regenerated from the Go field documentation. Fixes #4388 ### Screenshots N/A — no UI changes. ### 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 NONE ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Clarified when health-check expressions are validated and evaluated across wait strategies and Helm hooks, including how invalid expressions can affect Helm releases. * Explained how missing status fields affect health-check results and that polling continues until the resource is operational or times out. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
d88322197f |
chore(deps): roll up Renovate updates and raise dependencies to latest stable (#4869)
## What this PR does One PR instead of separate Renovate PRs. Go modules, Dockerfile base images and GitHub Actions move to newer versions that build and pass the tests. Where a newer version is known to break something, it stays behind, and `.github/renovate.json` holds it with the reason in the rule description. The tests come first, in their own commits: - `make go-unit-tests` runs the Go tests under `pkg/` and `cmd/`, except the backport-batch suite, which keeps its own target. The apiserver serializer and fuzz tests, the generated OpenAPI and applyconfiguration suites, the apis packages and the controller, operator and observability-proxy commands did not run in CI before. - The apps API surface that apiserver libraries shape is pinned: server-side apply, content negotiation, Table output on watch, the served OpenAPI v2 and v3 documents, and building the server without etcd. Two answers look wrong and are pinned as they are today: applies from different field managers never conflict (#4857), and protobuf is refused with 406 even when the client offers JSON as a fallback (#5297). - New tests cover the kubeovn webhook patch, the token proxy session cookie and the mount-utils behaviour the kubevirt CSI node service relies on. - `hack/image-smoke.bats` checks the tools the CSI, LINSTOR, multus, Harbor and redis-backup images take from their base images or build stages, and that the kubevirt CSI node plugin and its sidecars need no more than x86-64-v2. Each PR build job runs it against the images it pushed; forks and the unit lane run no container. The tests found two bugs: - The kubeovn webhook dereferenced a nil pointer on an admission review without a request, so the caller got a dropped connection instead of a 400. - The token proxy cookie refresh never fired: securecookie decodes the session times as int64 and the refresh looked for float64, so the `--cookie-refresh=1h` the chart sets did nothing. A refreshed cookie keeps the token's expiry. A session too large to encode now shows an error at sign-in and leaves the current cookie alone on refresh. What moved: - GitHub Actions to their Node 24 majors. The flux action stays on the tag of the Flux CLI it installs. The release job's checkout no longer persists credentials, so its staging branch push uses the App token. - Go 1.27.2 for the toolchain and builders. Builds that reproduce an upstream release keep the Go upstream uses: Harbor, cilium-operator, SeaweedFS and the chainsaw stage of the e2e sandbox. - controller-runtime v0.25.2, gateway-api v1.6.3 on the minor of the installed v1.6.1 CRDs, cel-go v0.30.0, grpc v1.84.0, etcd v3.7.2, cert-manager v1.21.2, kubevirt csi-driver f10ae94 on Kubernetes v0.37.1. - Node 24 for the dashboard console. Held back, each with its reason in the Renovate rule: - cel-go stays below v0.31: the old repository has no tags past v0.30.0, and v0.32 moves to cel.dev/cel-go, which k8s.io/apiserver does not import. - kube-openapi stays on the commit its dependencies require, and structured-merge-diff stays on v6, because k8s.io/apimachinery v0.37 does not compile against v7. - The Flux API modules stay on the Flux v2.8 line the platform installs. - gomodules.xyz/jsonpatch stays on v2, which controller-runtime's admission.Patched takes. - jwx stays on v3: v4 removes jwk.Cache, which the token proxy's JWKS refresh is built on. - kubevirt.io/api and the CDI API stay where upstream csi-driver builds. - The kubevirt CSI driver image stays on AlmaLinux 9, because AlmaLinux 10 builds its amd64 userland for x86-64-v3. - shadowbox stays on node 18, which outline-server declares in its engines. - The e2e sandbox stays on Ubuntu 24.04. 26.04 ships uutils coreutils, whose `date` costs about 4x per call, and the test harness forks it per traced line, which adds about ten minutes to the install phase. - clastix/kubectl stays on v1.32 for the cleanup hooks, within kubectl's one-minor skew. The cert-manager Go module (v1.21.2) is one minor ahead of the installed chart (v1.20.2). The Certificate objects the gateway controller writes serialize the same either way. `api/apps/v1alpha1` now requires Go 1.27.2, which applies to every module that imports the published types. The Linux run with Go 1.27.2 was done before the rebase onto current main, and the rebased head has not been through it yet. There the five modules built, vetted, tested and tidied cleanly, and the repository unit, controller and envtest lane passed. `go test -race` passed in four modules. In the root module it failed only on a pre-existing data race in the workload monitor tests (#5296), which main has too. The image smoke checks run in this PR's CI. ### Screenshots No UI change. ### Downstream repositories `api/apps/v1alpha1` moves to `go 1.27.2`, and cozystack/terraform-provider-cozystack imports it, so that repository is affected but needs no action. Its box stays empty for that reason, and so does the "not affected" one. - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: none needed, because its Renovate raises the go directive together with the pin bump and its CI takes Go from `go.mod`; the only effect is that the provider's minimum Go becomes 1.27.2. - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note chore(deps): move the toolchain and builder images to Go 1.27.2 and raise Go modules, base images and GitHub Actions to newer working releases; the dashboard token proxy now refreshes its session cookie, and the kube-ovn webhook rejects an admission review without a request instead of dropping the connection. ``` |
||
|
|
1d64d077e3 |
Merge branch 'main' into issue-4388
Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
a3e60ec372 |
feat(kafka)!: run on Strimzi 1.2.0 and Kafka 4.x (#4900)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Fixes merged to `main` reach the release lines the backport batch runs for automatically, so do not open backport PRs by hand: https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md --> ## What this PR does This upgrades the Kafka operator to Strimzi 1.2.0. Kafka 4.3 is the application default, with 4.2 also available. Upgrades must pass through Cozystack v1.7 and finish the ZooKeeper-to-KRaft migration first. The upgrade now stops while any Kafka lacks KRaft evidence. Every Kafka must report a nonempty `kafkaMetadataVersion` and the `KRaft` metadata state. The API conversion deletes that state, so without it a Kafka needs `Ready=True` or the `cozystack.io/kraft-verified` annotation, which migration 61 writes on every Kafka it accepts before it stops the operators. Any other explicit state blocks, and the error gives the reason for each Kafka. On every variant, the platform chart refuses to switch package sources while Strimzi still serves `v1beta2` and a Kafka fails that check. On variants without the migration hook, it also refuses while any Strimzi CRD still stores `v1beta2`, so `/migrations/61` has to run first. Migration 61 checks the same evidence again, including on repeat runs, and blocks unfinished broker-pool drains. A manual change that bypasses the managed package source is outside this check. Existing Kafka 3.x applications move to v4.3. Kafka 4 no longer accepts clients older than Kafka 2.1. Kafka 4 also rejects the topic settings `message.format.version`, `message.downconversion.enable` and `message.timestamp.difference.max.ms`, and a `segment.bytes` below 1 MiB (1048576), which Kafka 3.x accepted down to 14 bytes. A Kafka 4 broker whose log holds such a topic does not start. The chart now refuses to render a topic that sets any of these. The platform upgrade refuses to start while a Kafka application sets one, and migration 61 also checks KafkaTopic resources, so topics created outside the chart are caught too. A topic created through the Kafka admin API without a KafkaTopic is not visible to these checks. Restoring a topic-metadata backup taken on Kafka 3.x skips the three removed settings and raises a smaller `segment.bytes` to 1 MiB, with a warning for each. In-place downgrades are unsupported. The default 10-minute Helm timeout can leave a long broker roll Failed until its retry succeeds. The migration does not run automatically on every platform variant. Only the `isp-*` variants run it automatically. On other variants, run `/migrations/61` from the matching migrations image before upgrading, as the Kafka README describes. This includes clusters that run no Kafka but have the kafka-operator package, from the `paas` bundle or `bundles.enabledPackages`. Their Strimzi CRDs still store `v1beta2` even with no objects. The migration converts Strimzi resources and stored Helm references to `v1`. It stamps platform version 62. Running it manually also skips earlier migrations on a later move to an `isp-*` variant. Before it stops the operators, migration 61 refuses objects that the Strimzi 0.51 conversion tool would reject and names each one, for example a Kafka with `.spec.kafka.resources` or with OAuth, Keycloak or OPA settings. A failed conversion can leave the old operators stopped until the migration succeeds and the operator release upgrades. The failed conversion Job stays for diagnosis, but its ClusterRole, binding and ServiceAccount are removed. A Job that is still running when the wait times out keeps them, because the retry waits for it. Known limitations. Migration 61 converts with the old operator stopped, while Strimzi's conversion guide expects a running operator of 0.49 or later. I stop it because 0.45 keeps writing the Kafka status through `v1beta2`, but I have not checked this on a live cluster. Objects Strimzi created keep `ownerReferences` to `v1beta2` until Strimzi 1.2 reconciles them. Deleting a Kafka before that can leave dependents behind, and the chart's pre-delete hook covers only StrimziPodSets. The conversion image is pulled from quay.io by digest with no values override, so an air-gapped cluster has to mirror it under the same name. The full offline unit run passed on Linux on `1171d63adfafb45be34214fb9a0f565723e255fd`: 2,576 cases, no failures, errors or skipped tests. Later changes were checked on `69c704499fa4` with the Bats tests for migration 61, the migration runner, the Kafka hooks and the Kafka backup scripts (102), the platform Helm suite (310 tests) and the Kafka Helm suite (91 tests). After the rebase onto `main` at `5a5d5cd3d85f`, `a48a2f259947` passes the same Bats tests (115) and the platform and Kafka Helm suites (326 and 103 tests). It also passes the new check against added `documentIndex` selectors. I have not validated this revision on a live cluster. Closes #4365 ### Screenshots <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> Not a UI change. ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: https://github.com/cozystack/website/issues/805 - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: The Terraform provider does not model the Kafka `version` field. The website issue covers the upgrade notes the `default` variant needs. ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note feat(kafka)!: upgrade to Strimzi 1.2.0 and Kafka 4.3 by default, with Kafka 4.2 also available. Platform migration 61 converts Strimzi resources to v1 and moves Kafka 3.x applications to v4.3. Every Kafka must have confirmed KRaft state before the upgrade, including on repeat runs. Upgrade through Cozystack v1.7 first. Kafka 4 drops clients older than Kafka 2.1 and the message.format.version, message.downconversion.enable and message.timestamp.difference.max.ms topic settings, and requires segment.bytes of at least 1 MiB; the chart and the upgrade refuse a topic that breaks either rule, and a topic-metadata backup taken on Kafka 3.x restores without the removed settings and with segment.bytes raised to 1 MiB. In-place downgrades are unsupported. ``` |
||
|
|
87f160d473 |
fix(vm-disk, kubernetes-nodes)!: refuse golden images whose import keeps failing (#4802)
## What this PR does New clones can wait forever on a golden image whose import keeps failing. CDI v1.66.1 retries ordinary HTTP failures without setting phase `Failed`. The guards now also refuse goldens with at least three importer restarts unless they reached `Succeeded`. kubernetes-nodes and the picker require `Running=False`; vm-disk refuses during running attempts too. Existing vm-disks and already-cloned pools remain exempt. CDI never lowers the restart count, so a healthy import with three early restarts stays refusable until `Succeeded`, including while a recreated importer is still starting. An empty worker-pool StorageClass now resolves to the virtualization default, then the GA Kubernetes default. Beta is a last fallback for the class written explicitly onto a worker disk, not a CDI fallback. The strict same-class policy stays. This can refuse a previously accepted builtin pool on upgrade. The affected pool has an empty StorageClass, no cloned disk yet, and a golden on the Kubernetes default while another class is the virtualization default. StorageClass is immutable: point `osImage.builtin` at a catalog entry on the virtualization default or switch to `osImage.factory`. Already-cloned pools keep their disk's class. A VMDisk's own HTTP import, golden-image health checks and imports that hang without restarting remain outside this change. Closes #4564 Refs #4059 ### Screenshots No UI changes. ### Downstream repositories The platform values change only updates a comment. The application schema change updates the StorageClass description without changing fields, defaults or enums. - [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(vm-disk, kubernetes-nodes)!: refuse new clones of golden images whose import has not succeeded after at least three importer restarts. kubernetes-nodes and the image picker require the importer to be not running; vm-disk refuses during running attempts too. kubernetes-nodes now resolves an empty storageClass to CDI's virtualization default before the Kubernetes default. A builtin pool with an empty storageClass, no cloned disk yet, and a golden on a different class can now be refused. Point it at a catalog entry on the virtualization default or switch to osImage.factory. Already-cloned pools are unaffected. ``` |
||
|
|
638f0ffbe7 |
feat(redis): add affinity configuration (#2665)
<!-- 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 Adds independent Kubernetes affinity configuration for Redis and Sentinel pods through `RedisFailover.spec.redis.affinity` and `spec.sentinel.affinity`. Empty or null rules preserve operator defaults. Configured rules replace default soft pod anti-affinity; include `podAntiAffinity` when replica spreading is required. ### Validation - All 99 chart tests pass with helm-unittest v1.1.2; affected standalone API package compiles. - Package generation with cozyvalues-gen v1.7.0 is repeatable; embedded ApplicationDefinition schema matches the generated values schema. - Twenty-four offline render scenarios cover default/null/configured affinity and TLS on/off; Redis checks also cover independent component rules, single-replica Sentinel behavior, and preservation of upstream cache configuration. - Manifest generation, diff checks, and commit trailer checks pass. Each branch contains one feature commit rebased onto upstream main. - Root `make generate` remains blocked by the pinned code-generator parser rejecting Go 1.27's `math/rand/v2` generic method. Affected API deepcopy generation passes separately with controller-gen v0.16.4; unchanged files deleted by the failed root generator were restored. - cozyhr v1.6.1 is installed and checksum-verified. `make show` with `--plain` still queries Kubernetes discovery, which this environment cannot access; offline Helm rendering passes. ### Screenshots Not applicable; no UI changes. <!-- 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: https://github.com/cozystack/terraform-provider-cozystack/issues/85. Provider implementation is tracked separately from this application change. - [ ] [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(redis): add affinity configuration for Redis and Sentinel pods. ``` |
||
|
|
6efc0a0dc9 |
feat(rabbitmq): add affinity configuration (#2664)
<!-- 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 Adds optional Kubernetes affinity configuration to RabbitMQ pods through `RabbitmqCluster.spec.affinity`. Empty or null affinity keeps existing scheduling behavior. ### Validation - All 106 chart tests pass with helm-unittest v1.1.2; affected standalone API package compiles. - Package generation with cozyvalues-gen v1.7.0 is repeatable; embedded ApplicationDefinition schema matches the generated values schema. - Six offline render scenarios cover default/null/configured affinity and TLS on/off. - Manifest generation, diff checks, and commit trailer checks pass. Each branch contains one feature commit rebased onto upstream main. - Root `make generate` remains blocked by the pinned code-generator parser rejecting Go 1.27's `math/rand/v2` generic method. Affected API deepcopy generation passes separately with controller-gen v0.16.4; unchanged files deleted by the failed root generator were restored. - cozyhr v1.6.1 is installed and checksum-verified. `make show` with `--plain` still queries Kubernetes discovery, which this environment cannot access; offline Helm rendering passes. ### Screenshots Not applicable; no UI changes. <!-- 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: https://github.com/cozystack/terraform-provider-cozystack/issues/84. Provider implementation is tracked separately from this application change. - [ ] [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(rabbitmq): add support for configuring RabbitMQ pod affinity rules. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added an optional affinity setting to control where RabbitMQ pods are placed, including anti-affinity rules to spread pods across nodes. * Configured affinity rules are applied to RabbitMQ pods. When affinity is empty or unset, no affinity rules are added. * **Documentation** * Updated RabbitMQ configuration guidance to describe the affinity setting, its empty default, and how to use anti-affinity to distribute pods across nodes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
3b65cebea3 |
feat(kafka)!: run on the Strimzi v1 API and Kafka 4.x
Strimzi 1.2 serves only the v1 API and runs Kafka 4.2 and 4.3. The node-pool hook no longer drives the ZooKeeper to KRaft migration or the drain that freed the shared "kafka" pool name: Strimzi 1.x has no ZooKeeper support, and the platform migration refuses to upgrade while a ZooKeeper cluster is left. A cluster migrated earlier keeps its "kafka" broker pool. Without the drain the hook takes seconds, so the seven-hour install timeout goes too. Kafka 4 rejects the topic configs it removed and a segment.bytes below 1 MiB, which Kafka 3.x accepted. A KafkaTopic that sets one stays NotReady while the release reports Ready, so the chart refuses to render such a topic. It reads segment.bytes the way Kafka does: trimmed, with an optional sign, leading zeros decimal. BREAKING CHANGE: the Kafka application accepts version v4.3 (default) and v4.2; v3.8 and v3.9 are gone, and the platform migration moves existing applications to v4.3. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
b6ef231d44 |
docs(kubernetes-nodes): state why a pool must share its golden's class
The worker image guard, its error message and the storageClass docs said CDI cannot clone across StorageClasses and always falls back to a host-assisted copy. CDI falls back only when the two claims have different CSI drivers or volume modes; with one driver it asks that driver for a clone into the other class. The guard stays, the reason it gives is corrected, and the docs name the virtualization default class an empty storageClass now resolves to. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
0d239fab81 |
Merge branch 'main' into feat/kubernetes-nodes-talos-sysctls
The generated cozyrds file is regenerated from the merged values.yaml. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
977963dda2 |
feat(redis): add affinity configuration
Signed-off-by: kastakhov <16296930+kastakhov@users.noreply.github.com> Assisted-by: LLM |
||
|
|
a0f85886f2 |
feat(rabbitmq): add affinity configuration
Signed-off-by: kastakhov <16296930+kastakhov@users.noreply.github.com> Assisted-by: LLM |
||
|
|
ee0071dd1b |
chore(deps): update Go modules and move them to go 1.27.2
The five Go modules move to go 1.27.2. The root module moves to controller-runtime v0.25.2, gateway-api v1.6.3 on the minor of the installed v1.6.1 CRDs, grpc v1.84.0, etcd v3.7.2, cert-manager v1.21.2 and newer golang.org/x modules; prometheus/client_golang v1.25.0 raises klauspost/compress to v1.20.1 by minimal version selection. kubevirt-csi-driver builds upstream csi-driver f10ae94 against Kubernetes v0.37.1, with its require and replace now naming the same commit, kubeovn-webhook moves to client-go v0.37.1, and token-proxy to newer releases of its dependencies. Several stay behind, each for a stated reason. cel-go stops at v0.30.0: its old repository has no tag past it, and v0.32 declares a module path k8s.io/apiserver does not import. kube-openapi past the pinned commit needs structured-merge-diff v7, which k8s.io/apimachinery v0.37 does not compile against. The Flux API modules stay on the Flux v2.8 line the platform installs. kubevirt.io/api and the CDI API stay on the releases upstream csi-driver builds against, and jwx stays on v3 because v4 removes the jwk.Cache the proxy's JWKS refresh uses. cert-manager v1.21 drops the deprecated ObjectReference alias, so the gateway controller names IssuerReference directly; the Certificate objects serialize the same for the installed v1.20 chart. gateway-api marks SchemeGroupVersion deprecated, so a gateway test builds its GroupKind from GroupName. api/apps/v1alpha1 moves to go 1.27.2 with the rest, so a module that imports the published types needs Go 1.27.2 or later. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
7e069356b9 |
Merge branch 'main' into feat/kubernetes-nodes-talos-sysctls
Generated files (types, README, schema, cozyrds) are regenerated from the merged values.yaml. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
2568db67b1 |
Merge branch 'main' into fix/kubernetes-nodes-surge-before-drain
Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
aa36d3fad6 |
fix(kubernetes)!: remove the talos block and other leftovers of the worker pool split (#5191)
## What this PR does Cleanup after the Kubernetes app was split into `Kubernetes` (control plane and addons) and `KubernetesNodes` (one release per worker pool): what the split left behind in values, docs, templates and tests. ### Kubernetes The `Kubernetes` application has no `talos` field any more. Worker pools are `KubernetesNodes` resources and take their Talos release, image, installer and registry mirrors from their own `talos` and `osImage`, so the cluster's copies did nothing. The last one, `talos.version`, fed a duplicate of the Talos to Kubernetes support-matrix check. The pool chart already runs that check against the Talos release each pool actually boots, including one picked through an `osImage` override; the cluster's copy compared the Kubernetes version against a release no node runs. A stored spec that still carries `talos.*` keeps rendering, because the values schema does not close the object and the API does not validate `spec` against it, and a unit test pins that. The pool's check now has render coverage. Its own suite pins the pairings it must accept, and a bats test renders the refusals through `talos.version`, `osImage.factory.version` and `osImage.builtin.version` with schema validation skipped, since the schema offers no Kubernetes version the matrix refuses. I fixed the README and field descriptions that described behavior the chart no longer has, or never had: a dedicated etcd cluster, a `blockSize.matchVolume` setting that does not exist, a default `md0` pool, the host default, the substrate mismatch behavior, and rollout phase names. The README's Breaking Changes section becomes a pointer to the per-release upgrade notes on cozystack.io. Unused helpers and stale comments are removed; the chart renders the same bytes. ### KubernetesNodes Five field descriptions and the `talos` block told users to keep them in sync with parent fields that do not exist. NOTES warned about colliding with a parent-managed `md0` pool, although the parent renders no pools and `md0` is the normal name of a pool. The installer image was credited to an upgrade Job that never runs one. The values descriptions, README intro and NOTES now say what the chart renders today, including which fields have no effect on `substrate: proxmox`: `storageClass`, `diskSize`, `instanceType`, `talos.imageFactoryURL` (beyond its format check) and `talos.imageFactoryCA`. The render error for a pool whose MachineDeployment belongs to another release told users to remove the pool from the parent's `nodeGroups`, which cannot clear the conflict. It now names a remedy that works. Split-era history is gone from Helm and test comments, along with two `storageClass` fallbacks that can only return the value they fall back from, a constant variable, and two `.helmignore` rules that match nothing. The tenant pod and service CIDRs are literals in both charts, and nothing checked that they agree. A new bats test renders both charts and fails when they differ. No rendered manifest of the pool chart changes. I rendered it for the snapshot values, GPU, kubelet-override, factory/CA, storageClass variants and three Proxmox variants on main and on every commit, and the output is byte-identical. The snapshot and TalosConfigTemplate hash tests pass unchanged, so no worker rolls. YAML comments inside the hashed machine config and machine template are left as they are for that reason. ### The rule `docs/agents/overview.md` gains a rule so this does not come back with the next change: app READMEs and field descriptions describe current behavior, a change users must act on goes to the website's upgrade page, and a description does not ask the reader to keep it in sync with another chart. ```release-note [kubernetes] The Kubernetes application no longer has a `talos` field. Talos settings for workers, and the Talos to Kubernetes compatibility check, live on each KubernetesNodes pool. Existing clusters that still store `talos` values keep working; the values are ignored. KubernetesNodes field descriptions, README and install notes now describe the worker pool as it works today, including which fields have no effect on Proxmox pools. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Configuration** * Worker OS image, installer, and registry-mirror settings are configured per worker pool; these settings are no longer available at the cluster level. * Kubernetes and Talos version compatibility is checked for each worker pool. A worker Kubernetes version cannot be ahead of its parent cluster. * Worker pools support KubeVirt and Proxmox, with pool-specific sizing and disk settings. * Rendering is refused when a pool uses a different substrate from its cluster or conflicts with an existing worker pool owned by another release. * The default cluster hostname now includes the `kubernetes-` prefix. * Existing cluster configurations that still include Talos settings receive a warning; those settings are no longer used. * **Documentation** * Updated guidance for cluster and worker-pool settings, storage, upgrades, and version compatibility. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
f61cfdf0b8 |
feat(bucket)!: add publicRead to serve a bucket without credentials (#5252)
<!-- 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 Adds `publicRead` to the Bucket application. A bucket cannot serve its objects without a signature today: every BucketAccess issues a key, and those keys grant neither `WriteAcp` nor `PutBucketPolicy`, so `aws s3api put-bucket-acl --acl public-read` is refused and a tenant has no way to serve static assets (images, downloads) straight from a bucket. The only workaround is an operator running `weed shell` `s3.anonymous.set` by hand, which nothing reconciles and which outlives the bucket. With `publicRead: true` the chart renders one more BucketAccess, `<bucket>-public-read`, on a new `-public` BucketAccessClass whose `accessPolicy` is `public-read`. The class is added in the three places that define access classes: the Client topology, the per-storage-pool classes, and the vendored chart (through its existing `cosi-bucket-class-lock-readonly.patch`). The COSI driver handles the policy by adding `Read:<bucket>` to the gateway's `anonymous` identity and, on revoke, removing only that action, so turning the flag off or deleting the bucket closes it again without touching other public buckets. Anonymous callers can `GET`/`HEAD` objects at `<endpoint>/<bucket>/<key>`; listing and writes stay refused. A user named `public-read` would own the same BucketAccess name, so that combination fails to render with an explicit message rather than having two owners fight over one object. The seaweedfs pool name check now also reserves `public` and the `-public` suffix, next to the existing `-lock` and `-readonly`: a pool `<x>-public` would render a readwrite BucketAccessClass with the same name as pool `<x>`'s public-read class, and a pool `public` would take the instance's own `-public` class. This is a breaking change for an instance that already defines a pool with such a name: its seaweedfs release stops rendering with the pool name error. Pool keys are part of the volume server and PVC names, so renaming such a pool moves its data to new volumes; that migration is the operator's to plan before upgrading. **Known limitation until the next driver release.** On v0.5.0, revoking public read (turning `publicRead` off or deleting the bucket) can leave the bucket readable anonymously if an S3 gateway migrates `identity.json` while the revoke is in flight: the migrated `identities/anonymous.json` keeps `Read:<bucket>`, and SeaweedFS loads it over `identity.json` without ever repairing it. The fix is seaweedfs/seaweedfs-cosi-driver#22 (the revoke always writes `anonymous.json`, after the legacy file). The driver release carrying it will be pinned here if it lands before this PR merges, otherwise in a follow-up. Until then, an operator can check `s3.anonymous.list` in `weed shell` after a revoke and clear a leftover with `s3.anonymous.set -bucket <bucket> -access none`. **Driver: pins the upstream seaweedfs-cosi-driver v0.5.0.** The `public-read` policy merged upstream in seaweedfs/seaweedfs-cosi-driver#21 and v0.5.0 is tagged on that merge, so this PR moves the image pin from v0.4.0 (#5284) to v0.5.0 in `packages/system/seaweedfs/values.yaml`, the client-mode `.tag` file and `cosi_image_test.yaml`. An earlier revision of this branch built the driver in-tree while no release carried the policy; that build is gone, and the intermediate commits that added it are undone by the merge of `main`, so squashing leaves only the feature and the pin. v0.5.0 differs from v0.4.0 only by the `public-read` policy (seaweedfs/seaweedfs-cosi-driver#21) and its README note. Upstream documents one `public-read` BucketAccess per bucket as the supported shape, which is what the chart renders. Tested: new helm-unittest suites for the bucket app (default off, class name with and without storage pool, locked bucket, coexistence with users, the name collision), the seaweedfs extra chart (Client and storage-pool classes) and the vendored chart; they fail when the class suffix or the policy is removed. `helm unittest` passes on `packages/apps/bucket`, `packages/extra/seaweedfs`, `packages/system/seaweedfs` and `packages/system/bucket`, as do `test-guard-fail-closed` and `test-image-version`; `cosi_image_test.yaml` pins `ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.5.0`, which is published for amd64 and arm64. The anonymous-read mechanism itself was checked by hand on SeaweedFS 4.45 (`weed shell` `s3.anonymous.set -access Read`): anonymous `GET` returns 200 on both gateways, `ListObjects`/`ListObjectsV2` and `PUT` return 403, and the identity survives grants and revokes of regular BucketAccesses. The end-to-end path through the new driver has not run on a cluster yet. ### 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. --> - [ ] 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#80 - [ ] [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: the only hit is the new field in `packages/apps/bucket/values.schema.json` (and `api/apps/v1alpha1/bucket/types.go`), which the Terraform provider models by hand. Follow-up filed as cozystack/terraform-provider-cozystack#80. The website's bucket page is hand-written and could mention the flag, but no listed trigger covers an added field, so it is left unticked. ### 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(bucket): add `publicRead` to serve a bucket's objects without credentials at `<endpoint>/<bucket>/<key>`. Anonymous callers can read objects but cannot list the bucket or write to it. The COSI driver is bumped to seaweedfs-cosi-driver v0.5.0, which adds the `public-read` access policy. The seaweedfs pool names `public` and `*-public` are now reserved: an instance that already defines such a pool fails to render until the pool is renamed, which moves its data to new volumes. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Bucket configurations can enable anonymous reads of objects through the bucket endpoint. Anonymous access does not allow listing buckets or writing objects. * SeaweedFS provides public-read access classes across supported bucket configurations, alongside read-only and read-write access. * Added a retained bucket class with object locking and a 365-day compliance retention period. * **Documentation** * Added guidance for the `publicRead` setting, which is disabled by default. * **Updates** * Updated the SeaweedFS COSI driver to v0.5.0. Pool names `public` and names ending in `-public` are reserved. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
6f8171db89 |
fix(workloadmonitor): report a bucket's workloads not ready until its claim is provisioned (#5096)
## What this PR does A Bucket app reports WorkloadsReady=True while its BucketClaim is never provisioned. On a v1.6.5 cluster a tenant got a BucketClaim for bucket class `tenant-root`, the root tenant there runs no SeaweedFS, and for three days the claim had no status while the objectstorage controller kept emitting `FailedCreateBucket` with `bucketclasses.objectstorage.k8s.io "tenant-root" not found`. The Bucket app showed Ready and WorkloadsReady the whole time. The WorkloadMonitor controller already writes a Workload per BucketClaim with `Operational` set from `status.bucketReady`, but the monitor itself counts only pods. The bucket chart renders its monitor with `replicas: 0` and `minReplicas: 0`, so the monitor stays operational whatever happens to the claim. The monitor now names every selected BucketClaim that is not provisioned in `status.message`, sets `status.reason` to the new `BucketClaimNotReady` and turns `Operational` false, the same way it already reports a DataVolume that is not ready. A DataVolume verdict keeps the fields when both apply. BucketClaims are listed on every pass, so a stored BucketClaim verdict is recomputed rather than kept like an unread DataVolume verdict, and it clears once the claim is provisioned. Any monitor whose selector picks a BucketClaim follows its readiness, which is what the Workload objects already say. The Application then shows WorkloadsReady=False with that message and reason. Its Ready condition keeps following the HelmRelease, as `pkg/registry/apps/application/rest.go` intends. Three new tests cover a provisioned claim, a claim not provisioned with and without a class, a claim outside the selector, the verdict clearing after provisioning with and without a DataVolume reader, and the DataVolume verdict winning over the BucketClaim one. Against the controller on main the four not-provisioned and clearing cases fail and the rest pass. `go test ./internal/controller/...` and `go vet` pass. `make generate` does not run on my machine, gengo fails to parse the go1.27.1 standard library, so I ran the controller-gen `object` and `crd` steps of `hack/update-codegen.sh` for `./api/v1alpha1/...` directly. The deepcopy file is unchanged and the generated WorkloadMonitor CRD matches `packages/system/cozystack-controller/definitions/cozystack.io_workloadmonitors.yaml`. I have not run the change on a live cluster. #5083 changes the Workload names of the same BucketClaims and does not touch the monitor status, so the two do not overlap. ### Screenshots Not a UI change. ### Downstream repositories The controller, one exported constant and its tests. No CRD schema, values key, default, telemetry metric or package change, so no trigger map entry applies. - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note fix(workloadmonitor): a Bucket app reports WorkloadsReady=False with reason BucketClaimNotReady while its BucketClaim is not provisioned, instead of WorkloadsReady=True. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Workload monitors now report when a selected bucket claim is not provisioned and mark the monitor as non-operational. Status messages include the bucket class when available and list multiple unprovisioned claims in sorted order. * **Bug Fixes** * The bucket-claim status clears when the claim is provisioned or no longer selected. When DataVolume information is available, its status takes precedence over the bucket-claim status. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
5fe356f57e |
fix(postgres): accept a standard five-field backup schedule (#5119)
## What this PR does The postgres app hands `backup.schedule` to a CloudNativePG `ScheduledBackup`, and the field asks for the six-field CloudNativePG cron with leading seconds. The mongodb app takes a standard five-field cron in the same field, and so do backup Plans and the Plan form in the console, so tenants copy a value from one app into the other and support has to explain the difference. CloudNativePG does not reject a five-field value. CloudNativePG 1.30.0, which main pins, parses the schedule with `cron.Parse` from robfig/cron v1.2.0 in both the ScheduledBackup webhook and the controller. That parser takes five or six fields, reads the first one as seconds and makes day-of-week optional, and the webhook only returns a warning when the count is not six. CloudNativePG's own webhook test "warn the user if the schedule has a wrong number of arguments" covers this with `1 2 3 4 5`. So `0 2 * * *`, meant as every day at 02:00, fires every hour at minute 2, and `5 * * * *` fires every minute. The chart now counts the fields. A five-field value gets a leading `0` seconds field, so `0 2 * * *` renders `0 0 2 * * *`. A six-field value and a descriptor such as `@daily` or `@every 6h` render exactly as before. Any other field count fails the render with a message that shows both forms, where before it reached the webhook and was rejected there. An empty schedule still renders no ScheduledBackup. The field description that the dashboard form shows and the README now name both forms. One thing changes on upgrade. A release that already sets a five-field value gets the standard meaning of it, so `0 2 * * *` moves from hourly to daily. Before this change such a value was outside the documented format and drew the webhook warning. `packages/system/keycloak` renders its own CloudNativePG ScheduledBackup from its `backup.schedule`, with a six-field default and a values comment that says so. It is a platform component with its own template, so it is not changed here. The other apps with a backup schedule (mongodb, mariadb, clickhouse) and backup Plans already take five fields. - Ran robfig/cron v1.2.0 `Parse` locally from 10:00:00. `5 * * * *` fires at 10:00:05, 10:01:05 and 10:02:05, and `0 2 * * *` at 10:02:00 and 11:02:00. With the leading `0` they fire at 10:05:00 and 11:05:00, and daily at 02:00. - Rendered the whole chart with helm 3.17.3 and the `configured` render fixture. The output matches main for the defaults, for `0 2 * * * *` and for `@daily`, and for `0 2 * * *` only the `schedule` line differs. Unit tests with `helm unittest` 1.1.2, the version CI pins. `packages/apps/postgres` passes 216 of 216 in 27 suites, against 209 in 26 on main. The new suite has seven cases. With the old template five of them fail. The six-field and descriptor cases pass on both, and they fail when the template prepends to six fields too or drops the descriptor check. ### Screenshots Not a UI change. The dashboard form picks up the new field description from the schema. ### Downstream repositories Walked the trigger map in `docs/agents/contributing.md` against the diff. A chart template, a new test suite, one field description and the README, schema, Go types and cozyrd regenerated from it. No field is added, removed or renamed and no default or enum changes. The terraform provider does not model `backup.schedule`. The website reference page for postgres is generated from this README on a stable tag, and the Go types example there uses a six-field schedule, which keeps working. - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note fix(postgres): backup.schedule accepts a standard five-field cron such as 0 2 * * *, and the chart prepends a 0 seconds field before handing it to CloudNativePG, which reads the first field as seconds. Six-field values and descriptors render as before, and any other field count fails the render. A release that already sets five fields gets the standard meaning on upgrade, so 0 2 * * * moves from hourly to daily. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * PostgreSQL backup schedules support standard five-field cron expressions as well as six-field expressions with a leading seconds field. Five-field schedules are converted automatically; six-field schedules and cron descriptors are used as provided. * **Schedule Changes** * After upgrading, `0 2 * * *` runs daily at 02:00 instead of hourly at minute 2. To keep the previous hourly schedule, use `0 2 * * * *`. * Invalid schedule formats produce a rendering error. Empty schedules continue to disable chart-managed backups. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
24f2b8009f |
feat(redis): add maxmemory, eviction policy and snapshot toggle (#5310)
## What this PR does Lets a tenant run Redis as a pure cache without giving up the persistent volume. Until now the chart only turned snapshots off together with the volume (when `size` is empty), and offered no way to bound memory: a `CONFIG SET maxmemory` is lost when the pod restarts. On a cache-only instance, RDB snapshots and replica full syncs then filled the volume, and each SIGKILL during a save left an orphaned `temp-*.rdb` behind, so the instance crashlooped. New values: - `maxmemory` (quantity, unset by default): rendered in bytes. Unset renders `maxmemory 0`, the Redis default (no limit). - `maxmemoryPolicy` (enum, default `noeviction`): rendered as `maxmemory-policy`. - `snapshots` (bool, default `true`): `false` renders `save ""` while keeping the volume. Snapshots stay off when `size` is empty, as before. Every directive is rendered with an explicit value, defaults included. The operator applies `customConfig` with `CONFIG SET` on every reconcile and never resets a directive whose line disappears (`service/redis/client.go` in freshworks-oss/redis-operator v3.3.5), so leaving the defaults implicit would turn reverting a setting into a no-op until the next pod restart. As a consequence, existing instances gain `save 3600 1 300 100 60 10000`, `maxmemory 0` and `maxmemory-policy noeviction` on upgrade. These equal the Redis 7 and 8 defaults, but they overwrite any value an operator set by hand with `CONFIG SET`. `maxmemory` is refused at render time above 90% of the Redis memory request: above that threshold (`reservedPodMemoryPercent`, default 10) the operator logs an error and skips the line, which would leave Redis unbounded with nothing visible to the tenant. Not changed here: a replica still writes a temporary RDB to disk during a full sync (`repl-diskless-load` defaults to `disabled`), even with `snapshots: false`. `stop-writes-on-bgsave-error` keeps its default, since no background save runs once snapshots are off. Tests: `tests/cache_config_test.yaml` covers the rendered defaults, the snapshot toggle with and without a volume, byte conversion from presets and explicit resources, and both refusals. `helm unittest packages/apps/redis` passes (93 tests). ### Screenshots Not a UI change. ### Downstream repositories The new fields in `values.schema.json` reach `cozystack/terraform-provider-cozystack`, whose redis schema and expand/flatten pair are hand-written; no follow-up has been opened there yet, so the box is left unticked. The website reference page is regenerated from `README.md` by the release bot. - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note feat(redis): add `maxmemory`, `maxmemoryPolicy` and `snapshots` values so Redis can run as a pure cache (bounded memory, eviction, no RDB snapshots) while keeping its persistent volume. Existing instances now render the Redis defaults for these directives explicitly, which resets any value set by hand with `CONFIG SET`. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added configurable Redis memory limits, with a default of unlimited, and eviction policies, defaulting to `noeviction`. Configured limits must be whole-byte quantities and cannot exceed 90% of the pod’s memory request. * Added controls for scheduled Redis snapshots. Snapshots are enabled by default when storage is configured; disabling them does not remove existing snapshot files, and snapshots are off when storage size is empty. * **Documentation** * Documented the new Redis memory and snapshot settings, including defaults, constraints, and effects. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
e8c8fa3ec7 |
Merge branch 'main' into fix/workloadmonitor-bucketclaim-ready
Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
97e0618258 |
Merge branch 'main' into fix/postgres-backup-schedule-five-fields
Regenerate the postgres ApplicationDefinition schema on top of main. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
21fd2b7b69 |
feat(bucket): add publicRead to serve a bucket without credentials
A bucket cannot serve its objects without a signature: every BucketAccess issues a key, and the keys grant neither WriteAcp nor PutBucketPolicy, so a tenant cannot open the bucket themselves with put-bucket-acl. Static assets then need a proxy, presigned URLs or an operator running weed shell by hand, which no reconcile tracks and which outlives the bucket. publicRead renders one more BucketAccess on a new -public access class whose accessPolicy is public-read. The COSI driver handles that policy by adding Read:<bucket> to the gateway's anonymous identity and removing only that action on revoke, so deleting the bucket or turning the flag off closes it again without touching other public buckets. Anonymous callers can read objects but cannot list the bucket or write to it. The access is named <bucket>-public-read, the name a user called public-read would take, so that combination fails to render instead of fighting over one BucketAccess. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
56224a156c |
feat(virtual-machine): let each disk set its own boot order (#5266)
## What this PR does
A `vm-instance` boots from its disks in the order they appear in
`disks`: the template hardcodes `bootOrder: {{ add $i 1 }}`. Booting
from installer or rescue media, such as an ISO attached as a CD-ROM next
to the system disk, therefore means moving that media to the front of
the list, and anything that treats `disks[0]` as the system disk then
finds the ISO there instead.
This adds an optional `bootOrder` to each entry of `disks`:
- When set, it is the disk's boot priority (1 is tried first),
independent of its position in the list.
- When unset, the disk keeps its positional order (`index + 1`), so
existing VMs render exactly as before.
- The values schema requires `bootOrder >= 1`.
- Duplicate effective boot orders are refused at render time with the
names of both disks, rather than surfacing as a KubeVirt admission error
on the VirtualMachine. This includes an explicit value colliding with
another disk's positional one, so booting from a CD-ROM in second
position means setting both disks:
```yaml
disks:
- name: system
bootOrder: 2
- name: install-iso
bus: sata
bootOrder: 1
```
`make generate` was run in the package, so the README,
`values.schema.json`, the Go type in `api/apps/v1alpha1/vminstance`
(with its regenerated deepcopy, since the field is a pointer) and the
`vm-instance-rd` OpenAPI schema are all updated.
A new suite, `tests/disk_boot_order_test.yaml`, mocks the DataVolumes
the template looks up and covers: positional order when no disk sets
`bootOrder`; a CD-ROM in second position booting first while the list
order and volumes stay unchanged; an explicit value colliding with a
positional one; two equal explicit values; and a value below 1 rejected
by the schema. Run against the previous template, the CD-ROM and
collision cases fail. `helm unittest packages/apps/vm-instance`: 6
suites, 77 tests passing.
### Screenshots
No UI change.
### Downstream repositories
- [ ] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [ ]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up:
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:
This adds a field to `vm-instance`'s `values.schema.json`, which the
trigger map routes to `cozystack/terraform-provider-cozystack`: its
`vminstance_schema.go` and `vminstance_model.go` model `disks` by hand,
so `bootOrder` needs adding there. The follow-up has not been opened yet
and the box is left blank until it is linked. The website reference page
is regenerated from the README by the release bot; nothing else in the
map is touched.
### Release note
```release-note
feat(virtual-machine): disks in a vm-instance accept an optional `bootOrder`, so a VM can boot from an attached ISO or other rescue media without reordering its disks. Unset keeps the previous positional boot order.
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **New Features**
* Configure a boot priority for each VM disk. Lower values are tried
first; disks without an explicit priority use their position in the disk
list.
* Disk priorities must be unique, and values below 1 are rejected.
Priority changes do not reorder disks or their associated volumes.
* **Documentation**
* Added guidance and an example for configuring disk boot priorities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
||
|
|
d308e9e5e5 |
fix(redis): refuse sub-byte maxmemory and apply the policy first
A quantity such as 512m is 0.512 bytes; the integer cast truncated it, or -512m, to 0, which Redis reads as no limit, so the bound a tenant set could vanish without an error. The operator also sends the directives in list order, and lowering maxmemory below the dataset evicts at once, so the policy has to be set before the bound. Turning snapshots off does not remove an RDB already on the volume, which Redis still loads on restart; the parameter no longer says the data is lost. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
0f16bf9c73 |
feat(redis): add maxmemory, eviction policy and snapshot toggle
A Redis used purely as a cache had no durable way to bound its memory or stop writing RDB snapshots: the chart only disabled snapshots together with the persistent volume, and a CONFIG SET is lost when the pod restarts. Snapshots and replica full syncs then filled the volume and left the instance crashlooping. maxmemory, maxmemory-policy and save are always rendered with an explicit value, because the operator applies customConfig with CONFIG SET on every reconcile and never resets a directive whose line disappears; leaving the defaults implicit would make reverting a setting a no-op until the next pod restart. maxmemory is refused above 90% of the memory request, the threshold above which the operator silently skips the line and leaves Redis unbounded. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
7d9f913350 |
feat(kubernetes): configure per-pool Talos sysctls
Worker sysctl requirements extend beyond user namespaces. A string map keeps those settings in the Talos machine config without expanding the application API for each kernel knob. Tenant input crosses an unquoted shell heredoc in the reconcile Job, so preserve scalar contents without allowing shell or YAML injection. Assisted-by: LLM Signed-off-by: Michel Jansen <mjansen@whero.xyz> |
||
|
|
8a45b3dd94 |
docs(kubernetes-nodes): describe the worker pool as it works today
The pool's field descriptions, README and NOTES still read as if the pool lived inside the kubernetes chart: five fields told the user to keep them in sync with parent fields that do not exist, NOTES warned about colliding with a parent-managed md0 pool although the parent renders no pools and md0 is the normal name of a native pool, and the installer image was attributed to an upgrade Job that never runs one. A user of the API, the dashboard form or the published README reads these descriptions to decide what a field does, so they now say what the chart renders, which fields have no effect on a Proxmox pool, and how the reservations and the support matrix actually behave. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com> |
||
|
|
fb8a7ef278 |
docs(kubernetes): describe the cluster as it is and drop the history
The README told users two things the chart does not do: that it deploys a dedicated etcd cluster (the control plane uses the tenant's etcd, which the Tenant deploys), and that worker disks match the volume's block size through blockSize.matchVolume, a setting that exists nowhere in the tree. It also described worker nodes as KubeVirt VMs managed by this application, while they are KubernetesNodes pools on KubeVirt or Proxmox, and offered "patch versions" where the user picks a minor. The Breaking Changes section was a release log: entries from several releases, most of them about fields that live on KubernetesNodes now, and each one written as a change rather than as the current behaviour. What a user has to do on upgrade belongs on the per-release upgrade page of the website, so the README points there and keeps only the storageClass immutability note, rewritten as current behaviour. The field descriptions are what the dashboard, the API schema and a rejected name show the user, and several were written against how the application used to work. The name limit was explained by a default md0 pool that no longer exists, while the 32-character cap leaves room for any three-character pool name. The host default left out the kubernetes- prefix the release name carries. A substrate mismatch with a pool was said to leave Machines unreconciled, while the pool refuses to render. The OIDC type carried a roadmap phase in its title, and extraArgs promised "no change to current behavior". The name-cap test looked for "md0" in the rejection message as its sign that the chart's explanation arrives; it looks for the release-name pattern the new explanation gives. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com> |
||
|
|
90f0b043a6 |
fix(kubernetes)!: remove the talos block the chart no longer uses
The kubernetes chart declared a talos block (version, schematicID, imageFactoryURL, installerRepository, registryMirrors). Workers are KubernetesNodes pools and take every one of these from their own talos values, so an operator who set them on the cluster got no error and no effect. The only reader left was a copy of the Talos to Kubernetes support-matrix check, and the pool chart already runs that check itself, against the Talos release each pool actually boots, including one an osImage override selects. The cluster's copy compared the Kubernetes version against a Talos release no node runs. The block leaves the API schema, hence the "!". Stored specs that still carry it keep rendering: the values schema does not close the object and the API does not validate spec against it. A helm-unittest case pins that. Readers outside the chart moved with it. The e2e install read talos.schematicID from this chart's values.yaml in a best-effort block that only warns, so removing the field would have stopped the image cache being seeded without failing anything; it now reads the pool chart, as the proxmox template script already does. The e2e no longer writes a talos block into the Kubernetes CR, the spec test checks the pool chart for the key it emits, the release checklist diffs the pool chart's pins as well, and the catalog guard drops the two tests that compared or read the parent's block. The null-normalization Go tests used talos keys of the real Kubernetes schema as their fixtures; they use oidc.mode, the same required-with-default shape under an optional root section, and addons.cilium.valuesOverride for the free-form case. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com> |
||
|
|
d48897cf82 |
feat(virtual-machine): let each disk set its own boot order
The boot order of a VM's disks was the order of the disks list, so the only way to boot from installer or rescue media, such as an ISO attached as a CD-ROM, was to move that media to the front of the list. Callers that treat the first disk as the system disk then see the ISO in its place. An optional bootOrder per disk decides boot priority independently of the list. Disks that leave it unset keep their positional order, so existing VMs render unchanged. Duplicate effective boot orders are refused at render time with the names of both disks, since KubeVirt would otherwise deny the VirtualMachine with a less specific error. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
0f44cf9e25 |
feat(backups): add Kubernetes backup strategy for tenant clusters
A tenant Kubernetes application had no backup route in cozy-default, and none of the existing strategies fits it. Its API state is a key prefix in the etcd DataStore the whole tenant shares, so the Etcd strategy's snapshot would roll every tenant cluster back at once; its control-plane CA, service account key and Talos secrets cannot be regenerated without breaking every node and credential issued under them; and its PersistentVolumes are DataVolumes in the tenant namespace that the application's own deletion removes. The new Kubernetes strategy backs up the cluster's etcd prefix with a Job that authenticates with the cluster's own datastore certificate, and the PKI Secrets and data DataVolumes with Velero. The HelmReleases of the cluster and its node pools are recorded on the Backup rather than in Velero, because a label selector for them would also pick up the worker system disks. A backup warns when a CA would expire before the backup does. A restore rebuilds a deleted cluster under its old CA, or rolls a live one back after stopping its control plane and workers, and lets the etcd prefix and the volumes be restored separately. Signed-off-by: Andrey Kolkov <androndo@gmail.com> Assisted-by: LLM |
||
|
|
b53ca1fede |
fix(postgres): refuse system databases and never drop them (#5155)
<!-- 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
`databases` accepts `postgres`, `template0` and `template1`, and the
init job treats them like application databases: it comments them
`database managed by helm`, creates `<db>_admin` and `<db>_readonly`,
makes `<db>_admin` the owner of the database and its schemas, and
installs the `trigger_auto_grant` event trigger. When the entry later
leaves values, the delete pass runs `DROP DATABASE` on it, which can
only fail:
- `template1`, `template0`: `cannot drop a template database`;
- `postgres`: `cannot drop the currently open database`, since the job
is connected to it.
The init job then fails on every upgrade, so the HelmRelease sits in
`UpgradeFailed` with `post-upgrade hooks failed`, and putting the entry
back does not help. `template1` also hands the takeover (owner of
`public`, default privileges, trigger) to every database created
afterwards. Once its roles are dropped by hand, the trigger left behind
names a role that no longer exists, so `CREATE SCHEMA` fails in every
new database, even as superuser.
This PR:
- **Refuses** the three names at render with a message that says what to
do. `cozyvalues-gen` has no way to constrain the keys of a
`map[string]Database`, so the refusal sits next to the existing
database-name guard, like the `users.postgres` refusal. The field
description says it too.
- **Never selects them for `DROP DATABASE`.** The delete pass excludes
them whatever values say.
- **Hands a taken-over system database back.** In a new `release system
databases` pass before the delete pass, for each of the three still
commented `database managed by helm`: drop the trigger and
`auto_grant_schema_privileges()`, `REASSIGN OWNED` / `DROP OWNED` for
its two roles in that database, give `public` back to
`pg_database_owner` (PostgreSQL 15+), and clear the comment. The
existing orphaned-roles pass then drops the roles; it never visits
`template1`, hence the per-database step. `template0` accepts no
connection and the job that commented it never got further, so only its
comment is cleared.
**Upgrade note.** A release that declares one of the three names fails
to render until the entry is removed. Removing it is now safe: the next
run releases the database instead of dropping it.
**Testing**
- `tests/system_databases_test.yaml`: 5 of its 6 cases fail on `main`
without the change. `helm unittest packages/apps/postgres`: 215 passed.
- I replayed the scenario against a `postgres:17` container, running the
rendered `init.sh` with `PGUSER=postgres`:
1. The `main` script with `databases: {appdb, template1, postgres}`
reproduces the takeover.
2. The `main` script with only `appdb` then fails with `cannot drop the
currently open database`.
3. This branch's script on that same state exits 0. It releases both
databases (owner `postgres`, no comment, no event trigger, `public`
owned by `pg_database_owner`) and drops `postgres_admin`,
`postgres_readonly`, `template1_admin` and `template1_readonly`. A
database created afterwards gets no trigger, and `CREATE SCHEMA`
succeeds in it.
4. A second run is a no-op.
5. A `template0` commented and given roles by hand is released the same
way.
Open PR #5091 touches the same script (stable database order); the hunks
do not overlap.
Backport: the automatic cherry-pick onto `release-1.6` conflicts in
`init-script.yaml` and the generated cozyrd, so the backport to
`release-1.6` is done by hand in #5157 (same SQL, replayed against that
branch's script). `release-1.7` keeps `kind/backport`.
### 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 (walked the
map: a template guard, the init script, a test suite and one field
description regenerated into README, schema, Go types and cozyrd; no
field, default, enum or name 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(postgres): databases now refuses the PostgreSQL system databases postgres, template0 and template1, and the init job never runs DROP DATABASE on them. A system database a previous version took over is handed back to the superuser on the next upgrade (event trigger removed, ownership and public schema restored, its <db>_admin and <db>_readonly roles dropped). A release that declares one of them must remove the entry before upgrading.
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **Behavior Changes**
* PostgreSQL system databases (`postgres`, `template0`, and `template1`)
are refused as managed application databases.
* Previously managed system databases are released during cleanup and
excluded from database deletion. Cleanup restores eligible ownership and
security settings and clears system database comments.
* **Documentation**
* Updated PostgreSQL configuration guidance to clarify that these system
database names are refused. Names that merely contain these strings
remain accepted.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
||
|
|
f003851338 |
fix(postgres): refuse system databases and never drop them
postgres, template0 and template1 were accepted in databases and handled like an application database. The init job made <db>_admin their owner, installed the auto-grant event trigger in them and, once the entry left values, ran DROP DATABASE on them. That DROP can only fail (template databases cannot be dropped, and the job is connected to postgres), so every later upgrade failed in the init job and the release stayed in UpgradeFailed even after the entry was put back. template1 also passed the takeover on to every database created from it afterwards, where the trigger, naming a role about to be dropped, makes CREATE SCHEMA fail. A release a previous version let take one of them over has to be repaired without dropping it, and without touching what this chart did not create: a role or owner that merely carries an expected name may belong to a tenant or an administrator, and a role comment can be set by any CREATEROLE holder, so only the cozystack:managed mark is trusted. What the marked roles own goes to cozystack:orphaned rather than to the superuser, since a tenant's SECURITY DEFINER function would otherwise run with superuser rights. A failed lookup of the databases cloned from template1 has to stop the run before template1 stops being selected, or those clones would never be repaired. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
23461e065d |
fix(redis): run one Sentinel when Redis runs a single pod (#5151)
<!-- 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 chart pins `spec.sentinel.replicas: 3` whatever `replicas` says, so an instance created with `replicas: 1` runs one Redis pod and three Sentinel pods that have nothing to fail over to. This makes the Sentinel count follow the data pods: one Sentinel when `replicas` is 1, three otherwise. The operator cannot run zero Sentinels (freshworks `Validate()` resets `sentinel.replicas <= 0` to 3), and it needs at least one to locate the master. With one Sentinel its quorum is `replicas/2+1` = 1, so the single Sentinel works on its own. The operator also gives the Sentinel Deployment a PodDisruptionBudget with `minAvailable: 1` whenever Redis has two replicas or fewer (`ensurePodDisruptionBudget` in `operator/redisfailover/service/client.go`). On a single Sentinel that budget refuses every eviction and would block node drains, so the chart sets `sentinel.disablePodDisruptionBudget: true` in that case only. The Sentinel `WorkloadMonitor` now expects the rendered count instead of a fixed 3/2. The operator only stops ensuring that PDB once the flag is set; it never deletes the one it created while three Sentinels ran (`EnsureSentinelDeployment` in freshworks v3.3.5). An existing instance scaled to one replica would keep it, so `templates/hooks/sentinel-pdb.yaml` adds a post-upgrade hook that deletes `rfs-<release>`, with a Role scoped to that one name. It renders on upgrade only, since a fresh one-replica install never gets that PDB. From `replicas: 2` up nothing changes. Scaling an existing instance between 1 and 2 replicas scales the Sentinel Deployment between 1 and 3 accordingly. Not in scope: with `replicas: 1` the Redis data pod keeps its own operator PDB (`minAvailable: 1`), which already blocks drains of its node today; that is unchanged here. Tests: `tests/sentinel_replicas_test.yaml` covers 1, 2, 3 and the default, the PDB switch, and the `WorkloadMonitor`. Three of its cases fail on `main` without the template change. `tests/sentinel_pdb_hook_test.yaml` covers the hook. `helm unittest packages/apps/redis`: 79 passed. Open PR #4990 also edits `redisfailover.yaml` (Sentinel spreading); the two touch different keys. Backport: `release-1.7` ships the same freshworks operator and CRD, so `kind/backport` applies. `release-1.6` is not backportable as is: it still runs spotahome `v1.3.0-rc1`, whose vendored CRD (chart 3.3.0) does not declare `sentinel.disablePodDisruptionBudget`, and the operator's CRDs are installed with Flux's default `crds: Create` policy, so they are never updated on an existing cluster. The API server would prune the field and the single Sentinel would keep a `minAvailable: 1` PDB that blocks node drains. A 1.6 fix would need a CRD update path first. ### Screenshots <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> ### 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 (walked the map: the diff changes a template, a test, and the wording of two descriptions; no field, default, enum or name changes) - [ ] [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(redis): an instance with `replicas: 1` now runs one Sentinel instead of three, without a Sentinel PodDisruptionBudget; on upgrade, the PDB the operator created earlier is deleted. Instances with two replicas or more are unchanged. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Redis deployments configured with one replica now use one Sentinel; other replica settings continue to use three. * Workload monitoring now reflects the configured Sentinel count. When changing to one replica, upgrades remove the Sentinel PodDisruptionBudget. * **Documentation** * Updated Redis configuration guidance to explain how Sentinel count varies with the replica setting and clarify Sentinel resource defaults. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
525e416134 |
fix(kubernetes-nodes): let ComputePlane pools set maxUnavailable and bound it to int32
The ComputePlane wrapper forwards only the pool fields it names, and maxUnavailable was not one of them. A ComputePlane pool without room for one extra VM therefore had no way back to the drain-first rollout, and its rollouts stalled. CAPI decodes maxUnavailable as an int32, so a value above 2147483647 passed the chart schema and was then refused by the MachineDeployment decoder. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
523d74a503 |
fix(backups): retry instead of failing when an existing Backup cannot be read
When Create collides with a Backup an earlier reconcile already made and the read that follows fails, the drivers failed the BackupJob, although the backup and its Backup both exist. Return a distinct error instead, which the drivers hand back to the controller so the reconcile is retried with backoff and then finds the Backup. minio.New already refuses an endpoint with a path prefix and accepts a trailing slash, so drop the duplicate check in the shared client; the CNPG probe keeps its own check because it parses the URL itself and would otherwise drop the path before minio sees it. Say in the sizeBytes API doc what the value covers, such as the base backup without the shared WAL archive for CNPG, and that strategies which cannot attribute stored bytes to one backup leave it unset. Assisted-by: LLM Signed-off-by: Andrey Kolkov <androndo@gmail.com> |
||
|
|
d4ad5612d3 |
fix(backups): report sizeBytes for MariaDB backup artifacts
Backup.status.artifact.sizeBytes was only ever set by the etcd strategy, so MariaDB backups always arrived without a size. mariadb-operator writes each logical dump as <prefix>/backup.<RFC3339>[.<compression>].sql under a prefix shared by every backup of the application, and the URI the driver records is synthetic, so there is no single object to HEAD. On completion the driver now lists the prefix with the tenant credentials the operator Backup was rendered with and takes the size of the one dump whose timestamp falls inside the operator Backup's lifetime. When the bucket cannot be read or the window does not match exactly one dump, the field stays unset. The API doc now states that an absent sizeBytes means "unknown", and the Velero strategy documents why it leaves the field unset: kopia stores data content-addressed across backups, so there is no per-backup stored size. Refs #4316 Assisted-by: LLM Signed-off-by: Andrey Kolkov <androndo@gmail.com> |
||
|
|
4087218a02 |
docs: move the repo-only guides onto the website (#5034)
## What this PR does Seven guides under `docs/` were operator facing and written alongside the code, and left in the source tree where no user looks. They are on the website now, so this deletes them here and repoints every reference. ``` docs/operations/backup-classes.md -> operations/services/backup-classes docs/operations/resource-presets.md -> guides/resource-management docs/storage-immutability.md -> operations/storage-class-immutability docs/operations/system-memory-limits.md -> operations/configuration/system-memory-limits docs/gateway-classes.md -> networking/gateway-classes docs/observability/distributed-tracing.md -> operations/services/monitoring/distributed-tracing docs/operations/seaweedfs-capacity-for-backups.md -> operations/services/object-storage/capacity-for-backups ``` `docs/release.md`, `docs/deprecating-applications.md` and the two SeaweedFS runbooks in `docs/operations/` stay. A workflow, `AGENTS.md`, a migration and a bats suite read them by path, which is the test from #3777. References point at `https://cozystack.io/docs/v1/...`. The site rewrites that short prefix to the latest version in `layouts/404.html`, so the links follow releases and pin none. Backup Classes, resource management and `storageClass` immutability exist in the latest version already. The other four pages are only in `next/` until 1.7.0 is promoted, and their links start to resolve then. The generated mongodb files come from `values.yaml` through `make generate` with cozyvalues-gen v1.7.0, the version pinned in `.github/workflows/pre-commit.yml`. Tests: helm unit tests for mongodb (151), postgres (209), vm-disk (114) and kubernetes-nodes (223), go tests for backupcontroller, presets and the operator, rd-presets-check, the migration-50 bats suite. ### Downstream repositories - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: cozystack/website#763 Walked the rest of the trigger map against the diff. No provider follow-up: the mongodb `values.schema.json` diff is one `description` string, with no field added, removed or renamed, no enum, no default, and no `kind`, `plural` or `release.prefix` change. `packages/core/platform/values.yaml` changed in comments only and no key, so the hand written platform-package table on the site is unaffected. Please merge after cozystack/website#763, the links in the code only resolve once those pages deploy. ### Release note ```release-note docs: seven guides move from the docs/ directory of this repository to cozystack.io (Backup Classes, resource presets, storageClass immutability, system component memory limits, GatewayClass selection, distributed tracing, SeaweedFS capacity for backups), and in-repo references point there. ``` |
||
|
|
ed40d83323 |
docs(kubernetes): say a worker rollout needs room for one extra VM
With maxUnavailable 0 a pool short of quota or capacity for the replacement VM stalls its rollout instead of shrinking. The field description, which also feeds the API and dashboard documentation, now says so and names maxUnavailable: 1 as the way out. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
670f33d68c |
feat(kubernetes): let a worker pool set its rollout maxUnavailable
A Proxmox template that passes a GPU through leaves gpus empty, so the chart renders maxUnavailable 0 for that pool and its replacement VM waits for the GPU the old worker still holds. The pool can now say so itself with maxUnavailable, which overrides the 0, or 1 with gpus, that the chart derives otherwise. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |