mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 20:23:39 +09:00
0d239fab81a78396a5525fb573120b0b8dcccdde
428
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
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> |
||
|
|
9d33037566 |
fix(workloadmonitor): keep a bucket not ready until its claim is provisioned
A bucket WorkloadMonitor has no pods and minReplicas 0, so it stayed operational, and the Bucket app stayed Ready, while its BucketClaim was never provisioned. A tenant whose nearest S3 ancestor runs no SeaweedFS gets a claim for a bucket class that does not exist, and the dashboard showed a ready bucket that was never created. Assisted-by: LLM Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> |
||
|
|
48779cc03b |
fix(redis): run one Sentinel when Redis runs a single pod
The chart pinned three Sentinels whatever the replica count, so a single-pod instance paid for three pods that have nothing to fail over to. One Sentinel is enough for the operator to locate the master: its quorum is replicas/2+1, which is 1. The operator gives the Sentinel Deployment a PodDisruptionBudget with minAvailable 1 whenever Redis has two replicas or fewer. On a single Sentinel that budget refuses every eviction and would block node drains, so it is disabled in that case. From two Redis pods up nothing changes: three Sentinels, budget kept. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
f7913329b2 |
fix(kubernetes-nodes): plan autoscaler capacity on the cores the VM actually gets
On the kubevirt substrate resources.cpu is written into domain.cpu.cores as spelled and decoded as YAML, so "010" gives the VM eight cores, while the cluster-autoscaler capacity annotation parsed the same string as decimal ten. The autoscaler then planned 9000m on a node that offers 7000m. Keep the YAML-decoded value the range check already computes and start the capacity annotation and the reserved-CPU check from it on kubevirt. The kubelet reservations stay as they are: the worker machineconfig sizes them from the decimal string, and the TalosConfigTemplate name is a hash of that config, so changing them would roll every leading-zero pool once. The annotation therefore subtracts the reservations the machineconfig really carries (2 x 500m for "010") from the cores the VM really has, which is the node's real allocatable. Neither template name changes for any spelling, so no pool rolls. Proxmox parses the quantity as decimal on both sides and is unchanged. The field description says the value is decoded as YAML and that the reservations still read it as a decimal. This closes #4554 without the migration and the render-time refusal it proposes: a refusal breaks stored pools on their next upgrade, a schema pattern breaks updates of existing CRs, and a platform-wide migration of every KubernetesNodes and nodeGroups entry is a lot of blast radius for a spelling nobody has reported in a live cluster. Closes #4554 Signed-off-by: Marian Koreniuk <moriarti@cp.if.ua> Assisted-by: LLM |
||
|
|
982db83dd2 |
fix(postgres): accept a standard five-field backup schedule
The mongodb app and backup Plans take a standard five-field cron, but the postgres chart hands backup.schedule to a CloudNativePG ScheduledBackup, which parses it with robfig/cron v1 Parse. That parser reads the first field as seconds and makes day-of-week optional, so a five-field value passes admission with only a warning and runs one field off. 0 2 * * * runs hourly and 5 * * * * every minute. A five-field schedule now gets a leading 0 seconds field. Six fields and descriptors pass through, and any other field count fails the render. A release that already sets five fields gets the standard meaning on upgrade, so 0 2 * * * goes from hourly to daily. Assisted-by: LLM Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> |
||
|
|
448b12657b |
fix(foundationdb): stop offering the 7.1 line
The FoundationDB operator no longer carries the 7.1 client, so it can neither manage nor upgrade a 7.1 cluster. The version map offered v7.1 all the same; it now lists the lines the operator carries, 7.3 and 7.4, which is also what hack/update-versions.sh reads from the operator chart. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com> |
||
|
|
d62056ef03 |
fix(foundationdb)!: pick the version from a fixed list
cluster.version took any string and passed it to the operator as the FoundationDB version, so a tenant chose the image tag rather than a supported release line. The application now takes version (v7.4, v7.3, v7.1) and maps it to a tag through files/versions.yaml, the same way postgres and mariadb do. The lines are the ones the pinned operator ships client libraries for, which hack/update-versions.sh reads from the operator chart. The map keeps v7.3 on 7.3.63, the previous default, so a cluster that never set the version renders exactly as before. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com> |
||
|
|
941b50c675 |
fix(kubernetes-nodes)!: drop the kubectl image override
images.kubectl picked the image of the talos-reconcile and pre-delete unpin Jobs. Both run in the management cluster under service accounts that read the pool's Talos and cluster CA secrets and patch its CAPI objects, so a tenant-chosen image ran with access the apps API never grants. The image now always comes from images/kubectl.tag. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com> |
||
|
|
af20694359 |
fix(kubernetes)!: drop the helper image overrides
images.waitForKubeconfig, images.kubectl and images.talosCsrSigner ran whatever image a tenant named inside the management cluster: the csr signer as a sidecar of the tenant control plane with the Talos CA key mounted, the other two in pods holding service account tokens for CAPI, KubeVirt and Cilium objects in the tenant namespace. A tenant never gets that access through the apps API, and the platform should not hand it over through an image field. The images now always come from the bundled tag files. A release that still carries the keys renders exactly as one without them. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com> |
||
|
|
6f8a04c11a |
fix(opensearch)!: drop the custom image override
images.opensearch put any image a tenant named into the OpenSearchCluster, so the platform ran that binary in its own cluster and the version map stood behind nothing. The application offers a choice of version; the image now always comes from that version. A release that still carries the key renders as if it were absent: the operator rolls the nodes onto the image of the selected version. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com> |
||
|
|
b83cc087cc |
docs: move the repo-only guides onto the website
Seven guides in docs/ were written next to the code and left in the source tree, where no operator looks. The website carries them now, so a second copy here only lets the two drift again: the Backup Classes page had already fallen behind its original. docs/release.md, docs/deprecating-applications.md and the two SeaweedFS runbooks in docs/operations stay. A migration, a bats suite, a workflow or AGENTS.md reads each of them by path, which is the test for keeping a document in this repository. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com> |
||
|
|
3cd261277e |
fix(backups): keep the backupstrategy-controller Helm release under the Secret size limit (#4941)
## What this PR does Fixes a size regression from #4929. Helm stores each release revision in one Secret and the apiserver refuses a Secret over 1 MiB. With all default Strategy CRs rendered the `backupstrategy-controller` release crosses that limit, so the forced upgrade that creates them fails with `Secret "sh.helm.release.v1.backupstrategy-controller.vN" is invalid: data: Too long: may not be more than 1048576 bytes`, the CRDs stay and the default strategies never appear. The release was already within about 1 KB of the limit before #4929, which added tests to the chart. The strategy CRDs are 2.2 MB of YAML and Helm stores them twice per revision, as chart files and in the rendered manifest. Almost all of it is the upstream `PodTemplateSpec` schema inlined by the Altinity, Job and FoundationDB strategies. Kafka, RabbitMQ and Redis already mark their `Template corev1.PodTemplateSpec` as `Schemaless` and `PreserveUnknownFields`, this PR does the same for `AltinitySpec.Template`, `JobSpec.Template` and `FoundationDBTemplate.BackupDeploymentPodTemplateSpec`. Go types are unchanged and every description is kept. The CRDs go from 2.2 MB to 317 KB and the largest release revision from over the limit to about 250 KB, 24% of it. The size rationale now lives once in the package doc, the field docs of the six schemaless templates share one short line. What changes for users: the apiserver no longer validates these three fields and `kubectl explain` no longer lists children under them (`kubectl explain pod.spec` still documents them), same as for Kafka, RabbitMQ and Redis today. Unknown keys are stored instead of pruned, the typed decode in the drivers drops them either way. Labels and annotations under `template.metadata` were rejected by the strict v1.6 schema and are now accepted and kept. A Go template in a non-string slot never worked, it was rejected on apply, now the apiserver accepts it and the typed decode in the controller is what rejects it, as for the other three kinds (I did not run that case live). The drivers read these fields through the non-strict client and `internal/template` rewrites only string leaves, nothing under `internal/backupcontroller` relies on pruning. Go tests for `internal/backupcontroller`, `internal/template` and `api` pass. `hack/strategy-crd-schemaless.bats` fails on any strategy CRD that inlines a pod schema and prints the property path and the two markers to add. `hack/helm-release-size.bats` estimates the stored release of every chart under `packages/` the way Helm encodes it (release JSON, gzip, base64) and fails above 90% of the limit, plus the worst case of this chart. The estimate runs 1 to 2 percent above real Secrets. A chart has to render offline to be measured with its manifest: the 36 charts that do not are listed in `NO_OFFLINE_RENDER` and measured on files and templates only, any other render failure fails the test, and so does a listed chart that starts rendering. Checked on a throwaway kind cluster: v1.6.4 upgrades to this branch and the forced follow-up creates all default strategies, a fresh install works, strategy objects created under the old schema stay valid, a Job strategy with templated args and pod template labels is accepted. ### Downstream repositories - [x] No downstream repository is affected by this change ### Release note ```release-note fix(backups): the backupstrategy-controller release no longer fails with "Secret ... Too long" on the upgrade that creates the default backup strategies, the Altinity, Job and FoundationDB strategies store their pod templates schemaless like Kafka, RabbitMQ and Redis ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Backup strategy templates for Altinity, FoundationDB, Jobs, Kafka, RabbitMQ, and Redis now preserve fields not defined in the API schema. The API server no longer validates these templates against the pod schema; validation occurs when the driver creates the workload. This lets strategies include pod-template fields without requiring those fields to be listed in the strategy schema. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
2f6c6a27b8 |
fix(backups): store the Altinity, Job and FoundationDB pod templates schemaless
backupstrategy-controller renders its strategy CRDs from templates, so Helm stores each of them twice in every release revision, and a revision is one Secret capped at 1 MiB. The Altinity, Job and FoundationDB CRDs each inline the full upstream PodTemplateSpec schema, about 600 KB apiece; once the default Strategy CRs render as well, the stored release no longer fits and the forced upgrade that creates them fails with "Secret ... is invalid: data: Too long". The Kafka, RabbitMQ and Redis strategies already carry their pod template schemaless for this reason. Give the three older fields the same markers. The Go types stay typed, the drivers decode the template as before, and the apiserver still validates the pod when the driver creates the workload; every description is kept, and the largest revision drops to about a quarter of the limit. The rationale moves to the package doc, so the six field docs only tell the reader what schemaless means for them. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com> |
||
|
|
f3486f4e3a |
docs: move the operator guides out of docs/ to where readers find them
Five guides in docs/ were written next to the feature code that needed them and left in the source tree, where no operator looks. They are on the website, so a second copy here only drifts: edits kept landing in docs/ after the website copy was made. docs/vm-external-vlan.md is split rather than moved. Its section on staging the reference CNI plugins is a contract that hack/cni-plugins-staging-contract.bats asserts against the multus Dockerfile, the daemonset manifest and the platform values, so that half is package documentation and goes to packages/system/multus/README.md, which the suite now reads. The operator half goes to the website. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com> |
||
|
|
0c2f131192 |
feat(backups): back up Valkey with the Redis strategy
Valkey runs on the same spotahome RedisFailover operator as Redis and speaks the same replication protocol and RDB format, so it needs no strategy kind of its own. The only difference the backup Job sees is the chart's resource-name prefix: valkey-<app> instead of redis-<app> for the sentinel Service and the auth Secret. The Redis driver now accepts applicationRef kind Valkey as well as Redis and hands the template .Release.Prefix, derived from the app's kind, which cozy-default-redis uses for every name it builds. A kind with no known prefix fails the render instead of producing an empty one. cozy-default routes apps.cozystack.io/Valkey to cozy-default-redis. A restore must target an app of the same kind as the backup's source: replaying a Redis dump into Valkey, or the reverse, is not something the strategy can promise across engine releases. The shipped template reads the prefix as `.Release.Prefix | default "redis-"`: during an upgrade the previous controller, which has no Prefix in its render context and serves only Redis, renders the new CR, and a bare reference would print "<no value>" into the names. The redis:8 image already loads RDB v11, which both shipped Valkey versions (7.2, 8.1) write. Signed-off-by: Andrey Kolkov <androndo@gmail.com> Assisted-By: LLM |
||
|
|
0c62bee4da |
feat(bucket): add a ui flag to skip the s3manager web UI
Every bucket ships an s3manager Deployment with its Service and an Ingress or HTTPRoute on <bucket>.<tenant host>. Tenants that only use the S3 API pay for a pod per bucket and for one DNS name and TLS certificate per bucket, none of which they need. ui defaults to true, so existing buckets keep their UI. With ui set to false the bucket no longer needs the tenant apex either, since the UI hostname was its only consumer in the bucket-system chart. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
8be7fb2e66 |
feat(redis): expose min-replicas-to-write and min-replicas-max-lag
Lets an operator bound the writes lost when an isolated Redis master is failed over: the master refuses writes while fewer replicas than configured are connected and recent. Both values are unset by default, so the rendered Redis config is unchanged. Redis treats 0 in either directive as disabling the check, so the chart refuses minReplicasMaxLag 0 next to a replica requirement instead of silently turning the protection off. Negative values are refused by the schema (minimum 0), since Redis rejects them at CONFIG SET and the operator would stop healing the Sentinels of that instance. A requirement of replicas or more is refused at render: a master with replicas pods has replicas-1 replicas, so it would refuse every write for good. Assisted-by: LLM Signed-off-by: Yasar Rahman <yasar.rehman@gmail.com> |
||
|
|
9a88afe6ca |
feat(redis): run Sentinel on the same image as the Redis pods
The Sentinels were left on redis:6.2.6-alpine when the operator moved to the freshworks-oss fork, so that its new compiled-in default could not move them on upgrade. 6.2 is end of life, and every instance now runs a Sentinel one or two major versions behind the Redis it monitors. The rollback risk behind that pin, a newer engine rewriting dump.rdb in a format the older one cannot load, does not apply to Sentinel. It stores no RDB or AOF, only sentinel.conf on an emptyDir that the config-copy init container rewrites from the operator's ConfigMap on every start, so moving back to an older image starts from a clean config. Taking the image from the same version map as the data pods also means one image per node instead of two. The e2e comment that relied on busybox's timeout exit code in the Sentinel container is updated, since that container now carries coreutils. Signed-off-by: Yasar Rahman <yasar.rehman@gmail.com> Assisted-by: LLM |
||
|
|
df2e1c33e1 |
feat(kubernetes-nodes): build the Proxmox worker template from the pool's Talos values (#4742)
## What this PR does
A `substrate: proxmox` pool clones its workers from a VM template the
chart never sees: capmox selects it by `proxmox.templateTags`, and the
pool's `talos.*` values reach only the installer written into the worker
machineconfig. Nothing in the repository says which image that template
has to carry, and the image an operator reaches for is the wrong one:
- The release asset `nocloud-amd64.raw.xz` is built from
`packages/core/talos/images/talos/profiles/nocloud.yaml`, the bare-metal
node image. Its `zfs` extension starts `ext-zfs-service`, which waits
for `/dev/zfs`. A VM never has it, so `startAllServices` never finishes,
and Talos fails the boot sequence and reboots the guest each time the
boot timeout runs out. On our v1.13.6 stand that was every ~70 minutes,
visible in the tenant only as `SandboxChanged` on every Pod (218 cilium
restarts in 12 days); from the Proxmox side the VM never restarts. The
same profile also follows the host nodes' Talos (v1.14.2 since
|
||
|
|
f093273736 |
feat(redis): size the Sentinel pods separately from Redis (#4832)
## What this PR does
The Redis application renders `spec.sentinel.resources` from the same
`resources`/`resourcesPreset` pair as the Redis pods. Every instance
runs three Sentinels, so it reserves three extra copies of a Redis
replica's memory for processes that hold only their configuration and
the failover state. The dataset that drives the Redis sizing never
reaches a Sentinel.
On our Cozystack v1.6.4 staging cluster, an HA Redis on `t1.nano`
reserves 3 x 128Mi for its Sentinels. The VPA recommender
(recommendation mode only) gives an uncapped target of 16Mi for the
`sentinel` container. On a `u1.small` instance the same three Sentinels
would reserve 3 x 4Gi.
This PR adds an optional `sentinel` block with the same two keys the top
level has:
```yaml
resourcesPreset: u1.small
sentinel:
resources:
cpu: 100m
memory: 64Mi
# resourcesPreset: t1.nano
```
Resolution rules:
- `sentinel` empty (the default): the Sentinels keep the Redis sizing
(`resources` + `resourcesPreset`). Existing instances therefore render
exactly as before and an upgrade does not roll their Sentinels.
- `sentinel.resourcesPreset` set: the Sentinels use that preset.
Explicit top-level `resources` are not carried over, since they were
sized for the dataset.
- `sentinel.resources` set: it wins. Any key it leaves out is filled
from `sentinel.resourcesPreset`, which falls back to `resourcesPreset`.
- The Sentinel `WorkloadMonitor` label
`workloads.cozystack.io/resource-preset` now carries the preset the
Sentinels actually use. The Redis `WorkloadMonitor` is unchanged.
Changes:
- `values.yaml`: new `Sentinel parameters` section (`@typedef Sentinel`,
`@param {Sentinel} [sentinel]`, default `{}`), reusing the existing
`Resources` and `ResourcesPreset` types so the enum and quantity
validation is the same as the top-level pair.
- `templates/redisfailover.yaml`: computes the Sentinel preset and
resources once and uses them for `spec.sentinel.resources` and the
Sentinel `WorkloadMonitor` label.
- `README.md`: generated table rows plus a short hand-written `sentinel`
section next to `resources and resourcesPreset`.
- Generated: `values.schema.json`, `api/apps/v1alpha1/redis/types.go`
(new `Sentinel` struct, `ConfigSpec.Sentinel`),
`api/apps/v1alpha1/redis/zz_generated.deepcopy.go`,
`packages/system/redis-rd/cozyrds/redis.yaml`.
- `tests/sentinel_resources_test.yaml`: 10 helm-unittest cases covering
the rules above and an unknown preset being refused.
I chose not to change the default sizing. A smaller default (for example
a fixed small preset for Sentinel) would save more for everyone, but it
would also roll every instance's Sentinels and change what tenants are
billed for on upgrade. If maintainers prefer that, it is a one-line
follow-up on top of this change.
Testing done:
- `make generate` in `packages/apps/redis` with cozyvalues-gen v1.7.0
(the version `pre-commit.yml` installs); regenerated files committed.
- Deepcopy: `controller-gen object` v0.16.4 on `api/apps/v1alpha1` (the
last step of `hack/update-codegen.sh`), only the redis package changed;
`go build ./...` and `go vet ./redis/` pass in that module, `go mod
tidy` leaves no diff. I could not run the full root `make generate` on
my machine: code-generator v0.37.1 fails to parse the Go 1.27.1 standard
library (`math/rand/v2: method must have no type parameters`), which is
a host toolchain problem unrelated to this change. CI's `codegen-drift`
job should confirm.
- `make test` in `packages/apps/redis` (helm-unittest v1.1.2): 58
passed. With the template change reverted, 4 of the new cases fail (the
ones that set `sentinel.*`); the cases that pin today's behaviour pass
both ways.
- Rendered output with no `sentinel` block is identical to `main` (all
documents except the random-password Secret) for the defaults,
`resourcesPreset=u1.small`, and explicit `resources` (cpu 1, memory
2Gi).
Backwards compatibility: purely additive. The field is optional with an
empty default, existing instances render unchanged, and nothing rolls on
upgrade. Clients that do not know the field are unaffected.
### Screenshots
Not a UI change. The dashboard form gets a `sentinel` object from the
schema like other nested parameters (e.g. `tls`).
### 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:
Trigger map walked against the diff: this adds a field to
`values.schema.json`, so `cozystack/terraform-provider-cozystack` needs
to model `sentinel.resources` / `sentinel.resourcesPreset` in its Redis
resource. I will open that issue once this PR has a number and link it
here; a draft is in `FOLLOWUP-terraform-provider-redis-sentinel.md`. The
website page for `redis` is regenerated from `README.md` by the release
bot (`redis` is in the website `APPS` list), so no manual follow-up
there. Nothing else in the map is touched.
### Release note
```release-note
feat(redis): new optional `sentinel.resources` and `sentinel.resourcesPreset` parameters size the three Sentinel pods independently of the Redis pods. When unset, Sentinels keep the Redis sizing as before, so existing instances are unchanged.
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added independent CPU and memory resource settings and sizing presets
for Redis Sentinel pods.
* When Sentinel-specific settings aren’t provided, Sentinel pods inherit
Redis resource settings. Unspecified Sentinel resource values can use
the Sentinel preset, which defaults to the Redis preset.
* Added configuration documentation and validation for Sentinel resource
settings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
||
|
|
bbd39c94a4 |
feat(kubernetes-nodes): build the Proxmox worker template from the pool's Talos values
A proxmox pool clones its workers from a VM template the chart never sees, and nothing said which Talos image that template has to carry. The one an operator reaches for, the platform release's nocloud-amd64.raw.xz, is the bare-metal node image: its zfs extension's service waits for a /dev/zfs no VM has, the boot sequence never completes, and Talos reboots every worker each time the boot timeout runs out, about every 70 minutes on v1.13. It also follows the host nodes' Talos version, not the pool's talos.version that the installer in the worker machineconfig names. The chart's default schematic has a trap of its own: its qemu-guest-agent service waits the same way for the agent's virtio port, which Proxmox adds only to a VM with the agent enabled. hack/proxmox-talos-template.sh builds the template from the chart's talos.schematicID and talos.version in the nocloud flavour with the agent enabled, refuses a tag set another template already carries, because capmox then finds two and clones neither, and prints the templateTags that select it. Assisted-by: LLM Signed-off-by: Marian Koreniuk <moriarti@cp.if.ua> |
||
|
|
08ee470f6a |
fix(postgres)!: refuse plaintext sessions on external instances (#4847)
## What this PR does CloudNativePG offers TLS on an external Postgres but does not require it. Its built-in last `pg_hba` rule is `host all all all`, which matches TLS and non-TLS connections alike, so a client outside the cluster that connects with `sslmode=disable` gets an unencrypted session. The chart's `tls.enabled` only decides whether the external hostname goes into the certificate, so it cannot prevent this. This is #4619. When `external: true`, the chart now renders `spec.postgresql.pg_hba`: ```yaml pg_hba: - hostssl all all all scram-sha-256 # md5 on PostgreSQL 13, matching CloudNativePG's default rule - host all all all reject ``` CloudNativePG puts user rules after its fixed rules (`local` peer, `streaming_replica` and pooler `cert`) and before its default `host all all all` rule, and PostgreSQL uses the first matching rule, so the two lines above make remote sessions TLS-only without touching replication or the metrics exporter. See the CloudNativePG [`pg_hba` section](https://cloudnative-pg.io/documentation/current/postgresql_conf/#the-pg_hba-section) and the [template](https://github.com/cloudnative-pg/cloudnative-pg/blob/v1.30.0/pkg/postgres/configuration.go) for v1.30.0, the operator version the platform ships. A new tri-state `tls.required` follows the same pattern as `tls.enabled`: when omitted it follows `external`, `false` opts out, `true` requires TLS on an in-cluster instance too. The issue is silent on a switch; I added one because the change is breaking and a tenant with a client that cannot do TLS needs a way back that does not mean patching the operator's resources. In-cluster clients: the pod network cannot be told apart from an external client (the external Service uses `externalTrafficPolicy: Local`, so the source IP is the client's), so the rules apply to every remote client. The chart's init job connects to `<release>-rw` with libpq's default `sslmode=prefer`, which already negotiates TLS, as do the backup and monitoring paths that run inside the pod over the Unix socket. Only clients that disable TLS explicitly are refused. In-cluster instances with `external: false` are unchanged. Changes: - `templates/_tls.tpl`: `postgres.tls.required` helper. - `templates/db.yaml`: renders `spec.postgresql.pg_hba` when required. - `values.yaml`: `tls.required`, with the generated `values.schema.json`, `README.md`, `api/apps/v1alpha1/postgresql/types.go` and `packages/system/postgres-rd/cozyrds/postgres.yaml`. The `Required` deepcopy block in `zz_generated.deepcopy.go` is controller-gen v0.16.4 output. - `README.md`: new "Refusing plaintext sessions" paragraph. - `tests/pg_hba_test.yaml`: 10 helm-unittest cases. Backwards compatibility: breaking for existing external instances whose clients connect without TLS. The rules apply on the next reconcile. They are refused until the client enables TLS or the instance sets `tls.required: false`. Testing done: - `make generate` in `packages/apps/postgres` with cozyvalues-gen v1.7.0; regenerated files committed. - `helm unittest .` in `packages/apps/postgres`: 206 passed (25 suites), 10 of them new. I did not run it against a live cluster, so the `pg_hba` ordering is taken from the operator source and docs rather than observed. ### Screenshots Not a UI change. The dashboard form gets a `tls.required` toggle from the schema. ### Downstream repositories I walked the trigger map against the diff and left every box empty so a human decides. The nearest hit is the website's managed-apps reference page for postgres, which a stable-tag bot regenerates from `README.md`; the Terraform provider's postgres schema may also want the new `tls.required` field. - [ ] 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)!: an external Postgres now refuses sessions that are not encrypted. The chart renders `hostssl` rules for all users and databases with scram-sha-256 (md5 on PostgreSQL 13, matching CloudNativePG's default rule) and rejects plain `host` connections, so a client using `sslmode=disable` is refused. The new `tls.required` value follows `external` by default; set it to `false` to keep accepting plaintext sessions. ``` Fixes #4619 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a `tls.required` setting for PostgreSQL instances. By default, TLS is required for external instances and optional for others. You can override this behavior to require encrypted connections for both external and in-cluster clients, or allow plaintext connections for external instances. Rendering fails if TLS is required while PostgreSQL SSL is disabled. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |