mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
cb4789185c5aef4624174feaf11ffcbff8d1cd43
484
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
77a02d2e3a |
feat(tenant): add the vGPU entitlement, keep GPU budgets out of quotas
A vGPU class may be used only by an entitled tenant, and no tenant may grant itself the entitlement. The Tenant field gpu.vgpu is set by the parent's administrator, so the effective value is the field and the parent's value together, and it reaches the namespace as the namespace.cozystack.io/vgpu label. The label is always written, so only "true" entitles and a missing label cannot be read as consent. _namespace.vgpu is written only when entitled, since every app in the tenant reads that Secret and an always-present key would upgrade them all. GPU budget keys in the gpuclass.cozystack.io domain are checked when a VM or a worker pool is written, not against pods, so they are dropped before the ResourceQuota render, and a tenant with only GPU budgets gets no ResourceQuota or LimitRange. The domain test matches the one the API server uses, so a malformed budget key never becomes a pod quota either. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
4cb240a500 |
feat(gpu): share resource-name ownership and capacity rules
The GPU components need consistent answers about catalog-name ownership, free units, budget keys and tenant entitlement. An acknowledged name belongs to its object UID even when an older class changes its request. Only an exact, unique acknowledgement confirms ownership; creation time selects candidates for unreserved names, and duplicate acknowledgements stay ambiguous. These snapshot rules do not fence future status writes or reserve GPU capacity. Free units come from node allocatable and pod requests. A finite NoExecute toleration cannot make a node an enduring placement option, but a matching toleration without an expiry can. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
7554abf715 |
feat(api): add the GPUClass catalog to cozystack.io
GPU offers need stable names for tenant budgets and billing while the host layer can change its device-plugin resource names. Publish the offer metadata and a UID-scoped acknowledgement of the underlying resource name, separate from readiness and from GPU capacity. Keep immutable offer details on the class, require a profile for vGPU, and retain the CRD on chart uninstall. The shipped-schema tests exercise create, update and status preparation through the apiserver strategies, including malformed fields and status isolation. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
9cf93b8535 |
fix(postgres): keep bullseye clusters on their image until a clean locale check (#5472)
## What this PR does Refs #5459. Part of bringing #5405 (standard-trixie images) back to release-1.7, which #5461 reverted. This PR covers the `C.UTF-8` item of #5459 by keeping such clusters off the new image. The other items are fixed separately: the repair racing the rollout and the Job budget, the repair skipping `C.UTF-8`, the double REINDEX, and the postgis extension update. ### Why Clusters created before #5405 run a bare tag, the system variant on Debian bullseye. Moving them to `standard-trixie` changes glibc and ICU under the data directory. The collation repair pass from #5405 cannot see every case. A libc `C.*` locale such as `C.UTF-8` carries no collation version in any PostgreSQL major, yet Debian bullseye's `C.UTF-8` and the one in glibc 2.35+ sort differently. Until the indexes are rebuilt, replicas return wrong results through `-ro` and unique indexes accept duplicates. PostgreSQL ([Locale data changes](https://wiki.postgresql.org/wiki/Locale_data_changes)) and CloudNativePG ([postgres-containers](https://github.com/cloudnative-pg/postgres-containers): switching the Debian base "is a manual operation because of PostgreSQL locale-data implications") both treat this as a deliberate, owner-driven step. ### What it does A cluster on one of the bare bullseye tags the chart shipped (13.22, 14.20, 15.15, 16.11, 17.7, 18.1) stays on its image until a check finds it clean. The check fails closed: a cluster not checked yet, one the check could not finish on, and one it found affected all stay. - **The check.** A `pre-upgrade` hook (`locale-check-<release>-<hash>`) runs before every upgrade of such a cluster, from the cluster's current image. - It looks in every database for columns, indexes, composite or range types, and `jsonb` indexes that depend on a collation other than C, POSIX or builtin, and for a database default (collate or ctype) outside those. - It records `clean`, `affected` or `unknown` in the `postgres.cozystack.io/locale-data` annotation of the Cluster, and the first objects found in `postgres.cozystack.io/locale-data-objects`. - Its Role can only `get`/`patch` that one Cluster. - **What the chart renders.** The chart reads the recorded answer through `lookup`. Helm renders before hooks run, so the hook fails an attempt only when the new answer contradicts that render, before the Cluster is patched. The HelmRelease retry then renders according to the new answer: - A cluster not checked before, or found `affected` or `unknown`, is rendered on its current image. The upgrade passes, and every other value of the app still applies. - A cluster found `clean` fails that attempt once, and the retry moves it to `standard-trixie` with the existing repair. - **Opt-in.** `allowCollationChange: true` moves a held cluster on the next upgrade, in a window the owner picks. - **Version changes.** A held cluster refuses a change of `version` with an explicit render error, since new majors are built only on the new images. - **Restore.** The CNPG backup driver copies the source Cluster's `spec.imageName` into the backup snapshot verbatim, passes it to the restore as `bootstrap.sourceImageName`, and clears it with `bootstrap.enabled`. The core controller knows nothing about the chart's hold rules. - The chart decides: a backup taken on one of the bullseye tags restores onto that image, so the data keeps the library that built it. - The next upgrade then checks the restored data like any other bullseye cluster. - Any other value is ignored, so a tenant cannot choose an image through it. - The driver also reads the major from that image tag when the backup recorded none, and refuses a mismatch with `spec.version` before the purge. ### What a held cluster is left with - It keeps running its bare bullseye tag. Upstream builds new PostgreSQL minors only on bookworm and trixie, so a held cluster gets **no further minors and none of their security fixes; CVE-2026-116331 stays open on it** for as long as it is held. - The tenant sees only that the image did not change. The answer and the objects found are on the cnpg.io Cluster, which only an administrator can read. - There is no deadline. The hold lasts until the owner takes one of the ways out below. ### How a held cluster leaves that state 1. **Remove the dependency.** Move the listed columns and indexes to `C`, or to the builtin `pg_c_utf8` on PostgreSQL 17 and later, or drop them. The next upgrade checks again, finds the cluster `clean` and moves it. 2. **Move explicitly.** In a maintenance window, set `allowCollationChange: true`. The next upgrade moves the cluster and the init Job's repair rebuilds indexes on versioned collations (ICU, libc locales other than `C.*`). Until the separate `C.UTF-8` repair fix lands, rebuild indexes on `C.UTF-8` or another `C.*` locale by hand with `REINDEX INDEX CONCURRENTLY`. Range partitions, CHECK constraints and materialized views on such text are not fixed by a rebuild and need a logical move (pg_dump/restore or logical replication). During the move, replicas restart on the new image first, so reads through `-ro` can be wrong and unique indexes can accept duplicates until the primary's rebuild is done. ### Testing - `helm unittest packages/apps/postgres`: 276 passed, including `tests/locale_guard_test.yaml`. It covers: - holding on `affected`, `unknown` and a missing result, and moving on `clean`; - the opt-in and the version refusal; - restores from bullseye and trixie backups, hand-set recoveries, and leftover values; - ignoring foreign images, postgis, hook gating, naming and the Role scope. - `go test ./internal/backupcontroller/...` passes, including `cnpg_source_image_test.go` and the restore reconcile cases for passing the image on and refusing the held major before the purge. - The check script was run in Docker against `postgres:13-bullseye` and `postgres:18-bookworm`: - It flags `C.UTF-8`/`C.utf8` columns and defaults, ICU indexes, `en_US` defaults with text, a `C`-collate / `en_US`-ctype database with a `lower()` index, composite and range types over text, and `jsonb` indexes under a non-C default. - It reports `clean` for `C`, `POSIX`, `pg_c_utf8` and `ucs_basic`, and when another database is `default_transaction_read_only`. - It reports `unknown` on an authentication failure or when a database accepts no connections. - The record step was run with a stub `kubectl` for each render (held or moving) and answer: - held + `clean` fails the attempt; held + `affected`/`unknown` passes; - moving + `clean` passes; moving + `affected`/`unknown` fails the attempt; - every answer is recorded. - Dev cluster: apps installed from the v1.7.1 chart (`postgresql:17.7`, bullseye) and upgraded to this branch (results in the PR thread). ### Screenshots ### Downstream repositories The trigger map hits `cozystack/terraform-provider-cozystack`, because this adds `allowCollationChange` and `bootstrap.sourceImageName` to the postgres `values.schema.json`. The follow-up is cozystack/terraform-provider-cozystack#91. - [ ] 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#91 - [ ] [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 [postgres] A cluster still on a Debian bullseye image now stays on that image until a pre-upgrade check finds nothing in it that depends on a collation other than C, POSIX or builtin (an ICU or libc locale, or C.UTF-8), or until `allowCollationChange` is set. A held cluster gets no further PostgreSQL minors or their security fixes. The `postgres.cozystack.io/locale-data` annotation of the cnpg.io Cluster shows the result of the check. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit - **New Features** - PostgreSQL upgrades from older Debian Bullseye images now check for collation-dependent data and hold the current image when results are affected or unknown. - Added an opt-in setting to allow the image change despite the collation check. Review collation and index-rebuild considerations before enabling it. - PostgreSQL restores retain source-image information to support image selection and compatibility checks. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
ed22d251c8 |
feat(api): add EndpointAttachment to attach addresses to app endpoints (#4324)
## What this PR does Implements `EndpointAttachment` (`local.sdn.cozystack.io/v1alpha1`, namespaced) from the design proposal in [cozystack/community#45](https://github.com/cozystack/community/pull/45): a tenant-created resource that attaches one external address to one tenant-facing Service of one managed application. It is the Network load-balancing path (a dedicated address per attachment), complementary to SNI exposure through the tenant Gateway, and it implements the `loadBalancer` union member only. Nothing in it routes by hostname, touches TLS, or reads chart values. Two commits. The first updates address-controller and metallb-iad to v0.3.0: the class's provisioner now reports, in `IPAddressClass.status.loadBalancerClass` with an `Accepted` condition for the class's generation, the `loadBalancerClass` a Service consuming its claims must carry, and the MetalLB driver writes that status. The second adds `EndpointAttachment`, which sets that class on every Service and FloatingIP it renders and renders nothing new until the class is accepted (`ClassNotAccepted`); a Service or FloatingIP already published is kept if the class later loses acceptance. The FloatingIP retarget check needs cozyplane v0.1.5 or later, which stamps `metadata.generation` and `status.observedGeneration`. [#5389](https://github.com/cozystack/cozystack/pull/5389) moves the cozyplane pin to v0.1.5, and this PR merges after it; on an older cozyplane both fields read 0 and the check passes as before. **API** (`api/localsdn/v1alpha1/endpointattachment_types.go`, CRD generated into the cozystack-controller chart). The kind lives in `local.sdn.cozystack.io`, the CRD-served half of the sdn family the address substrate and cozyplane already share, so stock `ResourceQuota` counts still work. `spec` is required at the resource root, since removing it would otherwise skip every rule nested inside it. `spec.applicationRef` (group/kind/name, group defaulting to `apps.cozystack.io`), `spec.endpoint.serviceName`, and `spec.loadBalancer` with `className` | `claimName` (exclusive), `family`, `ports`, `method` (`WholeIP` | `PortList`), `allowICMP`. CEL freezes the address-identity fields (`applicationRef`, `className`, `claimName`, `family`) and the member selection, requires exactly one union member (written as a list so a `gateway` member can be added without restructuring), and holds the static shape rules (`PortList` needs `ports`, `allowICMP` is `PortList`-only). Everything cross-object or dynamic is a condition. `status.phase` is a projection of the `Resolved` and `Provisioned` conditions. **Controller** (`internal/controller/endpointattachment`), one reconcile in four steps: 1. Resolve. The application's HelmRelease is found by the three lineage labels; the attachment gets a non-controller owner reference to it by UID and the lineage labels stamped on itself. The endpoint Service must carry the lineage triple matching `applicationRef` and `internal.cozystack.io/tenantresource: "true"`; lineage alone is refused (`EndpointLineageMismatch` / `EndpointNotTenantFacing`), as is a Service rendered by another attachment, and a LoadBalancer Service a tenant Kubernetes cluster's cloud-controller-manager creates for a Service inside that cluster: it carries the cluster's lineage and the marker, and is told apart by the `cluster.x-k8s.io/tenant-service-name` label that controller writes. A same-name recreated application (different HelmRelease UID) is reported as `ApplicationIncarnationChanged`, the Service is withdrawn, and the owner reference is never rewritten. 2. Claim. `claimName` references an existing `IPAddressClaim` and writes nothing to it; otherwise a claim is minted with `generateName` under the attachment's controller reference. The substrate kinds are read as unstructured, so the controller carries no module or CRD dependency on it and reports `ClaimPending` where it is not installed. `loadBalancerClass` is read from the claim's resolved `IPAddressClass` status before the Service is created, only once the class's `Accepted` condition is True for its current generation, and left empty when the class reports the cluster default. The Service's `ipFamilyPolicy` and `ipFamilies` follow the claim's family (`SingleStack` for IPv4 or IPv6, `RequireDualStack` for Dual) and are reconciled on existing Services; a primary family that differs, which the apiserver never changes, and a create the cluster refuses are both reported as `RenderFailed`. An address whose `IPAddress.status.associatedTo` names another live Service gives `ClaimInUse` and withdraws this attachment's own Service, so two attachments that both rendered before either association was recorded leave one Service asking for the claim. A `family` conflicting with a referenced claim gives `FamilyConflict`. 3. Render. One `type: LoadBalancer` Service via `generateName` (a prefix derived from the attachment name and bounded to what the apiserver accepts for a Service, which also bounds the minted claim's), identified by controller owner reference only (a Service with the ownership label and no reference is ignored, never adopted). It mirrors the endpoint's selector and ports (or the `ports` subset; synthesized ports when the endpoint has only the sentinel port), carries the `local.sdn.cozystack.io/ip-address-claim` annotation, `externalTrafficPolicy: Local`, and `allocateLoadBalancerNodePorts: false` unless the platform says otherwise. It copies no labels or annotations from the endpoint. An endpoint with no selector (hand-managed endpoints) is refused with `NothingToPublish`, and the VM placeholder is recognised by its shape (headless, only port 65535) rather than by the port alone. When the cache shows no owned Service, the controller rechecks through the API reader before creating one, and collapses duplicates to the oldest. Re-mirroring is event-driven through watches on Services, EndpointSlices, HelmReleases and, where served at startup, the claim kind. 4. Report. `status.addresses` mirrors the claim's bound addresses (a list), `status.serviceName` and `status.claimName` name the objects, and `Provisioned=True` asserts address and Service wiring only; its message says so, since reachability additionally depends on the CNI's policy objects. **VM datapath modes.** `method` renders the cozy-proxy Service contract exactly (the `service.kubernetes.io/service-proxy-name: cozy-proxy` label, `networking.cozystack.io/wholeIP`, `networking.cozystack.io/allowICMP`, the sentinel port for whole-IP without ports) and adds nothing beside it. Rendering is gated on a platform declaration, not CNI detection: the controller flag `--cozy-proxy-contract-implemented` is threaded from the system bundle, which sets it exactly when it emits the cozy-proxy Package; without it a method-bearing attachment renders no Service and reports `DatapathContractUnavailable`, because a load balancer would still attract the address while every proxy skipped the Service. Exclusivity is keyed on the backend pod and counts every delegated Service in either mode (attachments, chart Services rendered with `external: true`, hand-made ones): a delegation no attachment renders (a chart Service with `external: true`, or a hand-made one) always wins, since nothing would ever withdraw it; between attachments the oldest wins, ties by name. The loser reports `BackendAlreadyDelegated` and renders nothing rather than fighting for the slot. cozy-proxy v0.4.0 programs IPv4 only (one IPv4 nftables table, every address through `To4()`), so a method attachment off a VPC with an `IPv6` or `Dual` claim renders no Service and reports `FamilyUnsupportedByDatapath`; the cozyplane path still serves IPv6 through the FloatingIP. `WholeIP` on an endpoint with more than one ready backend keeps its Service and claim but selects nothing (`MultipleBackends`), so a rolling update or live migration passes through held-but-dark and recovers without churning the address. **VMs in a VPC.** On a cozyplane VPC the VM's only interface is in the VPC, so the launcher pod address a cozy-proxy Service maps to never reaches it. When a backend pod carries the VM chart's `sdn.cozystack.io/vpc` annotation and the cluster serves cozyplane's `FloatingIP`, a `WholeIP` attachment owns a FloatingIP in its namespace (`vpcRef` from the annotation, `target` from the `sdn.cozystack.io/vpc-ip` address cozyplane's CNI stamps, `addressClaimName` the attachment's claim) instead of a Service, and `Provisioned` mirrors the FloatingIP's readiness. FloatingIP is read as unstructured and only where served, so there is no dependency on the cozyplane PR. Refusals there: `PortList` (`MethodUnsupportedInVPC`), a `Dual` claim, since a FloatingIP wears one address (`DualStackUnsupportedInVPC`), a VPC in another namespace (`VPCNotInNamespace`), several distinct VPC addresses or a mix of VPC and non-VPC pods (`MultipleBackends`, claim held), no VPC address stamped yet (`WaitingForVPCAddress`), and a VPC backend where FloatingIP is not served (`DatapathContractUnavailable`, no Service). A live migration's two launcher pods share the VPC address and stay one binding; a stopped VM keeps its FloatingIP. Since only a backend pod says whether a VM is in a VPC, a `method` attachment that has published nothing yet waits for one (`WaitingForBackend`), so an attachment created before its VM starts never pins the claim to a cozy-proxy Service first. On the kube-ovn VPC the VM keeps its pod-network interface and joins VPC subnets through extra interfaces, so the cozy-proxy path is unchanged there. **Detach semantics.** An endpoint Service that disappears withdraws the rendered Service, keeps the claim (minted or referenced), and reports `Detached`; the same claim is reused when the endpoint returns. Deleting an attachment collects its Service and its minted claim; a referenced claim is untouched. **Wiring.** The controller is registered in `cmd/cozystack-controller` behind two flags (`--cozy-proxy-contract-implemented`, `--endpoint-attachment-allocate-node-ports`), the chart exposes them as `cozystackController.endpointAttachments.*`, the platform system bundle derives both (cozy-proxy emitted, Hetzner RobotLB enabled), the controller ClusterRole gains Service writes, the `endpointattachments` kind, `ipaddressclaims` create/delete and `sdn.cozystack.io` `floatingips` writes, and the tenant ClusterRoles get `endpointattachments` beside `securitygroups` (full in `cozy:tenant:base`, read in `cozy:tenant:view:base`, write in `cozy:tenant:admin:base`). **Tests.** `crdcel_test.go` compiles the shipped CRD and pins the create and update admission matrix. `reconciler_test.go` (fake client) covers the resolve/deny matrix over both label families, mirroring and port subsetting, the minted-claim path, the two proof sequences (a labelled-but-unowned Service is ignored and a same-name recreated application is not re-acquired; a reserved claim holds across detachment and moves to a different application), detach/reattach, the sentinel-port rule, the capability gate, both modes, held-but-dark on multiple backends, pod-keyed exclusivity, the substrate-absent path and the family conflict. Admission tests also validate from the resource root (removing or restoring `spec`). The reconciler tests cover a Dual claim that is provisioned only once the Service carries both addresses, and attachment names up to 253 characters, with dots or a leading digit, on both address-selection paths. `floatingip_test.go` covers the cozyplane path: the FloatingIP's spec and readiness mirroring, the claim worn by its own Service not counting as in use, switching from and back to a cozy-proxy Service, a kube-ovn-shaped backend keeping the Service, each refusal, live migration, a stopped VM, re-pointing in place, detach and name bounds. Chart unit tests pin the platform declaration on every bundle variant, slim opt-in included, and the FloatingIP RBAC rule. `hack/e2e-chainsaw/endpointattachment` carries the postgres hold/move sequence, GC, the lineage refusal of an attachment pointing at another application's Service, and the VM mode Test (re-scoped to a single delegated Service per VM, since current cozy-proxy's rule installer keeps one 1:1 slot per pod). It is registered: `hack/select-install.sh` maps it to `cozystack.address-controller` and `cozystack.metallb-iad`, with Postgres, VMInstance, VMDisk and cozy-proxy as its runtime requirements, and `hack/select-e2e.sh` maps both substrate packages back to it, since no other suite installs them. The e2e install enables both packages, and `hack/e2e-post-install-prep.sh` creates the default `IPAddressClass` on a dedicated, non-auto-assigning MetalLB pool whenever metallb-iad is installed. `hack/e2e-chainsaw/endpointattachment-vpc` covers the cozyplane FloatingIP path (whole-IP published through a FloatingIP, `PortList` and `Dual` refused) and stays parked as `chainsaw-test.yaml.disabled`, because no e2e lane installs the cozyplane networking variant. **Upgrade.** Additive: a new CRD, a new reconciler, new RBAC rules, no migration. The system bundle now always passes the cozystack-controller component an `endpointAttachments` values block, so the first upgrade rolls the controller once with the new flags; the flags change nothing until `EndpointAttachment` objects exist, and no existing object is modified. **Docs.** The user guide is on the website, in [cozystack/website#825](https://github.com/cozystack/website/pull/825): the resource, which Services can be attached, the lifecycle, the conditions' exact meaning, the VM modes and the cozyplane path, and the TLS posture (attaching a database does not turn its TLS on). It is a cross-package guide, so under the documentation placement rules it lives there rather than in `docs/`. **Not in this PR, deliberately.** The `gateway` union member (a reserved name; the CRD ships without it and nothing references it). A certSAN write-back for the managed Kubernetes API. Discovery-engine address write-back. The address-preserving migration from `external: true`. An authoritative exclusivity gate inside cozy-proxy (the attachment-side refusal is advisory); that wants an issue in cozystack/cozy-proxy. ### Screenshots Not a UI change. ### Downstream repositories `ApplicationDefinition.spec.services` now also decides which Services tenants can attach an address to, which the trigger map routes to the website's ApplicationDefinition page: [cozystack/website#825](https://github.com/cozystack/website/pull/825) documents that, and carries the user guide. Nothing else matched: the cozy-proxy runtime contract is consumed with the same three literal strings and nothing is renamed; the new CRD travels as opaque JSON in the terraform provider; no platform `values.yaml` key, variant, asset or node prerequisite changed. An issue in cozy-proxy for an authoritative one-delegation-per-pod gate is worth a human decision rather than a speculative filing. - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: https://github.com/cozystack/website/pull/825 - [ ] [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(api): add EndpointAttachment (local.sdn.cozystack.io/v1alpha1), a tenant resource that attaches an external address, minted from an IPAddressClass or bound from a reserved IPAddressClaim, to one tenant-facing Service of a managed application by rendering an additive LoadBalancer Service that mirrors it; VM whole-IP and port-list modes render the cozy-proxy contract where the platform deploys it. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added endpoint attachments to publish eligible application and VM endpoints through dedicated load balancer addresses, with whole-IP or selected-port exposure and IPv4, IPv6, or dual-stack support. * Attachments can use a reserved address or request one through a configured address class. Status shows endpoint resolution, provisioning, assigned addresses, and attachment state. * Tenant access now includes managing and inspecting endpoint attachments. Whole-IP VM exposure is limited to one delegated backend, and VPC support depends on the available network datapath. * **Documentation** * Added guidance on eligible endpoints, address lifecycle, status, and exposure considerations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
f342bd4765 |
feat(api): add installation defaults for new applications (#5107)
## What this PR does This PR adds installation defaults for applications: administrator sets `applicationDefaults` in the platform values, and every application created after that starts from them. Design is in [the proposal in cozystack/community](https://github.com/cozystack/community/pull/116), related to [the worker defaults issue](https://github.com/cozystack/cozystack/issues/3950). The value is keyed by ApplicationDefinition plural (for example `postgreses`) and the platform chart renders it into the `cozystack-application-defaults` ConfigMap in `cozy-system`. The aggregated API merges the entry for the kind under the submitted spec on create, apply-create and dry-run create, and saves the result in HelmRelease values. The order is user values, installation defaults, then developer defaults from the chart schema. Update never applies defaults, so changing the value leaves existing applications alone. The merge goes into objects that declare `properties` and replaces everything else whole: arrays, dictionaries with `additionalProperties`, free-form objects, objects that also take arbitrary keys and objects marked `x-kubernetes-map-type: atomic`. So a node pool that sets its own `registryMirrors` gets no platform mirror entries. Explicit empty values from the user (`{}`, `[]`, `false`, `0`, `""`) win over the installation value. An entry is checked against the application's OpenAPI schema before it is merged. An object that the merge completes is checked as a partial one, so `required` and `minProperties` are not enforced on it and its `oneOf` is not evaluated (CEL rules are not evaluated at all). Whatever is stored whole is checked whole: array rows, dictionary values, free-form and atomic objects. Without that, an entry like a RabbitMQ vhost without `roles` was accepted and stored, and the chart refused to render it. A missing ConfigMap means no defaults and gives no warning. An unreadable ConfigMap, invalid JSON, a bad entry or an unreadable schema does not block the create: defaults are skipped and the response carries a Warning (dry-run too). The generic checks cover the whole map, so one entry that is not an object, or a reserved top-level field in any entry, turns defaults off for every application until it is fixed, while a bad entry of one application only affects that application. The ConfigMap is read through a cache limited to that one object, startup waits up to 30 s for it to sync and a create waits up to 5 s for the read, then both go on without defaults. Some objects take exactly one of their children and the chart refuses two: the worker image of a node pool (`osImage.builtin` or `osImage.factory`), a vm-disk `source`, the `oidc.customConfig` of a kubernetes cluster and of a monitoring stack (`config` or `secretRef`). A default for one child merged into an application that chose another built that spec. These carry the atomic marker now, so the merge replaces them whole, and `values.yaml` tells catalog authors to do the same in their own schemas. The chart guide (`docs/agents/overview.md`) says when the marker fits and when it does not. The `osImage` change is the same hunk as in #5192. The dashboard order page sends one dry-run create when it opens and starts the form and YAML from the returned spec, so the browser reads no ConfigMap and merges nothing. If the preview fails, or gets no answer in 8 s, the form opens with a notice and Retry, and Deploy still works. After a failed preview a dropdown stays empty instead of selecting the cluster default option, so the API applies the platform default to the omitted field. A cleared text field leaves its key out, a dropdown None and a sensitive field are written as `""`. While the server owns defaults the form does not fill schema defaults on its own. Not in this PR: defaults on update, re-rendering existing applications when the value changes, defaults for HelmReleases that controllers create directly, validation when the ConfigMap is saved, previews on every edit in the dashboard. ### Merge order #5190 and #5191 are merged and this branch is rebased on main. #5192 is open and has the same `osImage` marker hunk, so whichever of the two lands second needs one more `make generate` after a rebase. ### Known limits - The dashboard does not show the API Warning. - `null` for a field that has a developer default is saved as `null` through kubectl or Terraform, but the dashboard form shows the developer default. - A number in an integer-or-string field is rejected by the form (same on main), so quantities in an entry have to be quoted, `cpu: "2"`. `values.yaml` says so. - After a failed preview the form still requires a field that has no schema default, even if an entry would supply it. Typing the value or switching to YAML gets around it. - The marker only fits a choice between alternatives that each stand complete. I went through the application charts and rendered every refusal I found that involves two or more fields, and most are not that. A pair that has to be set together (`resources.cpu` with `resources.memory`, `tls.enabled` with `tls.disableNonTLSListeners` in rabbitmq) is completed field by field today, and an atomic object would drop the default half. An object that also holds independent fields an admin would default (`backup` in clickhouse, mariadb, mongodb and postgres, `volume` in seaweedfs) would lose them. Relations between two objects or two top-level fields (`cloudflareProxy` with `proxyProtocol` in the ingress, most of postgres, the kubernetes addons) cannot carry a marker. In all of these a default for one field plus the user's value for another can make the chart refuse the render after the create went through. Catching that needs the relations declared as rules in the schema and the merged spec checked against them, and the API does not evaluate such rules on a user spec yet (#2657), so it is a separate change. A few relations depend on a lookup into the cluster and I could not render them offline. - Clearing an optional text or number field in the order form leaves its key out, so the default comes back. A dropdown set to None, a sensitive field and a dictionary value send an empty string and win. The form keeps its old meaning of clearing a field, same as on main. To override a default with an empty value, set it in the YAML tab (`""`, `0`). Switching from the YAML tab back to the form fills an empty dropdown with its default option again, a None included, so such a value has to be deployed from the YAML tab (https://github.com/cozystack/cozystack/issues/5473). - An entry that cannot be parsed (invalid JSON, a reserved `_` key) turns defaults off for every kind, not only its own, and the Warning on each create names the problem. I did not split it per entry: the failure is loud, the fix is in one place, and splitting touches the parse and cache path for a case only a typo causes. - An atomic object also drops a default for a field nested inside an alternative when the user sets another field of that alternative. A default for `osImage.factory.imageFactoryURL` does not survive a pool that sets `osImage.factory.version`, and the boot disk then comes from the public factory. `talos.imageFactoryURL` is the knob the chart falls back to, it is not atomic, and defaults for it keep working. - A schema that declares a typed property only inside an `allOf` or `anyOf` branch, under a root that takes arbitrary keys, is checked as partial. No schema in the tree looks like that. - An object inside an `allOf`, `anyOf` or `oneOf` branch is closed to unknown keys even when the property it constrains is declared as a dictionary, so a valid entry for such a schema is refused and the create goes on with a Warning (https://github.com/cozystack/cozystack/issues/5474). No schema in the tree looks like that either. - The preview uses the placeholder name `preview`, so it fails when the tenant already has an application of that kind with this name, and the form opens with the notice. - The cache wiring in `pkg/apiserver/apiserver.go` has no unit test, the cache itself has. ### Verification - `make unit-tests` on this head with `LC_ALL=C`, exit code 0 (a kafka bats test on main depends on the locale). - `tsc` and `eslint` in the console are clean. - For the checks below I broke the code on purpose and saw the matching test fail, except the `arrayMinItems` flag of the server form, I could not make it matter. - A run on a test cluster with v1.7.0 is in the comment below. It was on an earlier revision, the stored-whole checks, the extra markers and the cleared-field change came after and are covered by unit tests only. - Not run: `make test-controllers`. - The merge cases asked in review are fixtures of `TestInstallationDefaultsMergeContract` now: a field set inside the alternative a user chose of an atomic object, the same object without the marker, an atomic object nested in one that merges, and an explicit `null` over an installation object. The whole table is in the proposal addendum, https://github.com/cozystack/community/pull/146. Checked cases: - user values `{}`, `[]`, `false`, `0`, `""` are kept, and a node pool with its own `registryMirrors` gets none from the platform - an object with both `properties` and a dictionary, or with preserved unknown fields, is replaced whole - empty and `null` `spec` on create - update after create, apply-update and a field removed on update keep stored values - a broken entry for another application, or an application with no entry and no readable schema, does not touch this create - missing ConfigMap gives no defaults and no warning, invalid JSON, unreadable ConfigMap and a cache that did not sync give a Warning and the create goes on - partial entry: `required`, `minProperties` and object `oneOf` are skipped on an object the merge completes, while unknown fields, wrong types, scalar `oneOf` and array items are still checked - array rows, dictionary values, free-form and atomic objects are checked whole, also when the constraint sits in an `allOf` or `anyOf` branch next to the property, and in these shapes an accepted entry merges into a spec that the application's own schema accepts - every ApplicationDefinition in the tree accepts an entry built from its own developer defaults - an object that lists properties without `type: object` is checked as an object, so an unknown field in it is refused - a pool with `osImage.factory`, a disk with another `source`, a cluster with `oidc.customConfig.secretRef` and a monitoring stack with `oidc.customConfig.config` do not get the other child from the platform, on their real schemas - a node pool that sets `resources.cpu` still gets `resources.memory` from an entry, so the marker does not take away the field-by-field completion of pairs - dashboard: a user with no tenant does not wait on the spinner, switching tenant keeps what was typed, a preview answer that arrives after the tenant changed is dropped, a non-object answer counts as a failed preview, Retry sends the current draft - dashboard: after a failed preview dropdowns in a field, an array row and a dictionary value stay empty, and edits made in YAML come back into the form - `required` inside array rows and dictionary values stays in force when the server owns defaults, and an emptied sensitive field stays `""` ### Screenshots Not captured yet. ### Downstream repositories This PR changes `packages/core/platform/values.yaml`. The docs for the new key are in https://github.com/cozystack/website/pull/828, and the proposal addendum with the merge cases and two decision records is in https://github.com/cozystack/community/pull/146. The Terraform provider may be reached too: it has its own defaults for some sizing fields (storage class, disk size), so installation defaults would not apply to those, while the Talos block fields are left out when unset and do get them. I read the schema, not the expand code. - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: https://github.com/cozystack/website/pull/828 - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: to check, provider defaults vs installation defaults - [ ] [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: - [x] [cozystack/community](https://github.com/cozystack/community) - follow-up: https://github.com/cozystack/community/pull/146 ### Release note ```release-note feat(api): add the `applicationDefaults` platform value, installation defaults are applied to new applications under user values, existing applications keep their saved settings, and the dashboard order form starts from the same defaults. ``` |
||
|
|
21d66c4cce |
fix(postgres): keep bullseye clusters on their image until a clean locale check
Clusters created before the move to standard-trixie run the bare tag, the system variant on Debian bullseye. Moving them changes glibc and ICU under the data directory, and the collation repair pass cannot see every case (C.UTF-8 carries no collation version), so text indexes can return wrong results and unique indexes can accept duplicates. Such a cluster now stays on its image until a pre-upgrade hook, run from that image, finds nothing stored that depends on a collation other than C, POSIX or builtin. The hook records clean, affected or unknown on the Cluster; anything but clean holds the cluster, so a check that cannot finish keeps it where it is rather than letting it move unchecked. Helm renders before hooks run, so the hook fails an attempt only when its answer contradicts what that attempt rendered, and the retry follows the answer. allowCollationChange moves a held cluster on the owner's terms, and a held cluster refuses a change of version, since new majors are built only on the new images. A physical restore replaces the Cluster that carries the answer. The CNPG backup driver records the source Cluster's image in the backup snapshot and passes it on as bootstrap.sourceImageName without interpreting it; the chart restores onto it only when it is one of the bullseye tags it shipped, and the next upgrade checks the restored data. Assisted-By: LLM Signed-off-by: Andrey Kolkov <androndo@gmail.com> |
||
|
|
74ac18e042 |
feat(apps): mark objects whose children exclude each other atomic
The worker image of a node pool takes one of builtin and factory, a vm-disk source one of disk, http, image and upload, and the oidc customConfig of a kubernetes cluster and of a monitoring stack one of config and secretRef, and each chart refuses a spec that sets two. An installation default for one child merged into an application that chose another built exactly that spec, and nothing warned at create time. The x-kubernetes-map-type: atomic marker makes the defaults merge replace the object whole. Nothing else reads it, so existing applications render as before. The marker stays off objects whose fields must be set together or sit beside independent fields, where replacing the object whole would drop a default the user did not mean to override. The chart guide says when to use it and when not to. The tests run the merge against the four real schemas, and one more pins that a pair like resources cpu and memory still merges field by field. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com> |
||
|
|
9f00135618 |
feat(api): add EndpointAttachment to attach addresses to app endpoints
A managed application's tenant-facing Services are its endpoints, and the only way to publish one externally has been the chart boolean `external`, which publishes one chart-chosen endpoint on one address from no particular pool through five different render paths. EndpointAttachment attaches one address, minted from an IPAddressClass or bound from a reserved IPAddressClaim, to one tenant-facing Service by rendering an additive LoadBalancer Service that mirrors the endpoint's selector and ports. The mechanism therefore needs no per-engine render knowledge and never touches the application's own objects, and a reserved address survives every attachment and moves between applications. The Service carries the loadBalancerClass the claim's class reports in status, so it reaches the load balancer that owns the class's pool; since a Service's loadBalancerClass is immutable, nothing new is rendered before the class's provisioner accepts the class for its current generation. The rendered Service asks for the claim's IP families, since one left to the cluster's primary family cannot be assigned an address of the other. The endpoint check requires both the lineage labels and the tenantresource marker: lineage alone also covers operator-internal Services. A LoadBalancer Service a tenant Kubernetes cluster's cloud-controller-manager creates carries the cluster's labels and the marker too, so the cluster.x-k8s.io/tenant-service-name label it writes excludes it. Identity is by owner reference throughout, so a Service carrying the ownership label without the reference is never adopted, and a same-name recreated application does not inherit the previous incarnation's attachments. The VM datapath modes render the cozy-proxy Service contract unchanged and are gated on a platform declaration rather than CNI detection: a proxy skips a Service delegated to a name it does not claim while the load balancer still attracts the address. Exclusivity is keyed on the backend pod in both modes because cozy-proxy's egress map holds one address per pod, and holds IPv4 only, so a method attachment off a VPC refuses an IPv6 or Dual claim. A delegation no attachment renders, such as a chart Service with external: true, always takes the pod, since nothing would ever withdraw it; between attachments the oldest wins. A whole-IP attachment with several ready backends keeps its address dark instead of picking one. A cozyplane VPC changes that for whole-IP: the VM's only interface is in the VPC, so the launcher pod address a cozy-proxy Service maps to never reaches it. Where a backend pod carries the VM chart's sdn.cozystack.io/vpc annotation and the cluster serves cozyplane's FloatingIP, the attachment owns a FloatingIP on the VM's VPC address wearing its claim instead, and mirrors its readiness once its status is for its current generation: a re-pointed FloatingIP keeps the old target's status until cozyplane observes the change. FloatingIP is read as unstructured and used only when served, so the controller keeps no dependency on cozyplane. A live migration's two launcher pods share the VM's VPC address and count as one target, and a stopped VM keeps its binding rather than flipping to a cozy-proxy Service. Only a backend pod says whether a VM is in a VPC, so a method attachment that has published nothing yet waits for one; otherwise an attachment created before its VM starts would pin the claim to a cozy-proxy Service first. PortList is refused there: a FloatingIP binds every port and cozy-proxy cannot reach the VPC address. So is a Dual claim, since a FloatingIP wears one address. The kube-ovn VPC keeps the pod-network interface and adds VPC subnets as secondary interfaces, so the cozy-proxy path still delivers to the VM there. The e2e suite is the only one that needs the address substrate, so it owns both of its optional packages in test selection: the e2e install enables them, a selection that leaves the suite out disables them, and post-install prep gives the sandbox a default IPAddressClass on a pool MetalLB does not auto-assign from. The cozyplane VPC suite stays parked, because no e2e lane installs that networking variant. The kind lives in local.sdn.cozystack.io, the CRD-served half of the sdn family the address substrate and cozyplane share, so stock ResourceQuota counts keep working. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
7be083a5a7 |
feat(harbor): expose replicas and zone spread for the request path (#4880)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - If it's a work in progress, consider creating this PR as a draft. --> ## What this PR does Closes #4824. Every `docker login`, pull and push goes through nginx → core (`/service/token`) → registry, and each of them ran as a single pod. Losing the node that hosted one stopped all registry traffic, however many PostgreSQL and Redis instances backed it. The vendored goharbor chart already scales these components and the registry keeps its blobs in S3, so only the wrapper was missing the knobs. **Request path (`packages/apps/harbor`)** - New `nginx.replicas`, `portal.replicas`, `core.replicas` and `registry.replicas`, all defaulting to `1`. - Above one replica, the wrapper forwards to the upstream chart a `podDisruptionBudget` with `maxUnavailable: 1` and `topologySpreadConstraints`. Upstream defaults `minAvailable` to 1 and renders whichever of the two fields is set, and the API server rejects a PDB carrying both, so the wrapper forwards `minAvailable: 0` to drop it. - At one replica nothing but `replicas: 1` is forwarded, which is the upstream default, so an existing install renders the same Deployments as before. - The `WorkloadMonitor`s for core, registry and portal take `replicas` from the values instead of a hard-coded `1`. `minReplicas` stays at 1, since one serving replica is enough for the component to work. - The spread follows the platform's `scheduling.globalAppTopologySpreadConstraints` (read from `_cluster.scheduling`), as postgres, etcd, keycloak, grafana and kubernetes-nodes already do, so the cluster operator sets the policy once. When the platform sets none, a soft spread stands in: zone then hostname, both `ScheduleAnyway`, so a cluster without zone labels or with fewer nodes than replicas still schedules every replica. Any `labelSelector` in the policy is dropped, because the upstream chart appends its own `release`/`app`/`component` selector to every entry. **Data tier (`packages/system/harbor`)** - The CNPG `Cluster` (when `database.replicas > 1`) gets `topologySpreadConstraints` from the same platform policy, or a `ScheduleAnyway` zone spread when the platform sets none; CNPG's default anti-affinity handles nodes. The Redis pods and sentinels already spread hard per node on main (#4990); this adds a `ScheduleAnyway` zone spread on top of that default. A constraint in the platform policy without a selector gets the component's own; a selector the policy sets is kept, as in the keycloak chart. **Deviations from the issue, on purpose** - Placement follows the platform-wide `globalAppTopologySpreadConstraints` instead of a set of rules hard-coded in Harbor, to stay consistent with the other applications. The fallback spreads across nodes with a `topologySpreadConstraints` entry rather than a preferred `podAntiAffinity` term: the upstream chart appends its own selector to spread entries, while an affinity term is passed through verbatim and would have to hard-code that label set in the wrapper. - On the data tier the zone spread goes through `topologySpreadConstraints`, not `affinity.topologyKey: topology.kubernetes.io/zone`. Moving CNPG's `topologyKey` to the zone would drop its per-node anti-affinity, so instances could share a node on a cluster without zone labels. With spread constraints the two add up, and for Redis the zone entry sits beside the per-node one. - `jobservice.replicas` (item 5 of the issue, which needs `jobLoggers: [database]`) is left for a follow-up, as the issue suggests. **Upgrade impact** - Request path: none at the default replica count. - Data tier: `database.replicas` and `redis.replicas` default to 2, so on upgrade most installs see a one-off rolling restart of the CNPG instances (with a switchover), of the Redis pods and of the sentinels, as their pod spec gains the spread constraint. Where the platform policy uses `DoNotSchedule`, it is now enforced for Harbor pods too, as it already is for the other applications. **Tests** - `packages/apps/harbor/tests/replica_placement_test.yaml`: defaults forward nothing beyond `replicas: 1`; above one replica the PDB and spread are forwarded; the platform policy replaces the fallback and loses its `labelSelector`, and is ignored at one replica; components scale independently; `registry.replicas` lands at the Deployment level, not under `registry.registry`; WorkloadMonitors follow the values. - `packages/system/harbor/tests/zone_spread_test.yaml`: CNPG, Redis and sentinel spread with the right selectors and no `affinity` override, both with the fallback and with a multi-entry platform policy, keeping a selector the policy sets; `redis_spread_test.yaml` covers the per-node default with the zone entry on top; and, rendering the vendored chart with the values the wrapper forwards, the PDB carries `maxUnavailable` alone and the spread entries are scoped to the component's pods. - Checked that the tests fail with the fix removed (helper without `minAvailable: 0`, upstream PDB without the zeroing, CNPG spread removed, platform policy ignored). `helm unittest` on both charts: 72/72 passing. Also rendered the app chart, with and without a platform policy, fed its HelmRelease values into the system chart, and checked the resulting Deployments, PDBs and CNPG `Cluster`. ### Screenshots No UI change. ### Downstream repositories - [ ] 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#70 (issue: the provider models Harbor by hand) - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: The diff adds fields to the `harbor` app's `values.schema.json`, which the Terraform provider models by hand, so a follow-up issue is open there. The website reference page is regenerated from the README on release, and no other trigger in the map matches the diff. ### Release note ```release-note feat(harbor): nginx, portal, core and registry now take a `replicas` value. Above one replica they get a PodDisruptionBudget and follow the platform's `globalAppTopologySpreadConstraints`, or a best-effort spread across zones and nodes when none is set, so draining or losing a node or zone keeps docker login, pull and push working. The PostgreSQL and Redis instances and the Redis sentinels now follow the same policy, or a best-effort zone spread; on upgrade this causes a one-off rolling restart of the database and Redis pods. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Harbor NGINX, portal, core, and registry replica counts are configurable and default to one. Above one replica, these components use a PodDisruptionBudget and follow platform-wide placement settings when available, or spread across zones and nodes otherwise. * Database replicas spread according to placement settings when configured above one. Redis replicas also spread above one, while all three Redis sentinels are always spread. * Core and registry resource settings now use a shared default when not specified. * **Documentation** * Harbor configuration guidance now describes replica settings, placement behavior, and PodDisruptionBudget behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
c51ea43fee |
chore(deps): update module golang.org/x/net to v0.62.0 [security] (#4822)
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [golang.org/x/net](https://pkg.go.dev/golang.org/x/net) | [`v0.61.0` → `v0.62.0`](https://cs.opensource.google/go/x/net/+/refs/tags/v0.61.0...refs/tags/v0.62.0) |  |  | --- ### Avoid quadratic complexity when coalescing text nodes in html in golang.org/x/net [CVE-2026-78661](https://nvd.nist.gov/vuln/detail/CVE-2026-78661) / [GO-2026-6860](https://pkg.go.dev/vuln/GO-2026-6860) <details> <summary>More information</summary> #### Details When coalescing adjacent text nodes in addText and fosterParent, appending to an existing TextNode's Data via string concatenation (n.Data += text) reallocated and copied the accumulated string on every token. Inputs containing many short text runs separated by ignored end tags (such as "a</x>") caused O(n^2) allocations and byte copies. Accumulate coalesced text in per-node byte slices during parsing and materialize Data strings once at the end of parse. #### Severity Unknown #### References - [https://go.dev/cl/849365](https://go.dev/cl/849365) - [https://go.dev/issue/82224](https://go.dev/issue/82224) - [https://groups.google.com/g/golang-announce/c/sqrs2vTx_Xs](https://groups.google.com/g/golang-announce/c/sqrs2vTx_Xs) This data is provided by [OSV](https://osv.dev/vulnerability/GO-2026-6860) and the [Go Vulnerability Database](https://redirect.github.com/golang/vulndb) ([CC-BY 4.0](https://redirect.github.com/golang/vulndb#license)). </details> --- ### Check all ancestor namespace transitions when rendering raw text in html in golang.org/x/net [CVE-2026-97045](https://nvd.nist.gov/vuln/detail/CVE-2026-97045) / [GO-2026-6866](https://pkg.go.dev/vuln/GO-2026-6866) <details> <summary>More information</summary> #### Details In childTextNodesAreLiteral, walking up the tree previously stopped at the nearest foreign ancestor once an HTML integration point was found. However, that integration point may itself be a descendant of an element that was foster-parented into a foreign namespace (such as <mglyph> or <malignmark> fostered under <mtext>), causing a parser to resolve the subtree in a different foreign namespace upon re-parsing the rendered output. Continue walking the full ancestor chain and verify that every transition from a non-empty namespace occurs at an HTML integration point before emitting literal text. #### Severity Unknown #### References - [https://go.dev/cl/855121](https://go.dev/cl/855121) - [https://go.dev/issue/82622](https://go.dev/issue/82622) - [https://groups.google.com/g/golang-announce/c/sqrs2vTx_Xs](https://groups.google.com/g/golang-announce/c/sqrs2vTx_Xs) This data is provided by [OSV](https://osv.dev/vulnerability/GO-2026-6866) and the [Go Vulnerability Database](https://redirect.github.com/golang/vulndb) ([CC-BY 4.0](https://redirect.github.com/golang/vulndb#license)). </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/cozystack/cozystack). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzQuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjI0OS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWF0ZWQiLCJzZWN1cml0eSJdfQ==--> |
||
|
|
64cd55a161 |
feat(kubernetes): run tenant clusters inside a cozyplane VPC (#5337)
## What this PR does Stacked on #4508 (VMs in a cozyplane VPC). This layer runs a whole tenant Kubernetes cluster inside a VPC: the control plane, its etcd and the worker VMs. The `Kubernetes` cluster and each of its `KubernetesNodes` pools set the same `network: {name: <VPC catalog name>}`. A VPC refuses cluster-internal destinations, so the workers, the tenant's own pods and the konnectivity agents all need an apiserver address inside the VPC. The platform side keeps working unchanged: it reaches VPC pods by their fabric IPs and through ClusterIPs that resolve to them. That covers Kamaji, CAPI, kccm, the cluster autoscaler, the chart's Jobs, the ingress passthrough, and the `super-admin.svc` kubeconfig Flux installs the tenant addons with. **Control plane.** `network.name` on the `Kubernetes` cluster does three things: - puts the apiserver pods in the VPC (`deployment.podAdditionalMetadata`); - attaches their Service to it (`network.serviceAnnotations`), so that inside the VPC the resolver answers the Service's name with a VIP from the VPC's own range; - stamps the cluster's own etcd through the `annotations` key of `cozy-lib.etcd.cluster`. etcd-operator copies that annotation onto the member Pods and both etcd Services, so the apiserver reaches its DataStore entirely inside the VPC. **Advertise address.** Kamaji's `advertiseAddress` is what the tenant's `kubernetes` endpoints and the konnectivity agents dial, and its CRD requires an IP. The right IP is the apiserver Service's VIP, which only a pod inside the VPC can learn. In VPC mode each pool's talos-reconcile Job starts a short-lived probe pod in the VPC. The probe resolves the Service's FQDN and writes the answer to its termination message. The Job reads that back with a namespaced pod `get`, patches `advertiseAddress` (Kamaji adds it to the apiserver certificate itself), and uses the VIP for the workers' `extraHostEntries` in place of the ClusterIP. This happens before the pool's TalosConfigTemplate is applied, so Kamaji's one rollout runs while the cluster has no workers yet. The Job's Role gains `create` on pods plus `get`/`delete` on the probe pod by name, in VPC mode only. **Workers.** Each pool stamps `sdn.cozystack.io/vpc` on its worker VM template, only when set, because the KubevirtMachineTemplate is content-hash named. **Route table.** A pool can also name a cozyplane RouteTable with `routeTable` (a DNS-1123 name, empty by default), the same contract as `vm-instance`'s value in #4508. When it is set, the pool renders `sdn.cozystack.io/route-table: <routeTable>` on its worker VM template next to `sdn.cozystack.io/vpc`, and setting or changing it rolls the pool's workers, as `network` does. Empty renders nothing, which leaves the VPC's default table in effect. The render fails with `routeTable` on a cluster that does not serve `sdn.cozystack.io`, on `substrate: proxmox`, or without `network.name`. The control plane keeps the VPC's default table. **Guards**, all unit-tested. The cluster refuses `network.name`: - where `sdn.cozystack.io` is not served; - on the proxmox substrate; - on the tenant's shared DataStore; - on a running cluster outside that VPC, in either direction, because etcd-operator never re-stamps a running member. A pool refuses a network that differs from its control plane's, again in either direction, checked against the live apiserver Service. Design notes: - **The probe is interim.** A request for cozyplane to report an attached Service's VIP on the Service itself (`sdn.cozystack.io/vpc-ip`, the same annotation the CNI stamps on pods) is going to upstream. Once it ships, the Job reads the annotation and the probe goes away. - **The rejected alternative is a LoadBalancer.** Publishing the apiserver Service and reaching it through the VPC gateway's NAT spends a published address per cluster and makes NAT a dependency of the control path. Not verified on a live stand yet: - the probe's resolution through the VPC resolver; - worker bootstrap and konnectivity through the VIP; - etcd member peering inside the VPC; - OIDC mode, where the apiserver dials Keycloak's internal URL from inside the VPC. ### Screenshots Not a UI change. ### Downstream repositories Walked the trigger map against the diff. terraform-provider-cozystack models app fields by hand, so the new `network` (both apps) and `routeTable` (KubernetesNodes) fields need its schema, model and expand/flatten; that is cozystack/terraform-provider-cozystack#90. The website's reference pages for kubernetes and kubernetes-nodes are regenerated from their READMEs on release, and both apps are in the website's app lists, so no follow-up is needed there. Nothing else in the map is touched. - [ ] 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#90 - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note feat(kubernetes): on the cozyplane networking variant, a tenant Kubernetes cluster can run entirely inside a VPC — network.name puts its control plane, its own etcd and its worker VMs in the VirtualPrivateCloud ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Kubernetes clusters now use dedicated etcd by default, with configurable one- or three-member setups and storage options. Existing clusters using shared etcd retain their current configuration. * Clusters and worker pools can join a cozyplane VPC, subject to platform and compatibility requirements. Changing a worker pool’s network rolls its worker VMs. * Cluster status notes now identify the etcd configuration in use. * **Bug Fixes** * Enabled Kubernetes add-ons and supporting services can render independently of tenant-shared etcd availability. * Cluster cleanup now handles dedicated etcd resources. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
94c79925f8 |
feat(api): add the credentials API with mint and revoke subresources (#4921)
## What this PR does Tenants read application passwords from Secrets today, and a leaked password can't be taken back. This PR adds the platform side of the user secrets API design (cozystack/community#137, ADR 0002): a password comes out once from a mint, the next mint replaces it, and a revoke kills it. The engines are converted in the PRs stacked on top, starting with Postgres in #4922. How it works: - A kind's chart renders one `CredentialTemplate` (`cozystack.io/v1alpha1`) per account: the username, the stored format (`scram-sha-256`, `mysql-native`, `sha256` or `plaintext`), labels for the account Secret, and an optional `valuesPath` for an operator that reads no Secret. - cozystack-controller keeps the account Secret `<template>.account`. It seeds it on a release the API marked for seeding, adopts an unowned Secret with the same username, leaves a foreign one alone with a `SecretConflict` condition, and mirrors the record (origin, time, actor, history) into the template status. For a `valuesPath` template it maintains an optional `valuesFrom` entry on the release. - `core.cozystack.io/v1alpha1` serves `credentials` as a read-only view of the templates, plus `mint` and `revoke` subresources. A mint checks the caller's `resourceVersion` precondition against the mirrored status, builds the whole Secret and writes it in one request, or answers 409. It never reads the Secret back. One API request writes one object; the best-effort Event is the only extra write. - The Application API marks a new release for seeding, keeps the account `valuesFrom` entries when it rewrites a release, and refuses to delete a suspended release that still has accounts, since Flux would skip its uninstall. - The dashboard gets a Credentials tab on the application page. It lists accounts with origin and history; an administrator can mint or revoke, and a viewer sees no buttons. The application charts are untouched here: a kind starts using this only when its chart renders templates. The `CredentialFormat` webhooks that ADR 0002 describes are not in this PR, so `format.name` accepts only the four built-in names for now. ### Screenshots <img width="1440" height="900" alt="01-admin-tab" src="https://github.com/user-attachments/assets/8c48086c-8f6c-4908-82c1-40e9078afe57" /> <img width="1440" height="900" alt="02-mint-dialog" src="https://github.com/user-attachments/assets/802b2963-3f57-4c0b-ab84-f74bad28c343" /> <img width="1440" height="900" alt="03-mint-result" src="https://github.com/user-attachments/assets/0e9ae3cc-7a3c-4daf-9a09-d4abf53bf70b" /> <img width="1440" height="900" alt="04-viewer-tab" src="https://github.com/user-attachments/assets/10e940f2-4ceb-469d-a0f9-6c9d20a62919" /> ### Downstream repositories - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: needed, cozystack/website#753 should document the `Credential` mint/revoke flow and the dashboard tab - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: needed later, a way to mint from Terraform; nothing breaks in this PR alone - [ ] [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: none, the design is cozystack/community#137 ### Release note ```release-note feat(api): Add the credentials API. Applications that support it expose their accounts as `credentials.core.cozystack.io`; an administrator mints a password once with the `mint` subresource, and `revoke` invalidates it without issuing a new one. The dashboard shows a Credentials tab for such applications. No application uses it in this release on its own; see the per-engine changes. ``` |
||
|
|
eec761a40f |
feat(kubernetes-nodes): choose a cozyplane route table
A worker pool in a VPC always routed by the VPC's default table. routeTable names a cozyplane RouteTable for every worker VM of the pool and renders sdn.cozystack.io/route-table on the worker VM template, the same contract as vm-instance's routeTable. It fails the render where cozyplane does not serve sdn.cozystack.io, on proxmox workers, and without network.name. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
9e7741449c |
feat(kubernetes): run tenant clusters inside a cozyplane VPC
On the cozyplane networking variant a VPC refuses cluster-internal destinations, so a tenant cluster whose workers join a VPC must bring its control plane along: the workers, the tenant's own pods and the konnectivity agents all need an apiserver address inside the VPC. The platform side keeps working unchanged, since it reaches VPC pods by their fabric IPs and through ClusterIPs that resolve to them. network.name on the Kubernetes cluster puts the apiserver pods in the VPC, attaches their Service to it, and stamps the cluster's own etcd, whose operator copies the annotation onto the members and both etcd Services, so the apiserver reaches its DataStore inside the VPC too. The same value on each KubernetesNodes pool stamps its worker VM template. Kamaji's advertise address must be an IP that tenant consumers reach, which here is the VIP the VPC knows the apiserver Service by. Only a pod inside the VPC can learn it, so the pools' talos-reconcile Job starts a probe pod in the VPC, reads the address it resolves back from its termination message, advertises it, and gives it to the workers' host entries in place of the ClusterIP. The cluster refuses a VPC where sdn.cozystack.io is not served, on the proxmox substrate, on the tenant's shared DataStore, and on a running cluster outside that VPC, since etcd-operator never moves a running member. A pool refuses a network that differs from its control plane's. Both checks hold where a live object does not exist yet: the pools' reconcile Job compares the apiserver Service's VPC before the probe, and the etcd render compares the live EtcdCluster's. The probe's Role grants only get and delete, so a probe left by an interrupted attempt is deleted without waiting and polled with get. network.name is a DNS-1123 label in both apps, and every annotation carrying it is quoted. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
16d0f1fd19 | chore(deps): update module golang.org/x/net to v0.62.0 [security] | ||
|
|
8cab9b7d7b |
refactor(tenant): make gateway a plain bool (#5408)
<!-- 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 <!-- Link the issues this PR addresses. For a complete fix targeting the default branch, use Closes #N (Closes owner/repository#N for another repository). Otherwise use a non-closing reference; release-branch PRs need manual issue linking and closure when appropriate. --> Closes #4542. Makes `tenant.spec.gateway` a plain boolean defaulting to `false` and removes the unset-specific helper branch. Both `false` and an omitted key retain the existing behavior: the tenant owns no Gateway and inherits the nearest ancestor Gateway. Setting `true` still gives the tenant its own Gateway. The API now serializes `gateway: false`, and the dashboard shows the `gateway` checkbox next to `ingress`, unchecked by default. The chart test now verifies the rendered namespace label for both `false` and `true`. ### 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. --> N/A ### 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. --> I walked the trigger map against the diff. The tenant `gateway` default and API serialization change reaches the hand-written Terraform provider's documentation and key-presence/null assumptions. Follow-up is tracked in cozystack/terraform-provider-cozystack#88; no provider change is included in this PR. The website already lists tenant in its managed app set, and its stable-tag automation regenerates the tenant reference from README, so no manual website follow-up is required. No other downstream trigger applies. - [ ] 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#88 - [ ] [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 refactor(tenant): make `gateway` a plain boolean defaulting to `false`; the dashboard now shows the `gateway` checkbox next to `ingress`, unchecked by default. Existing routing behavior is unchanged: `false` or an omitted value inherits the nearest ancestor Gateway, while `true` gives the tenant its own Gateway. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Documentation** * Clarified that `gateway: false` is the default and uses the nearest ancestor’s Gateway, falling back to Ingress when no ancestor owns one. * Updated tenant configuration references to display the Gateway setting and its class in the dashboard. * **Bug Fixes** * Confirmed that `gateway: false` inherits the parent Gateway without creating a tenant-owned Gateway, while `gateway: true` identifies the tenant namespace as owning its dedicated Gateway. * Tenant configuration now includes the Gateway value explicitly when it is false. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
9bb661408a |
refactor(tenant): make gateway a plain bool
Assisted-by: LLM Signed-off-by: toribru <161638395+toribru@users.noreply.github.com> |
||
|
|
37486083b9 |
feat(vm-instance): choose a cozyplane route table
cozyplane routes a pod by the RouteTable its sdn.cozystack.io/route-table annotation names, and the VPC's default table when it names none. A VM had no way to pass one, so a route such as 0/0 to the internet could only be reached by annotating the VM by hand. routeTable renders the annotation next to the VPC one, and fails the render where no VPC or no cozyplane would read it. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
a24bdb758b |
feat(vm-instance): join a cozyplane VPC by pod annotation
On the cozyplane networking variant there is no multus, so a VM that listed a network rendered a multus attachment that can never resolve and sat Pending forever. When the cluster serves sdn.cozystack.io — detected by API discovery, the same way the Kube-OVN IP pinning is — the chart now stamps sdn.cozystack.io/vpc: virtualprivatecloud-<networks[0].name> on the virt-launcher pod (the bare name resolves in the VM's own namespace) and renders no multus networks and no secondary interfaces: the VM keeps its single pod interface and the CNI gives it its VPC identity. A cozyplane pod joins exactly one VPC, so more than one network entry fails the render by name rather than attaching silently to the first. The Cilium-variant multus path is unchanged, and the suite pins both branches. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
907d369813 |
feat(postgres): add an audit toggle for access and statement logging (#5404)
## What this PR does Managed Postgres can already load pgaudit through the `sharedPreloadLibraries` allowlist and set `pgaudit.log`/`log_connections` through `postgresql.parameters`, but that leaves an orchestrator such as a customer-facing panel depending on internal parameter names to answer "who connected and what did they run". This adds an `audit` block that bundles access and statement auditing behind a single switch. With `audit.enabled`, the chart adds `pgaudit` to `shared_preload_libraries` and seeds `pgaudit.log` (set by `audit.log`, default `write, ddl, role`), `log_connections` and `log_disconnections`. The audit parameters are seeded as defaults, so an explicit `pgaudit.log` or `log_connections` in `postgresql.parameters` still takes precedence. The audit records go to the instance log, which the platform log stack already collects, so they are queryable per database by its labels without extra wiring. `audit` is off by default, and toggling it restarts PostgreSQL because pgaudit is a preloaded library. Postgres only; MariaDB, MongoDB and ClickHouse auditing are left for follow-ups. ### Screenshots Not applicable — no UI change. ### Downstream repositories Walked the trigger map against the diff. One repository is reached: `cozystack/terraform-provider-cozystack` hand-models each postgres `values.schema.json` field, and this diff adds the `audit` block to that schema, so the provider would need the field added to its postgres schema and its expand/flatten pair. That is separate work there, tracked in cozystack/terraform-provider-cozystack#87. The website postgres reference page regenerates from the package `README.md` on release, so it needs no manual follow-up, and `ansible-cozystack` carries no postgres values key. - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [x] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: cozystack/terraform-provider-cozystack#87 - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note feat(postgres): managed PostgreSQL gains an `audit` toggle that enables pgaudit statement auditing and connection logging, with the audited classes set by `audit.log` (default `write, ddl, role`). ``` |
||
|
|
ba0ff0f8e8 |
fix(kafka)!: require SCRAM-SHA-512 on the external listener (#5156)
<!-- Thank you for making a contribution! Here are some tips for you:
- Use Conventional Commits for the PR title: `type(scope): description`
- Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore
- Scopes are not an exhaustive list — pick the most specific scope for
the change and extend the list when a genuinely new area appears.
Examples:
- System components: dashboard, platform, operator, cilium, kube-ovn,
linstor, fluxcd, cluster-api
- Managed apps: postgres, mariadb, redis, kafka, clickhouse,
virtual-machine, kubernetes
- Development and maintenance: api, hack, tests, ci, docs, maintenance
- Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or
add a `BREAKING CHANGE:` footer
- If it's a work in progress, consider creating this PR as a draft.
- Don't hesistate to ask for opinion and review in the community chats,
even if it's still a draft.
- Add the label `kind/backport` if it's a bugfix that needs to be
backported to a previous version.
-->
## What this PR does
With `external: true` the chart renders a Strimzi listener `external` on
port 9094, `type: loadbalancer`, with TLS on by default but **no
`authentication` block**. Anyone who can reach the public LoadBalancer
address can produce and consume on every topic; TLS only encrypts the
session. The entity operator's User Operator is already deployed, but
nothing declares a KafkaUser.
This PR:
- adds `authentication: {type: scram-sha-512}` to the `external`
listener. The internal listeners (9092 plain, 9093 TLS) are unchanged;
- adds a `users` map. Each key renders a `KafkaUser`
(`kafka.strimzi.io/v1`, `strimzi.io/cluster: <release>`,
`authentication.type: scram-sha-512`) named `<release>.<user>`; the dot
keeps it from spelling any Secret Strimzi derives from a cluster name,
this release's or another's. That name is also the SCRAM username and
the name of the Secret into which the User Operator writes the generated
password (`password`, `sasl.jaas.config`). The release prefix keeps two
Kafka instances in one tenant namespace from colliding;
- refuses user names that are not valid object names;
- lets the tenant read each user's Secret via the existing
`<release>-dashboard-resources` Role, and shows it in the tenant-secret
API: the Kafka ApplicationDefinition selects Secrets labelled
`strimzi.io/kind: KafkaUser`. The instance scope comes from the Secret's
ownership; a templated label value would never match, since only
`resourceNames` are rendered
(`internal/lineagecontrollerwebhook/kafka_rd_secrets_test.go` runs the
Strimzi Secrets through the matcher);
- rewrites the `tls.enabled` description, which said Strimzi provides no
authentication on this listener. Without TLS the data and the SCRAM
exchange are exposed, not the password itself;
- documents the client settings (SASL, truststore from
`<release>-cluster-ca-cert`) and two upgrade sequences in the README.
Passwords are always generated by Strimzi. I did not add a `password`
field like RabbitMQ's; that can come later.
**Known limit:** no ACLs. The cluster has no `authorization`, so every
authenticated user can read and write every topic. Per-user ACLs are a
follow-up.
**Breaking:** an instance with external access refuses unauthenticated
clients after the upgrade. The previous chart cannot create the users
from `users`, so the README gives two sequences: a maintenance window
(declare `users`, upgrade, then configure clients), or credentials
staged ahead by a cluster administrator through `KafkaUser` objects
carrying Helm's ownership metadata, which the upgrade adopts with their
passwords unchanged. Neither has been run on a live cluster.
**Tests**
- New `tests/external_authentication_test.yaml` (11 cases).
- The listener assertions in `kafka_test.yaml` and `kafka_tls_test.yaml`
now include the `authentication` block.
- `helm unittest packages/apps/kafka`: 114 passed.
- Not deployed on a live cluster.
**Backport:** none. Refusing existing clients after an upgrade does not
belong in a patch release, so this stays on `main` and lands in the next
minor (`backport/skip`).
### Screenshots
<!-- REQUIRED for UI changes: attach screenshots or screen recordings
demonstrating
the visual impact of your changes. PRs with UI changes without
screenshots will not be merged. -->
### Downstream repositories
<!--
Cozystack is upstream for repositories that are NOT kept in sync with it
automatically, and nothing in CI compares the two sides, so a change
here can break them silently.
Which change forces what, and which file to touch, is the trigger map in
docs/agents/contributing.md under "Downstream Repositories". Walk it
before you tick anything.
IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM
TO FILL IN:
1. Walk the trigger map against the actual diff of this PR, file by
file. Do not decide from the PR title or from your memory of what you
changed.
2. For every repository you tick, open the follow-up PR there and link
it on the same line. A ticked box with no link claims work that does not
exist, which is worse than an empty box. Search that repository for an
open PR or issue covering it first, and link that instead of filing a
duplicate.
3. When the follow-up is out of scope, or needs a decision that is not
yours to make, open an issue in that repository instead, link that, and
say so in the PR body. Do not push a speculative PR into another
repository just to fill a line here.
4. Do not tick "No downstream repository is affected" to make the
checklist go away. If you are unsure, leave every box empty and say so
in the PR body, so a human decides.
-->
- [ ] No downstream repository is affected by this change
- [ ] [cozystack/website](https://github.com/cozystack/website) -
follow-up:
- [x]
[cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack)
- follow-up: cozystack/terraform-provider-cozystack#86 (issue: model the
`users` map on the Kafka resource and data source)
- [ ]
[cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack)
- follow-up:
- [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up:
- [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up:
- [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) -
follow-up:
- [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) -
follow-up:
- [ ]
[cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server)
- follow-up:
- [ ]
[cozystack/external-apps-example](https://github.com/cozystack/external-apps-example)
- follow-up:
- [ ] [cozystack/examples](https://github.com/cozystack/examples) -
follow-up:
- [ ] [cozystack/community](https://github.com/cozystack/community) -
follow-up:
### Release note
<!-- Write a release note:
- Explain what has changed internally and for users.
- Start with the same `type(scope):` prefix as in the PR title
- Follow the guidelines at
https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md.
-->
```release-note
fix(kafka)!: the external listener (port 9094, enabled by external: true) now requires SCRAM-SHA-512 authentication instead of accepting anonymous clients. Declare clients in the new users map; each gets a KafkaUser named <release>.<user> whose generated password is in the Secret of the same name. External clients of an instance with external access are refused after the upgrade until they authenticate; see "Upgrading an instance that has external access" in the Kafka README for a maintenance-window sequence and one that stages the credentials ahead.
```
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **New Features**
* Configure SCRAM-SHA-512 users for external Kafka access. Each user
receives generated credentials and read/write access to all topics;
credential Secrets are available to tenant resources.
* Invalid, reserved, or overlong user names are rejected.
* **Documentation**
* Clarified that external access requires SCRAM-SHA-512 authentication,
even when TLS is disabled. Without TLS, data is unencrypted and the
authentication exchange is exposed, but the password is not.
* Added external-client connection guidance, certificate trust
information, and upgrade instructions for configuring credentials.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
|
||
|
|
9e7c684fe2 |
feat(api): add the CredentialTemplate kind
An application write in the Cozystack API that kept an account list, its Secrets and the HelmRelease in step needed a cross-replica lock and still raced. The accepted design (cozystack/community#137) moves the account list to the chart instead: a kind's chart renders one cozystack.io CredentialTemplate per account, naming the user, the stored format and the Secret's labels, and its status mirrors the account Secret's record so the Credential view reads templates only. Tenants cannot write a template, and username is immutable because the account Secret's name derives from it. valuesPath starts with "_" so the Application API hides it on read and refuses it on write. Design: https://github.com/cozystack/community/blob/main/design-proposals/user-secrets-api/README.md Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com> |
||
|
|
0ab26f7a8e |
feat(api): add the Credential kinds
Cozystack generates managed application passwords at Helm render time and keeps them in a Secret tenants can read again at any time, which a deployment whose policy requires a credential shown once cannot accept. The accepted design moves generation into the platform: each account of a converted application gets a core.cozystack.io Credential, the record of who set its password and when, never the value, and its mint and revoke subresources take a TokenRequest-shaped CredentialRequest. Design: https://github.com/cozystack/community/blob/main/design-proposals/user-secrets-api/README.md Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com> |
||
|
|
d65fe65f0f |
fix(kubernetes): refuse Proxmox template tags naming another Talos
On Proxmox the template the tags select is the worker's boot disk, and talos.version reaches only the installer in the machineconfig. The bump of the default changes that machineconfig and rolls every pool, so a pool still tagged for the previous release would clone the old template and keep the vulnerable kernel while its config names the fixed one. The template script tags each template talos-<version>, which is the one link the chart can check; a tag set naming no release is left to the operator. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
470e4c55a7 |
fix(kubernetes): bump tenant worker Talos to v1.13.12 (CVE-2026-99999)
Tenant worker VMs default to Talos v1.13.6, whose kernel predates the
upstream fix for CVE-2026-99999 (PwnEscape), Linux commit 6785011f8b16
("ipv4: validate checksum_start before completing checksum"). The bug
lets a guest escape into its host, and a tenant worker is a host
whenever the tenant runs nested virtualization inside it. The fix was
backported in Linux 6.18.57, which Talos v1.13.12 ships.
The workers stay on the v1.13 line rather than following the host
nodes to v1.14: Talos v1.14 drops Kubernetes 1.31 and 1.32, which the
tenant chart still offers, so a v1.14 default would fail the
support-matrix guard and break the render of those clusters. The v1.13
matrix entry is unchanged.
The new release changes the worker machine config and the golden image
name, so the content-hashed TalosConfigTemplate names and the default
golden DataVolume name pinned in the chart tests move with it.
Signed-off-by: Mattia Eleuteri <mattia@hidora.io>
Assisted-by: LLM
|
||
|
|
442768abb7 |
feat(kubernetes): give each tenant Kubernetes cluster its own etcd (#4817)
## What this PR does A tenant Kubernetes cluster could not start until an ancestor `Tenant` had `spec.etcd: true`. The chart read the datastore name from `_namespace.etcd` and, with none, rendered only a `<release>-awaiting-etcd` ConfigMap. Every cluster below that tenant then shared one etcd, one CA and one disk, separated by key prefix only. Whoever creates a cluster usually may not edit the `Tenant`, so anything ordering clusters on a tenant's behalf (the portal's controller, for one) had to flip `etcd: true` first. This PR makes the `Kubernetes` application carry its own etcd. It implements phases 1 and 2 of the per-cluster etcd design proposal, [cozystack/community#25](https://github.com/cozystack/community/pull/25), as three commits that can be split later: 1. `refactor(etcd)`: the etcd chart's `EtcdCluster`, cert-manager PKI, `DataStore`, `WorkloadMonitor`, defrag `CronJob`, VPA and `VMPodScrape` move into named templates in `cozy-lib` (`packages/library/cozy-lib/templates/_etcd.tpl`), parameterised by the cluster name. `packages/extra/etcd` calls them with `"etcd"`, and its rendered output is byte-identical before and after (see Verification). 2. `feat(kubernetes)`: a new cluster renders its own `EtcdCluster` and `DataStore` from those templates, and a cluster that already runs on a shared tenant etcd keeps it. 3. `feat(platform)`: migration 63 → 64 reports which clusters stay on a shared etcd and changes nothing. Phases 3 and 4 (deprecating, then removing `Tenant.spec.etcd`, `_namespace.etcd` and `cozy-lib.ns-etcd`) are left for later. ### Design **Names.** For release `kubernetes-<name>` in namespace `<ns>`: | Object | Name | |---|---| | `EtcdCluster`, its headless Service, members `<…>-xxxxx`, `<…>-client` Service | `kubernetes-<name>-etcd` | | Secrets | `kubernetes-<name>-etcd-{ca,client,server,peer,peer-ca}-tls` | | `DataStore` (cluster-scoped) | `<ns>.kubernetes-<name>` | | DataStore endpoint | `kubernetes-<name>-etcd.<ns>.svc:2379` | **Shared templates.** `cozy-lib.etcd.cluster` takes optional `labels` and `annotations` and renders them into the `EtcdCluster`'s `spec.additionalMetadata`, which etcd-operator copies onto every member Pod and PVC. With neither set, it renders no `additionalMetadata` at all. **Values.** One new field, `etcd.replicas`: `3` (default) or `1`. The schema bounds it to 1..3 and the chart refuses 2 at render time. Size (4Gi), resources (1000m / 512Mi limits to start with) and the etcd version (3.6.11, the etcd chart's default) are chart-internal. Where a VerticalPodAutoscaler runs, it sizes each member's requests as it is recreated, up to 5000m CPU / 8Gi memory divided by the platform's CPU and memory allocation ratios (500m / 8Gi at the default ratios of 10 and 1), with the limits scaled in proportion; NOTES.txt and the README say so. **StorageClass.** Two new platform values, `kubernetesEtcd.storageClassLocal` and `kubernetesEtcd.storageClassReplicated`, reach the chart as `_cluster.etcd-storage-class-local` (used with 3 members) and `_cluster.etcd-storage-class-replicated` (used with 1 member). Empty keys fall back to the namespace default StorageClass. `spec.storage.storageClassName` is immutable on an `EtcdCluster`, so the chart reads the live object's class on every render after the first and never re-derives it; scaling 1 → 3 keeps the class the cluster started with. Dropping from 3 members to 1 is refused at render time when the etcd is on the class the platform names for 3 members, or off the class it names for 1, because a single member would then hold the only copy of the control-plane state on storage that does not replicate it. An etcd that was created with one member keeps rendering whatever its class. **New clusters vs existing ones.** The chart decides from the live `KamajiControlPlane`, looked up by release name: - no `KamajiControlPlane`, or one whose `spec.dataStoreName` is the cluster's own name: own etcd; - one that names any other `DataStore`: that `DataStore` is kept, and the chart renders no etcd of its own. Clusters stuck in the old awaiting-etcd state have no `KamajiControlPlane`, so they get their own etcd on their next reconcile. `_namespace.etcd` is deliberately not the signal. `packages/system/cozystack-basics/templates/cozystack-values-secret.yaml` hardcodes `etcd: tenant-root`, and `packages/apps/tenant/templates/namespace.yaml` passes it down, so every tenant publishes a value whether or not an etcd runs behind it. Honouring it for new clusters would change nothing for anyone. Following it for existing clusters is also wrong: today, switching on `spec.etcd` for a mid-level tenant silently moves every cluster below it to a new datastore, which is a Kamaji datastore migration. With this PR, the live binding sticks. An existing cluster renders exactly what it rendered before, pre-delete hook included, apart from randomly generated Talos tokens, so the upgrade rolls no control-plane pods. New clusters carry `policy.cozystack.io/allow-to-etcd-cluster` instead of `policy.cozystack.io/allow-to-etcd`, which only admits a cluster to its tenant's shared etcd. Both lookups the decision rests on read the chart's own live objects: the binding its `KamajiControlPlane` already records, and the immutable `storageClassName` of its `EtcdCluster`. Each gives the same output on every render, and their empty branch is the new-cluster render offline `helm template` sees, which is the kind of `lookup` the chart guidelines allow. **What goes away.** The `awaiting-etcd` beacon goes, along with the `_namespace.etcd` gate on the ~25 addon and satellite templates (`helmreleases/*`, `csi/deploy.yaml`, `kccm/manager.yaml`, `cluster-autoscaler/deployment.yaml`, `ingress.yaml`, the Proxmox CCM and CSI). A datastore now always exists, so these gates were always true. **Deletion.** The pre-delete hook deletes the `TenantControlPlane` and waits up to 120s, and it exits 0 whatever is left, because a failing pre-delete hook keeps the release and retries the same teardown; the one exception is below. Kamaji's `finalizer.kamaji.clastix.io` drops the tenant's etcd role, prefix and user and the datastore-config Secret's finalizer, and it runs only while the `DataStore` is Ready and answers, so a `TenantControlPlane` whose own etcd never came up or has lost quorum would never finish deleting. On a cluster that owns its etcd, those three objects live in the etcd this uninstall deletes next. So when such a `TenantControlPlane` outlives the wait, the hook (Step 4a) removes that one finalizer with a JSON patch that tests it at the index it was read at, waits another 60s, and lets Step 4b clear the Secret's finalizer as before. A `TenantControlPlane` on a shared `DataStore` is left to Kamaji, since that etcd outlives the cluster. The hook also deletes the etcd's five Certificates and then their Secrets (Step 8), which cert-manager issues without an owner, in the same order and for the same reason as Step 7 deletes the Talos PKI. Then: - Helm removes the `EtcdCluster`, `DataStore` and the remaining objects; - the member PVCs go by garbage collection, because the operator owns them through the `EtcdMember`s. If Step 4a's patch is rejected, or the `TenantControlPlane` cannot be read, the hook prints its residue summary and fails before Step 8: Helm would otherwise delete the etcd while Kamaji's finalizer still waits on it, so the uninstall is retried with the etcd and its PKI in place. Steps 4a and 8, that check and their RBAC (a `patch` on this release's `TenantControlPlane`, and `delete` on the etcd Certificates and Secrets by name) render only for a cluster that owns its etcd. ### Deviations from cozystack/community#25 - **DataStore name** is `<namespace>.<release>`, not `<namespace>-<release>`. Tenant names are alphanumeric and nest with dashes, so the dashed form collides: Kubernetes `foo` in `tenant-a` gives `tenant-a-kubernetes-foo`, which is also the namespace, and therefore the shared `DataStore` name, of tenant `foo` under tenant `kubernetes` under `tenant-a`. A namespace cannot contain a dot. Kamaji copies the `DataStore` name into the pod label `component.kamaji.clastix.io/datastore`, so the name is capped at 63 characters, truncated with an 8-character hash past that. - **No truncate-and-hash for `kubernetes.etcdName`.** The app name is now capped at 32 characters (`@maxLength 32`, added with the nodes split), so `kubernetes-<name>-etcd` is at most 48 characters. That is inside the 56 the operator needs: the `<name>-client` Service and the generated member names must fit in 63. The helper fails the render past 56 rather than rename anything. - **"Honour an explicit `_namespace.etcd`"** means keeping a cluster on the `DataStore` its live control plane names, for the reason above. It does not mean following `_namespace.etcd` for new clusters. - **`etcd.replicas` validation** is a schema range of 1..3 plus a render-time refusal of 2, rather than a schema enum. `cozyvalues-gen` v1.7.0, the version CI pins and the latest release, emits string members for an integer enum, which would reject the default `3`. The aggregated API does not validate an application's spec against its schema at all, so neither an enum nor a CEL rule would refuse 2 at admission; Helm's `values.schema.json` check and the render are where it is refused. - **The delete-hook branch** keys on the same live-`KamajiControlPlane` condition as the render, as #25 asks, and additionally checks at run time that the `TenantControlPlane` names this cluster's own `DataStore` before touching Kamaji's finalizer. Helm deletes release resources only after the pre-delete hook, so the etcd outlives Kamaji's normal finalization without any ordering inside the hook. - **TLS** reuses the etcd chart's `secretRef` shape (chart-issued certificates) rather than the operator's `certManager` mode. Kamaji's `DataStore` needs the CA private key to sign each tenant's client certificate, and `secretRef` keeps that key in a Secret the chart controls. The server certificate also carries the operator's `<name>-client` Service names, which the etcd chart's does not. - **Satellites.** The `PrometheusRule` stays in the etcd chart only, so a cluster's own etcd has no alert rules. `VMPodScrape`, VPA and the `CiliumNetworkPolicy` render only where their APIs are served. The etcd chart's `VMPodScrape` now selects `app.kubernetes.io/instance: etcd` instead of `app.kubernetes.io/name: etcd`: etcd-operator stamps the latter on every member it runs, so a tenant etcd would otherwise also scrape the cluster etcds in its namespace and count their members as its own. - **Name budget.** The defrag `CronJob` is `<etcd name>-defrag`, which reaches 55 characters for a 32-character app name while the apiserver caps CronJob names at 52; past 52 the template truncates it and appends an 8-character hash. The etcd chart's `etcd-defrag` is unaffected. - **Defrag image.** The defrag container pulls `ghcr.io/ahrtr/etcd-defrag:v0.13.0` through `cozy-lib.image`, pinned to the multi-architecture index digest, so a configured registry mirror applies; `_etcd.tpl` is tracked by Renovate and listed in `IMAGE_REF_EXTRA_FILES`. This changes the etcd chart's CronJob too, after the extraction commit. Contributed by @yankawai in #5387 and folded in. - **Migration.** The opt-in migration runbook is not implemented here (see below), and no `talosconfig` is issued. The numbered migration only reports, as #25 suggests. ### Gaps #25 did not cover - **Backups.** Covered through the `Kubernetes` backup strategy (#4931), which `cozy-default` routes `apps.cozystack.io/Kubernetes` to. It resolves the datastore from the `TenantControlPlane`, so it dumps the cluster's key prefix from its own etcd or a shared one alike. Its dump Job runs in the application namespace, and the deny policy below would refuse it, so the strategy's pod template now carries `policy.cozystack.io/allow-to-etcd-cluster: {{ .Release.Prefix }}{{ .Release.Name }}-etcd`, which is inert for a cluster on a shared etcd. The strategy's Velero half does not select the etcd's PVCs or TLS Secrets and does not need to: the dump restores into whatever etcd the control plane runs on. - **Per-cluster network policy.** A `CiliumNetworkPolicy` named after the etcd selects its member pods with `ingressDeny` on 2379/2380 against two sets of pods and one entity. The first is pods in the tenant namespace that are neither members nor carry `policy.cozystack.io/allow-to-etcd-cluster: <etcd name>`, a label set on the control-plane pods, the defrag Job and the backup dump Job. The second is pods in any other namespace except `kube-system` and namespaces labelled `cozystack.io/system: "true"`, which is where Kamaji, its migrate Job and etcd-operator run. The entity is `world`, which the tenant's `allow-external-communication` admits to every endpoint, so sources off the cluster, such as Proxmox workers, are denied too. The node's own `host` and `remote-node` traffic is not. Deny rules are needed because the tenant's own policies allow all traffic within a namespace and from ancestor tenants, and allow rules only add. Metrics on 2381 stay open. The pods also carry `cozystack.io/service: kubernetes-etcd` rather than `cozystack.io/service: etcd`, so the tenant-wide `<tenant>-ingress-etcd` policy does not admit child tenants' control planes to them. The policy renders only where Cilium serves `cilium.io/v2/CiliumNetworkPolicy`. - **Platform ordering.** `cozystack.kubernetes-application` now `dependsOn` `cozystack.etcd-operator`. Both come with the isp-full variants, the only ones the iaas bundle allows. The selective-install fixture is unchanged (`hack/select-install.sh --disabled postgres` produces the same set). The same edge makes an etcd-operator change select the `kubernetes-latest`, `kubernetes-previous` and `computeplane` e2e suites besides `etcd`, and `hack/select-e2e_test.bats` now expects that. - **e2e.** - `hack/e2e-install-cozystack.bats` no longer turns on tenant-root's etcd, which only Kubernetes clusters used, and no longer waits for it. A cluster that fell back on a shared etcd would therefore not come up. - `run_kubernetes_test` asserts the control plane names `tenant-test.kubernetes-<name>` and that `kubernetes-<name>-etcd` reaches `Available`. - `kubernetes-latest` runs the shipped defrag CronJob once and asserts the Job completes (from #5387), then probes the etcd client port with `nc -z`: an unlabelled Pod in `tenant-test` and a labelled Pod in `tenant-root` must be refused, and a labelled Pod in `tenant-test` must connect as the control. Each Pod ends `Succeeded` only when its verdict matches, so a probe that cannot run fails the step. - `cozy_cleanup` waits up to 3m until the `EtcdCluster`, `DataStore`, member PVCs and Secrets are gone, each read bounded by that deadline; both Kubernetes suites' teardown op grows from 22m to 25m to cover it. - The Proxmox suite's tenant drops `etcd: true` and the comment calling it mandatory. - The ComputePlane suite's comment no longer cites #4726. - `hack/admin-kubeconfig-invariant.bats` drops its two awaiting-etcd cases, and the now-unused `tests/values-ci-no-etcd.yaml` goes with them. - **Generated artifacts** come from the tooling. `make -C packages/apps/kubernetes generate` produced `values.schema.json`, the README table, `api/apps/v1alpha1/kubernetes/types.go` and `packages/system/kubernetes-rd/cozyrds/kubernetes.yaml`. Root `make generate` regenerated `zz_generated.deepcopy.go`, and `pkg/generated/openapi` did not change. `make generate` in every touched package leaves the tree clean. - **Existing clusters.** Migration 63 → 64 lists every `KamajiControlPlane` whose `DataStore` its own release did not render, judged by Helm's release annotations on the `DataStore`, with that `DataStore`'s endpoints. It writes nothing but the version stamp. Slot check on 2026-11-23: - `main` ships through 62 (#5239) with `targetVersion: 63`; - `release-1.7` ships through 60 (target 61), and `release-1.6` through 53 (target 54); - so this PR takes 63 and sets `targetVersion: 64`. - **README.** `packages/apps/kubernetes/README.md` now describes the cluster's own etcd, the case of a cluster that keeps its tenant's shared one, the VPA sizing and the backup path. The ComputePlane README no longer lists a tenant etcd as a prerequisite. ### Migrating an existing cluster (designed, not implemented) Nothing here moves a cluster, and nothing should until the runbook below has an e2e. It combines #25's runbook with SerjioTT's Talos measurements of 2026-09-03 (about 20s copy, 43s from patch to Ready, reads uninterrupted) and with what Kamaji 26.9.4-edge's code does. 1. **Opt-in.** The opt-in has to make the chart render the cluster's own etcd beside the shared one, without switching `dataStoreName`. The likely shape is a chart-internal value, or an annotation the chart reads, that the operator sets. Wait for `Available=True`. 2. **Snapshot the source etcd.** This is the rollback path. 3. **Pre-flight reachability from the cluster's namespace, not Kamaji's** (SerjioTT finding 1). Kamaji's migrate Job runs in Kamaji's namespace and can reach any etcd, so the copy "succeeds" toward a target the control-plane pods cannot dial; the new apiserver generation then crash-loops and the cluster stays write-frozen. Run `nc -zv <target> 2379` from a pod carrying the control plane's labels in the cluster namespace. For the per-cluster target this holds by construction (same namespace, and the deny policy admits the control plane), but the check stays because rollback goes the other way. 4. **Switch.** Point `KamajiControlPlane.spec.dataStoreName` at `<ns>.<release>`, with the CAPI provider re-projecting it onto the `TenantControlPlane`. `kamaji.clastix.io/migration-timeout` can go on the `KamajiControlPlane`, because the provider copies annotations to the `TenantControlPlane`. Before switching, delete any leftover `migrate-<TCP UID>` Job in Kamaji's namespace: - a leftover with identical arguments is taken as success and switches the datastore without copying; - one with different arguments is deleted and recreated, with the freeze already installed. 5. **Verify writes, not status** (SerjioTT finding 2). Kamaji installs a `kamaji-freeze` ValidatingWebhookConfiguration in the guest, and only its soot controller removes it, only when the `TenantControlPlane` status is exactly `Ready`. A paused `TenantControlPlane`, or one sitting in `WriteLimited`, `Sleeping` or `Upgrading`, keeps the freeze. Node leases are exempt and reads are untouched, so nodes and `kubectl get` look healthy. The success criterion is a canary write through the guest API; if `kamaji-freeze` is still in the guest after the `TenantControlPlane` is `Ready`, delete it. 6. **Restart every worker kubelet, one node at a time** (SerjioTT finding 3). Until it restarts, a kubelet keeps running existing pods but never starts a newly bound one, so the cluster looks healthy and silently stops starting workloads. The per-node check is a new pod starting on that node. - On Talos there is no operator path to the workers' API today: the chart has a per-cluster `talos-ca` Issuer but issues no client credentials from it, so the fallback is `virtctl restart` per VM. - Issuing an operator `talosconfig` from that CA alongside the admin kubeconfig is the follow-up that makes this step cheap. It is not in this PR: it is a separate credential with its own exposure question. - Any pod-based restarter must be deployed before the switch, because a deaf kubelet will not start it. 7. Retain the source prefix and the snapshot for a cool-off period, then reclaim. Kamaji does not clean the old prefix after a migration. Rollback is the same procedure in reverse, against the retained snapshot. ### Test plan Done here, on today's `main`, no cluster involved: - [x] `helm template` of `packages/extra/etcd` before and after the extraction (commit 1) is byte-identical: 14 renders (default; 1 member + local SC + 10Gi; resources with CPU and memory allocation ratios + another version; a global topology spread; a hard affinity with 5 members and 512Mi; leftover `backup.*` values with 0 members; 1 member at 8Gi with a CPU allocation ratio, for the defrag quota flag), each in `tenant-root` and `tenant-abc`, all identical by sha256. After commit 2 the one difference in each is the `VMPodScrape` selector. - [x] `helm template` of `packages/apps/kubernetes` with Cilium served. With `_namespace.etcd` set to `tenant-root`, or empty, both with 3 members: `EtcdCluster/kubernetes-demo-etcd` replicas=3 on the namespace default StorageClass, and `DataStore/tenant-demo.kubernetes-demo` pointing at `kubernetes-demo-etcd.tenant-demo.svc:2379`. The `KamajiControlPlane` names that `DataStore`, and the policy renders. - [x] With the platform StorageClass keys set: 1 member uses `replicated` and 3 members use `local`. 2 members is refused at render time; 5 is refused by the schema. - [x] An existing cluster (live-`KamajiControlPlane` lookup stubbed to return `tenant-root`) renders identically to `main` with `values-ci.yaml`, pre-delete hook included, apart from random Talos tokens. A new cluster's render differs from `main` only by the old shared `dataStoreName`, the shared-etcd pod label and the added etcd objects. - [x] helm-unittest: - `packages/apps/kubernetes`: 392 tests. The 28-case `tests/etcd_test.yaml` covers names, the second cluster in one namespace, the 63-character `DataStore` cap, the 52-character defrag `CronJob` cap at the longest app name, the defrag quota for a 4Gi etcd, StorageClass choice and stickiness, the refused and the allowed drops to one member, refusal of 2, the policy with its `world` deny, and the hook's Step 4a/8 RBAC. For an existing cluster it covers staying on the shared `DataStore`, ignoring a changed `_namespace.etcd`, keeping the shared-etcd label, no own etcd and no Step 4a/8. - `packages/extra/etcd`: 29, including the new scrape-selector case. `packages/core/platform`: 335. `cozy-lib-tests`: 90. `packages/system/backupstrategy-controller`: 67, now asserting the dump Job's label. `packages/apps/tenant`: 89. `packages/extra/computeplane`: 18. - [x] bats, 867 cases, all passing (`helmrelease-readiness` and `bats-runner-coverage` included): every `hack/run-kubernetes*_test.bats` (including two new cases pinning the teardown reads to their deadline), `kubernetes-pre-delete-hook` (13, split into the shared and the own-etcd branch, including the fail-closed exit before Step 8), `check-render-matrix`, `chainsaw-op-budgets`, `migration-62-shared-etcd-report` (new, 4), `admin-kubeconfig-invariant`, `check-hook-request-timeout`, `app-cleanup-hooks_test`, `bats-no-negated-assert`, `bats-no-exit-trap`, `select-install_test`, `select-e2e_test`, `linstor-storage-mode_test`, `cozystack-version-stamp` and `md-no-hardwrap`. - [x] `go build ./...` and `go vet` on the `api/apps/v1alpha1` Kubernetes package. - [x] `make generate` in every touched package and at the root leaves no diff; `hack/check-commit-trailers.sh origin/main..HEAD` passes. Needs a live cluster: - [ ] The e2e lanes: `kubernetes-latest`, `kubernetes-previous` and `computeplane`, now without tenant-root's etcd. The Proxmox lane on its self-hosted runner. - [ ] Upgrade from `main` with an existing cluster on tenant-root's etcd. It must stay on `tenant-root` with no control-plane rollout, and migration 63 must list it. No CI lane runs a cluster on a shared etcd, because the chart no longer creates one; an upgrade lane that installs the previous release first is a follow-up. - [ ] The deny policy beyond what `kubernetes-latest` now probes: from a guest worker VM and from outside the cluster, `nc -zv kubernetes-<name>-etcd.<ns>.svc 2379` must be refused. The control plane, the defrag Job, a `Kubernetes` backup dump Job, an `EtcdSnapshot` Job, Kamaji and etcd-operator must still connect, including a freshly started control-plane pod (Cilium can briefly classify a new pod IP as `world`). - [ ] Delete a cluster whose own etcd never became Available (for example, the quota case below). Step 4a must release the `TenantControlPlane` and the uninstall must finish without manual work. - [ ] A tenant whose `ResourceQuota` cannot fit 3 × 1000m/512Mi limits and 3 × 4Gi requests must surface the quota error on the etcd member pods. - [ ] A backup and a restore through the `Kubernetes` strategy of a cluster that owns its etcd, including the rebuild of a deleted cluster. ### Follow-ups, not opened These are listed here at the maintainer's request rather than filed: - **cozystack/website**: - `content/en/docs/next/operations/configuration/platform-package.md` gains `kubernetesEtcd.storageClassLocal` and `kubernetesEtcd.storageClassReplicated`; - `content/en/docs/next/kubernetes/relocate-etcd.md` describes the shared tenant etcd as what a cluster uses; - tenant and Kubernetes docs telling users to set `etcd: true` for a cluster, which is now an obsolete workaround; - the Kubernetes app reference is regenerated from the README on the next stable tag. - **cozystack/terraform-provider-cozystack**: `internal/provider/kubernetes_schema.go` and `kubernetes_model.go` need `etcd.replicas`, with the default of 3, a 1..3 range and the expand/flatten pair. - **cozystack/cozystack**, after this lands: - an upgrade e2e lane that keeps a cluster on a shared etcd across the upgrade; - alert rules for a cluster's own etcd; - the opt-in migration path and its e2e; - an operator `talosconfig`; - phases 3 and 4. ### Screenshots Not a UI change. ### Downstream repositories Follow-ups are listed above under "Follow-ups, not opened". By the maintainer's decision they are not filed from this draft, so no box is ticked. - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: listed above, not yet filed - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: listed above, not yet filed - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note feat(kubernetes): each new tenant Kubernetes cluster now gets its own etcd (EtcdCluster `kubernetes-<name>-etcd` and Kamaji DataStore `<namespace>.kubernetes-<name>`), created and deleted with the cluster, so no ancestor Tenant needs `etcd: true` and the `awaiting-etcd` state is gone. The new `etcd.replicas` field chooses 3 members (default) or 1. Each member starts at 1000m CPU and 512Mi memory limits with a 4Gi volume, counted against the tenant's quota, and a VerticalPodAutoscaler may resize it as it is recreated. The platform values `kubernetesEtcd.storageClassLocal` and `kubernetesEtcd.storageClassReplicated` choose the StorageClass for 3 members and 1 member respectively. Existing clusters keep the shared tenant etcd they run on, unchanged; the upgrade lists them in the migration log. The `Kubernetes` backup strategy covers a cluster's own etcd as it covers a shared one. The tenant etcd's metrics scrape now selects only its own members. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * New Kubernetes clusters now use dedicated etcd by default, with one- or three-replica configurations and platform-selected storage. * Clusters already using shared etcd continue to use it. Installation notes show where control-plane state is stored and summarize resource limits. * Kubernetes add-ons can render independently of tenant-shared etcd settings. * **Bug Fixes** * Cluster removal now waits for dedicated etcd resources to be reclaimed. * Platform upgrades report clusters still using shared etcd without modifying them. * **Documentation** * Updated Kubernetes and ComputePlane guidance on dedicated etcd, storage options, and migration considerations. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
16da53637e |
feat(kubernetes): give each new cluster an etcd of its own
A tenant Kubernetes cluster could only start once an ancestor Tenant had an etcd module turned on, which nobody creating a cluster may do, and every cluster below that tenant then shared one etcd, one CA and one disk. Anything that orders clusters on a tenant's behalf had to flip the tenant's etcd on first. A new cluster now renders its own EtcdCluster and DataStore, from the cozy-lib shapes the etcd chart uses, and is created and deleted with them. The awaiting-etcd state goes, since a datastore always exists. An existing cluster stays on the DataStore its live KamajiControlPlane names, and renders what it rendered before. Changing that name starts a Kamaji datastore migration, which freezes the tenant's writes and leaves every worker kubelet needing a restart, so no upgrade may do it. _namespace.etcd cannot decide this: tenant-root publishes one to every tenant whether or not an etcd runs behind it. On uninstall, Kamaji's datastore finalizer drops the tenant's role, prefix and user from an etcd this release deletes next, and it never completes while that etcd is down. The pre-delete hook therefore removes it from a TenantControlPlane on the cluster's own DataStore that outlives the wait, and deletes the etcd's PKI, which cert-manager issues without an owner. If the finalizer stays on, or the TenantControlPlane cannot be read, the hook fails before the PKI goes, so the uninstall is retried with the etcd still in place. A TenantControlPlane on a shared DataStore is left to Kamaji as before. A Cilium deny policy keeps the rest of the tenant namespace, ancestor tenants and off-cluster sources off the etcd ports; the Kubernetes backup strategy's dump Job carries the label it admits. The tenant etcd's scrape now selects its own members by instance, because every member etcd-operator runs carries app.kubernetes.io/name: etcd. The platform waits for etcd-operator before offering the application. The defrag job both charts share pulls its image through the configured registry, pinned by digest to the multi-architecture index, so a mirrored installation does not depend on ghcr.io for it. Tested with helm-unittest on both the own and the shared branch, the pre-delete hook's bats suite run against a stub kubectl for both, and a render of an existing cluster that matches main byte for byte. The guest e2e runs the defrag CronJob once, and probes the etcd client port from a labelled Pod, an unlabelled one and one in tenant-root. Co-authored-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Assisted-by: LLM Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Signed-off-by: Timofei Larkin <lllamnyp@gmail.com> |
||
|
|
61e0839e0e |
fix(postgres): validate audit.log and match audit keys case-insensitively
Review on #5404 surfaced three issues with the audit toggle: - audit.log was a free string, so a mistyped class (write, ddl, rol) rendered unchanged and pgaudit fell back to none at the next restart, silently disabling auditing. Add a schema pattern over the pgaudit class list so a bad class is rejected at admission. - The explicit-parameter-wins guard matched keys case-sensitively, so a user key like pgaudit.LoG landed beside the lowercase seed and PostgreSQL, which is case-insensitive, picked the seed. Match the user keys lowercased. - The connection-logging and empty-log guards were untested. Cover log_disconnections, an empty pgaudit.log, an empty audit.log and a case-variant key. Also note in the field docs that write/all record statement text, so the audit trail is readable by anyone with access to the log stack. Assisted-by: LLM Signed-off-by: IvanHunters <xorokhotnikov@gmail.com> |
||
|
|
64c55898aa |
fix(postgres): make an explicit parameter win over the audit default
Seeding pgaudit.log and the connection-logging parameters through the $defaults merge let a falsy explicit value lose: a tenant setting log_connections: 0 while audit is on had it silently overwritten with on, because sprig merge reads a zero value as unset. Seed each key only when postgresql.parameters does not already set it, so an explicit value wins unconditionally. Also enumerate the valid pgaudit.log classes in the field description, since an unrecognised class makes pgaudit fall back to none and silently disables auditing. Assisted-by: LLM Signed-off-by: IvanHunters <xorokhotnikov@gmail.com> |
||
|
|
fc62c7f69f |
fix(postgres): regenerate deepcopy for the Audit type
The audit values block added a new Audit struct to the generated Go types, and its DeepCopy methods were missing, so the "Verify generated code is up to date" job failed on drift. Add the controller-gen output. Assisted-by: LLM Signed-off-by: IvanHunters <xorokhotnikov@gmail.com> |
||
|
|
902909dbe7 |
feat(postgres): add an audit toggle for access and statement logging
Managed Postgres could already load pgaudit through the sharedPreloadLibraries allowlist and set pgaudit.log and log_connections through postgresql.parameters, but that leaves an orchestrator depending on internal parameter names to answer who connected and what they ran. This adds an audit block that bundles access and statement auditing behind one switch. With audit.enabled the chart adds pgaudit to shared_preload_libraries and seeds pgaudit.log (from audit.log, default "write, ddl, role"), log_connections and log_disconnections. The parameters are seeded as defaults, so an explicit pgaudit.log or log_connections in postgresql.parameters still wins. The audit trail goes to the instance log, which the platform log stack already collects, so it is queryable per database without extra wiring. Postgres only; the other managed databases are left for follow-ups. Assisted-by: LLM Signed-off-by: IvanHunters <xorokhotnikov@gmail.com> |
||
|
|
9ecff91b74 |
fix(kafka)!: require SCRAM-SHA-512 on the external listener
With external access on, the chart opens a listener on port 9094 of a public LoadBalancer address, and it rendered that listener without any authentication: whoever reached the address could produce and consume on every topic. TLS on that listener only encrypts the session. The KafkaUser name carries the release name because it is also the SCRAM username and the name of its Secret, and two instances in one namespace may declare the same user. A dot joins the two because a user Secret readable by the tenant must never take the name of a Secret Strimzi derives from a cluster name, and neither a release name nor any of those Secrets can hold a dot. BREAKING CHANGE: an instance with external access enabled refuses clients that do not authenticate. The Kafka README gives the upgrade sequences. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
d196af6e15 |
Merge branch 'main' of https://github.com/cozystack/cozystack into pr-4880
Signed-off-by: Mattia Eleuteri <mattia@hidora.io> Assisted-by: LLM # Conflicts: # packages/system/harbor-rd/cozyrds/harbor.yaml |
||
|
|
a2c986d770 |
Merge branch 'main' of github.com:cozystack/cozystack into pr5050-sync
Signed-off-by: Mattia Eleuteri <mattia@hidora.io> # Conflicts: # packages/apps/bucket/README.md # packages/system/bucket-rd/cozyrds/bucket.yaml |
||
|
|
e86ef94185 |
feat(api, kubernetes, virtual-machine): declare tenant quota reservations on ApplicationDefinitions (#5349)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Fixes merged to `main` reach the release lines the backport batch runs for automatically, so do not open backport PRs by hand: https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md --> ## What this PR does Second phase of the accepted [tenant quotas as reservation limits](https://github.com/cozystack/community/pull/48) design, after the evaluator in #4983. An `ApplicationDefinition` can now declare what an application of its kind reserves from its tenant's budget, as CEL over its defaulted values, and the four IaaS kinds (`vm-instance`, `vm-disk`, `kubernetes`, `kubernetes-nodes`) declare theirs. Nothing reads the declarations yet: the usage oracle and the generalized admission gate are the next phase, behind a flag. - `fix(api)`: the evaluator could not sum quantities. The Kubernetes CEL library returns a pointer from `add` and `sub`, which the evaluator did not recognize, so any declaration summing components failed. Found while writing the `kubernetes` declaration, which sums four control-plane components. - `fix(api)`: the evaluator refused exact products. `resource.Quantity.Mul` returns false once the product leaves an int64 coefficient, not when it is wrong, so any fractional binary size above about 8.5Gi (`20.5Gi × 3`) failed as an overflow. - `fix(api)`: a null value stayed present wherever the schema had no default to replace it, so `has()` saw a key Helm deletes, and evaluation failed on a spec the chart renders. - `feat(api)`: `spec.consumption` on `ApplicationDefinition` (`exempt`, ordered `let` bindings, `resources` per quota key), owned as a whole so that a binding and the expressions reading it are replaced together. The evaluator's `Declaration` is now an alias of the API type. The CRD rejects an exempt declaration that still carries expressions and a non-exempt one that names no resource. - `refactor(extra)`: ComputePlane's default `md0` pool now writes its ceiling, instance type and disk size into its release instead of relying on the pool chart's schema defaults, so the release alone says what the pool can reserve. The rendered pool does not change. - `feat(api, kubernetes, virtual-machine)`: the four declarations, each following its chart's own precedence, plus a test that evaluates the shipped declarations against the shipped instance types and preset table, with the failures that must stay errors. Validated locally: `go test ./pkg/reservation/` with each commit built and tested on its own, `helm unittest` on computeplane and the touched `-rd` charts, the four definitions plus three invalid ones validated against the generated CRD schema and its CEL rules, and `make generate` in the touched packages left the tree unchanged (with `cozyvalues-gen` v1.7.0, the version CI pins). Decisions worth a reviewer's look: - **Proxmox worker pools reserve nothing.** Their VMs and disks run on the external hypervisor, so they draw nothing from this cluster's capacity. The `kubernetes` kind reserves one `services.loadbalancers` on Proxmox, for its published apiserver Service, and one on KubeVirt when the ingress addon is exposed by a load balancer, which the tenant cluster's cloud controller realizes in the tenant namespace. - **GPUs are not declared.** Their quota key is the device name (`nvidia.com/<model>`), and `resources` keys are fixed strings. Expressing them needs either a dynamic-key form in the declaration or a class key for GPUs; I would rather settle that in its own change than guess here. Until then the namespace `ResourceQuota` keeps bounding them. - **A spec the chart refuses to render is refused, not estimated.** A partial `resources` block on a VM or a worker pool, a non-whole core count or a memory below 1M fails the evaluation with the declaration's reason, through a `fail(reason)` function the evaluator now offers, so the gate in the next phase can answer with the same reason the render would give. Two decisions left for the next phase, both about what values alone cannot see: - A `vm-disk` whose `storage` is lowered keeps its larger volume, because the chart only ever grows it, while its declaration reads the lowered value. The admission gate has to refuse a storage decrease on Update before it relies on this declaration. - A worker pool's rollout runs one surge worker and its disk next to the old ones (`maxUnavailable: 0` by default), which `maxReplicas` does not cover. Whether that overlap counts against the tenant's budget or is platform margin decides whether a tenant at its ceiling can roll a pool at all. Refs: cozystack/community#48 ### Screenshots <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> ### Downstream repositories I walked the trigger map against the diff. Two repositories are affected, and each has a follow-up issue: - `cozystack/website`: the map lists "Change `ApplicationDefinition` semantics". This adds a field nothing reads yet; documenting it seems more useful once the gate in the next phase gives it an effect. - `cozystack/external-apps-example`: the map lists changes to the `ApplicationDefinition` CRD. The field is optional, so nothing breaks there now, but the next phase refuses orders of a kind that declares neither its consumption nor an exemption, so out-of-tree catalogs will need a declaration before that phase is switched on. - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: cozystack/website#820 - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [x] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: cozystack/external-apps-example#6 - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note feat(api, kubernetes, virtual-machine): ApplicationDefinitions can declare the tenant quota reservation of their kind, and the VM, disk, Kubernetes and worker pool kinds declare theirs. Nothing enforces the declarations yet. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Application definitions can declare resource consumption for CPU, memory, storage, and load balancers, with reservations based on configured sizing and substrate choices. * Kubernetes worker-pool reservations reflect replica counts, resource overrides, instance types, and disk size; control-plane reservations reflect component sizing and replica counts. * VM instance and disk definitions report resource and storage consumption. * Default compute clusters now specify a node-pool limit of 10, an instance type, and a disk size. * **Validation** * Invalid or incomplete resource sizing and consumption declarations now produce errors, including mismatched CPU and memory settings. Consumption declarations also enforce limits on resource entries and bindings. * **Bug Fixes** * Null values are treated as absent when calculating reservations, and quantity calculations support larger and fractional results. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
7cc27e3a56 |
feat(harbor): expose replicas and zone spread for the request path
Every docker login, pull and push goes through nginx, core and registry, and each of them ran as a single pod: losing the node that hosted one stopped all registry traffic, however many database and Redis instances backed it. The vendored chart already scales them and the registry keeps its blobs in S3, so only the wrapper was missing the knobs. Placement is added only above one replica, so an install on the default renders the pod templates it had. It follows the platform's scheduling.globalAppTopologySpreadConstraints, like the other applications, so an operator sets the placement policy once for the whole cluster. Without one, a soft zone and node spread stands in: soft so that a cluster without zone labels, or with fewer nodes than replicas, still schedules every replica. The data tier follows the same policy through topologySpreadConstraints rather than affinity, which keeps the per-node anti-affinity CloudNativePG and the Redis operator apply by default: replacing the RedisFailover affinity, or moving CNPG's topologyKey to the zone, would drop it on a cluster without zone labels. Co-authored-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com> Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
ae3dd71e68 |
feat(bucket): offer Object Lock without a default retention
The only lock class, -lock, sets a fixed default retention of COMPLIANCE for 365 days. Backup tools such as Veeam, restic and Kopia set the retention of each object themselves, and other users want a shorter default or GOVERNANCE, which a bucket owner can set through the S3 API once the bucket exists. Nothing let them start from a locked bucket without that year-long default. The new lockingDefaultRetention flag defaults to true, so existing buckets and values keep -lock. The new class keeps deletionPolicy Retain like -lock: the driver deletes a bucket through the filer without checking retention, so Delete would destroy objects still under COMPLIANCE. Pools named with a -lock-noretention suffix already exist, so that suffix is not reserved, which would block their upgrade; only class names that actually clash between pools, or with the base classes, are refused. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
d3804ebea9 |
feat(api): refuse an application scheduling class its tenant does not allow
The lineage webhook keeps a pod on the tenant class when the application names a class the tenant does not allow, but it can only log that, on a pod the user never looks at. Refusing the application at admission puts the error where the field was set, with the list of classes that would be accepted. An update that keeps the class is not refused, so an application whose class was removed from the list after admission stays editable; the webhook already keeps its pods on the tenant class. Tenants are left out, because their spec.schedulingClass is the child tenant's class, which the tenant chart's inheritance governs. Users read the field description in the dashboard form and the API schema, so it names the tenant setting that decides which classes are accepted, says that only setting another value is refused, and that a pod gets its class when it is created, so running pods keep theirs. The field sits in its own README section, since a reader looking for placement would not look under the unrelated heading it was appended to. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
4034f9eeb9 |
feat(tenant): let an administrator list the classes applications may pick
An application's spec.schedulingClass replaces the tenant class for its pods, and the tenant class is the administrator's placement constraint. Without a list of permitted alternatives, anyone who can create an application in the tenant can move it onto any class the cluster defines. allowedSchedulingClasses names those alternatives and defaults to empty, so per-application placement stays off until an administrator opts in. The tenant chart writes it to a namespace annotation, the place the admission policy and the lineage webhook can read it from. A parent that constrains placement passes its list down unchanged, so a child tenant cannot allow a class its parent does not, the same way it cannot replace the parent's class. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
0132457260 |
feat(apps): expose schedulingClass across all managed applications
Placement could only be set per tenant, so two applications of the same tenant could not be kept together, or apart, unless each had a tenant to itself. With a class per application and the scheduling-class Pod label, a SchedulingClass name can serve as a co-affinity group: a database and the virtual machine that uses it can be kept in the same region without pinning which one. The field is capped at 63 characters. A SchedulingClass name may be up to 253, but the webhook writes the class into a Pod label, and this is the first source of the class the apiserver has not already validated as a label value; capping it is cheap while the field is new and a breaking change once released. A class created with a longer name must still not break Pod admission, so for it only the label is left out. kubernetes-nodes gets no field: the ownership walk from a worker Pod reaches the parent Kubernetes application, never the pool, so a class set on a pool would be accepted and silently ignored. Placement per replica role (primary or standby of a clustered database) is out of scope: the operator assigns the role after election, once the webhook has already seen the pod. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
fa7c94507a |
feat(api): carry a consumption declaration on ApplicationDefinition
Tenant quotas are to be enforced against what an application declares rather than against the pods it renders, and the apiserver must hold no per-kind knowledge of how to compute that, so that a kind shipped from an out-of-tree catalog can take part. The declaration therefore lives on the kind's definition, next to the schema it is evaluated against. The evaluator's Declaration becomes an alias of the API type, so a definition is compiled exactly as it was read, with no conversion that could drift from it. The CRD refuses an exempt declaration that still carries expressions and a non-exempt one that names no resource, so an omission cannot pass for a zero reservation. Nothing reads the field yet. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <mattia@hidora.io> |
||
|
|
c98a345aa1 |
docs(api): clarify health check parsing and evaluation (#4495)
## What this PR does Clarifies the lifecycle of HelmRelease CEL health checks. helm-controller parses and validates these expressions and creates a status reader factory before choosing how to wait. The factory constructs the concrete status reader when the selected wait path creates its resource manager. Invalid configuration can therefore stall the HelmRelease with reason InvalidCELExpression even when the release.cozystack.io/helm-install-disable-wait annotation is set or the legacy wait strategy is selected. Once setup succeeds, only helm-controller's poller evaluates expressions: while a Helm action waits under the poller strategy, and for Helm hooks, which are still waited on when the annotation disables wait. Without the annotation, the legacy strategy never evaluates them. With it, hooks are evaluated whatever the strategy, because disabling wait takes precedence. The monitoring template comment now also distinguishes an existing status object without `updateStatus` from a completely absent top-level `status` key. The former evaluates the predicates to false, while the latter can produce an evaluation error and an Unknown result. The poller continues waiting in both cases. The CEL expressions and runtime behavior are unchanged. The generated ApplicationDefinition CRD description was regenerated from the Go field documentation. Fixes #4388 ### Screenshots N/A — no UI changes. ### Downstream repositories - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note NONE ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Clarified when health-check expressions are validated and evaluated across wait strategies and Helm hooks, including how invalid expressions can affect Helm releases. * Explained how missing status fields affect health-check results and that polling continues until the resource is operational or times out. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
d88322197f |
chore(deps): roll up Renovate updates and raise dependencies to latest stable (#4869)
## What this PR does One PR instead of separate Renovate PRs. Go modules, Dockerfile base images and GitHub Actions move to newer versions that build and pass the tests. Where a newer version is known to break something, it stays behind, and `.github/renovate.json` holds it with the reason in the rule description. The tests come first, in their own commits: - `make go-unit-tests` runs the Go tests under `pkg/` and `cmd/`, except the backport-batch suite, which keeps its own target. The apiserver serializer and fuzz tests, the generated OpenAPI and applyconfiguration suites, the apis packages and the controller, operator and observability-proxy commands did not run in CI before. - The apps API surface that apiserver libraries shape is pinned: server-side apply, content negotiation, Table output on watch, the served OpenAPI v2 and v3 documents, and building the server without etcd. Two answers look wrong and are pinned as they are today: applies from different field managers never conflict (#4857), and protobuf is refused with 406 even when the client offers JSON as a fallback (#5297). - New tests cover the kubeovn webhook patch, the token proxy session cookie and the mount-utils behaviour the kubevirt CSI node service relies on. - `hack/image-smoke.bats` checks the tools the CSI, LINSTOR, multus, Harbor and redis-backup images take from their base images or build stages, and that the kubevirt CSI node plugin and its sidecars need no more than x86-64-v2. Each PR build job runs it against the images it pushed; forks and the unit lane run no container. The tests found two bugs: - The kubeovn webhook dereferenced a nil pointer on an admission review without a request, so the caller got a dropped connection instead of a 400. - The token proxy cookie refresh never fired: securecookie decodes the session times as int64 and the refresh looked for float64, so the `--cookie-refresh=1h` the chart sets did nothing. A refreshed cookie keeps the token's expiry. A session too large to encode now shows an error at sign-in and leaves the current cookie alone on refresh. What moved: - GitHub Actions to their Node 24 majors. The flux action stays on the tag of the Flux CLI it installs. The release job's checkout no longer persists credentials, so its staging branch push uses the App token. - Go 1.27.2 for the toolchain and builders. Builds that reproduce an upstream release keep the Go upstream uses: Harbor, cilium-operator, SeaweedFS and the chainsaw stage of the e2e sandbox. - controller-runtime v0.25.2, gateway-api v1.6.3 on the minor of the installed v1.6.1 CRDs, cel-go v0.30.0, grpc v1.84.0, etcd v3.7.2, cert-manager v1.21.2, kubevirt csi-driver f10ae94 on Kubernetes v0.37.1. - Node 24 for the dashboard console. Held back, each with its reason in the Renovate rule: - cel-go stays below v0.31: the old repository has no tags past v0.30.0, and v0.32 moves to cel.dev/cel-go, which k8s.io/apiserver does not import. - kube-openapi stays on the commit its dependencies require, and structured-merge-diff stays on v6, because k8s.io/apimachinery v0.37 does not compile against v7. - The Flux API modules stay on the Flux v2.8 line the platform installs. - gomodules.xyz/jsonpatch stays on v2, which controller-runtime's admission.Patched takes. - jwx stays on v3: v4 removes jwk.Cache, which the token proxy's JWKS refresh is built on. - kubevirt.io/api and the CDI API stay where upstream csi-driver builds. - The kubevirt CSI driver image stays on AlmaLinux 9, because AlmaLinux 10 builds its amd64 userland for x86-64-v3. - shadowbox stays on node 18, which outline-server declares in its engines. - The e2e sandbox stays on Ubuntu 24.04. 26.04 ships uutils coreutils, whose `date` costs about 4x per call, and the test harness forks it per traced line, which adds about ten minutes to the install phase. - clastix/kubectl stays on v1.32 for the cleanup hooks, within kubectl's one-minor skew. The cert-manager Go module (v1.21.2) is one minor ahead of the installed chart (v1.20.2). The Certificate objects the gateway controller writes serialize the same either way. `api/apps/v1alpha1` now requires Go 1.27.2, which applies to every module that imports the published types. The Linux run with Go 1.27.2 was done before the rebase onto current main, and the rebased head has not been through it yet. There the five modules built, vetted, tested and tidied cleanly, and the repository unit, controller and envtest lane passed. `go test -race` passed in four modules. In the root module it failed only on a pre-existing data race in the workload monitor tests (#5296), which main has too. The image smoke checks run in this PR's CI. ### Screenshots No UI change. ### Downstream repositories `api/apps/v1alpha1` moves to `go 1.27.2`, and cozystack/terraform-provider-cozystack imports it, so that repository is affected but needs no action. Its box stays empty for that reason, and so does the "not affected" one. - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: none needed, because its Renovate raises the go directive together with the pin bump and its CI takes Go from `go.mod`; the only effect is that the provider's minimum Go becomes 1.27.2. - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note chore(deps): move the toolchain and builder images to Go 1.27.2 and raise Go modules, base images and GitHub Actions to newer working releases; the dashboard token proxy now refreshes its session cookie, and the kube-ovn webhook rejects an admission review without a request instead of dropping the connection. ``` |
||
|
|
1d64d077e3 |
Merge branch 'main' into issue-4388
Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |
||
|
|
a3e60ec372 |
feat(kafka)!: run on Strimzi 1.2.0 and Kafka 4.x (#4900)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Fixes merged to `main` reach the release lines the backport batch runs for automatically, so do not open backport PRs by hand: https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md --> ## What this PR does This upgrades the Kafka operator to Strimzi 1.2.0. Kafka 4.3 is the application default, with 4.2 also available. Upgrades must pass through Cozystack v1.7 and finish the ZooKeeper-to-KRaft migration first. The upgrade now stops while any Kafka lacks KRaft evidence. Every Kafka must report a nonempty `kafkaMetadataVersion` and the `KRaft` metadata state. The API conversion deletes that state, so without it a Kafka needs `Ready=True` or the `cozystack.io/kraft-verified` annotation, which migration 61 writes on every Kafka it accepts before it stops the operators. Any other explicit state blocks, and the error gives the reason for each Kafka. On every variant, the platform chart refuses to switch package sources while Strimzi still serves `v1beta2` and a Kafka fails that check. On variants without the migration hook, it also refuses while any Strimzi CRD still stores `v1beta2`, so `/migrations/61` has to run first. Migration 61 checks the same evidence again, including on repeat runs, and blocks unfinished broker-pool drains. A manual change that bypasses the managed package source is outside this check. Existing Kafka 3.x applications move to v4.3. Kafka 4 no longer accepts clients older than Kafka 2.1. Kafka 4 also rejects the topic settings `message.format.version`, `message.downconversion.enable` and `message.timestamp.difference.max.ms`, and a `segment.bytes` below 1 MiB (1048576), which Kafka 3.x accepted down to 14 bytes. A Kafka 4 broker whose log holds such a topic does not start. The chart now refuses to render a topic that sets any of these. The platform upgrade refuses to start while a Kafka application sets one, and migration 61 also checks KafkaTopic resources, so topics created outside the chart are caught too. A topic created through the Kafka admin API without a KafkaTopic is not visible to these checks. Restoring a topic-metadata backup taken on Kafka 3.x skips the three removed settings and raises a smaller `segment.bytes` to 1 MiB, with a warning for each. In-place downgrades are unsupported. The default 10-minute Helm timeout can leave a long broker roll Failed until its retry succeeds. The migration does not run automatically on every platform variant. Only the `isp-*` variants run it automatically. On other variants, run `/migrations/61` from the matching migrations image before upgrading, as the Kafka README describes. This includes clusters that run no Kafka but have the kafka-operator package, from the `paas` bundle or `bundles.enabledPackages`. Their Strimzi CRDs still store `v1beta2` even with no objects. The migration converts Strimzi resources and stored Helm references to `v1`. It stamps platform version 62. Running it manually also skips earlier migrations on a later move to an `isp-*` variant. Before it stops the operators, migration 61 refuses objects that the Strimzi 0.51 conversion tool would reject and names each one, for example a Kafka with `.spec.kafka.resources` or with OAuth, Keycloak or OPA settings. A failed conversion can leave the old operators stopped until the migration succeeds and the operator release upgrades. The failed conversion Job stays for diagnosis, but its ClusterRole, binding and ServiceAccount are removed. A Job that is still running when the wait times out keeps them, because the retry waits for it. Known limitations. Migration 61 converts with the old operator stopped, while Strimzi's conversion guide expects a running operator of 0.49 or later. I stop it because 0.45 keeps writing the Kafka status through `v1beta2`, but I have not checked this on a live cluster. Objects Strimzi created keep `ownerReferences` to `v1beta2` until Strimzi 1.2 reconciles them. Deleting a Kafka before that can leave dependents behind, and the chart's pre-delete hook covers only StrimziPodSets. The conversion image is pulled from quay.io by digest with no values override, so an air-gapped cluster has to mirror it under the same name. The full offline unit run passed on Linux on `1171d63adfafb45be34214fb9a0f565723e255fd`: 2,576 cases, no failures, errors or skipped tests. Later changes were checked on `69c704499fa4` with the Bats tests for migration 61, the migration runner, the Kafka hooks and the Kafka backup scripts (102), the platform Helm suite (310 tests) and the Kafka Helm suite (91 tests). After the rebase onto `main` at `5a5d5cd3d85f`, `a48a2f259947` passes the same Bats tests (115) and the platform and Kafka Helm suites (326 and 103 tests). It also passes the new check against added `documentIndex` selectors. I have not validated this revision on a live cluster. Closes #4365 ### Screenshots <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> Not a UI change. ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [ ] No downstream repository is affected by this change - [x] [cozystack/website](https://github.com/cozystack/website) - follow-up: https://github.com/cozystack/website/issues/805 - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: The Terraform provider does not model the Kafka `version` field. The website issue covers the upgrade notes the `default` variant needs. ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note feat(kafka)!: upgrade to Strimzi 1.2.0 and Kafka 4.3 by default, with Kafka 4.2 also available. Platform migration 61 converts Strimzi resources to v1 and moves Kafka 3.x applications to v4.3. Every Kafka must have confirmed KRaft state before the upgrade, including on repeat runs. Upgrade through Cozystack v1.7 first. Kafka 4 drops clients older than Kafka 2.1 and the message.format.version, message.downconversion.enable and message.timestamp.difference.max.ms topic settings, and requires segment.bytes of at least 1 MiB; the chart and the upgrade refuse a topic that breaks either rule, and a topic-metadata backup taken on Kafka 3.x restores without the removed settings and with segment.bytes raised to 1 MiB. In-place downgrades are unsupported. ``` |
||
|
|
87f160d473 |
fix(vm-disk, kubernetes-nodes)!: refuse golden images whose import keeps failing (#4802)
## What this PR does New clones can wait forever on a golden image whose import keeps failing. CDI v1.66.1 retries ordinary HTTP failures without setting phase `Failed`. The guards now also refuse goldens with at least three importer restarts unless they reached `Succeeded`. kubernetes-nodes and the picker require `Running=False`; vm-disk refuses during running attempts too. Existing vm-disks and already-cloned pools remain exempt. CDI never lowers the restart count, so a healthy import with three early restarts stays refusable until `Succeeded`, including while a recreated importer is still starting. An empty worker-pool StorageClass now resolves to the virtualization default, then the GA Kubernetes default. Beta is a last fallback for the class written explicitly onto a worker disk, not a CDI fallback. The strict same-class policy stays. This can refuse a previously accepted builtin pool on upgrade. The affected pool has an empty StorageClass, no cloned disk yet, and a golden on the Kubernetes default while another class is the virtualization default. StorageClass is immutable: point `osImage.builtin` at a catalog entry on the virtualization default or switch to `osImage.factory`. Already-cloned pools keep their disk's class. A VMDisk's own HTTP import, golden-image health checks and imports that hang without restarting remain outside this change. Closes #4564 Refs #4059 ### Screenshots No UI changes. ### Downstream repositories The platform values change only updates a comment. The application schema change updates the StorageClass description without changing fields, defaults or enums. - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note fix(vm-disk, kubernetes-nodes)!: refuse new clones of golden images whose import has not succeeded after at least three importer restarts. kubernetes-nodes and the image picker require the importer to be not running; vm-disk refuses during running attempts too. kubernetes-nodes now resolves an empty storageClass to CDI's virtualization default before the Kubernetes default. A builtin pool with an empty storageClass, no cloned disk yet, and a golden on a different class can now be refused. Point it at a catalog entry on the virtualization default or switch to osImage.factory. Already-cloned pools are unaffected. ``` |
||
|
|
638f0ffbe7 |
feat(redis): add affinity configuration (#2665)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Fixes merged to `main` reach the release lines the backport batch runs for automatically, so do not open backport PRs by hand: https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md --> ## What this PR does Adds independent Kubernetes affinity configuration for Redis and Sentinel pods through `RedisFailover.spec.redis.affinity` and `spec.sentinel.affinity`. Empty or null rules preserve operator defaults. Configured rules replace default soft pod anti-affinity; include `podAntiAffinity` when replica spreading is required. ### Validation - All 99 chart tests pass with helm-unittest v1.1.2; affected standalone API package compiles. - Package generation with cozyvalues-gen v1.7.0 is repeatable; embedded ApplicationDefinition schema matches the generated values schema. - Twenty-four offline render scenarios cover default/null/configured affinity and TLS on/off; Redis checks also cover independent component rules, single-replica Sentinel behavior, and preservation of upstream cache configuration. - Manifest generation, diff checks, and commit trailer checks pass. Each branch contains one feature commit rebased onto upstream main. - Root `make generate` remains blocked by the pinned code-generator parser rejecting Go 1.27's `math/rand/v2` generic method. Affected API deepcopy generation passes separately with controller-gen v0.16.4; unchanged files deleted by the failed root generator were restored. - cozyhr v1.6.1 is installed and checksum-verified. `make show` with `--plain` still queries Kubernetes discovery, which this environment cannot access; offline Helm rendering passes. ### Screenshots Not applicable; no UI changes. <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [x] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: https://github.com/cozystack/terraform-provider-cozystack/issues/85. Provider implementation is tracked separately from this application change. - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note feat(redis): add affinity configuration for Redis and Sentinel pods. ``` |
||
|
|
6efc0a0dc9 |
feat(rabbitmq): add affinity configuration (#2664)
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Fixes merged to `main` reach the release lines the backport batch runs for automatically, so do not open backport PRs by hand: https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md --> ## What this PR does Adds optional Kubernetes affinity configuration to RabbitMQ pods through `RabbitmqCluster.spec.affinity`. Empty or null affinity keeps existing scheduling behavior. ### Validation - All 106 chart tests pass with helm-unittest v1.1.2; affected standalone API package compiles. - Package generation with cozyvalues-gen v1.7.0 is repeatable; embedded ApplicationDefinition schema matches the generated values schema. - Six offline render scenarios cover default/null/configured affinity and TLS on/off. - Manifest generation, diff checks, and commit trailer checks pass. Each branch contains one feature commit rebased onto upstream main. - Root `make generate` remains blocked by the pinned code-generator parser rejecting Go 1.27's `math/rand/v2` generic method. Affected API deepcopy generation passes separately with controller-gen v0.16.4; unchanged files deleted by the failed root generator were restored. - cozyhr v1.6.1 is installed and checksum-verified. `make show` with `--plain` still queries Kubernetes discovery, which this environment cannot access; offline Helm rendering passes. ### Screenshots Not applicable; no UI changes. <!-- REQUIRED for UI changes: attach screenshots or screen recordings demonstrating the visual impact of your changes. PRs with UI changes without screenshots will not be merged. --> ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [x] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: https://github.com/cozystack/terraform-provider-cozystack/issues/84. Provider implementation is tracked separately from this application change. - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note feat(rabbitmq): add support for configuring RabbitMQ pod affinity rules. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added an optional affinity setting to control where RabbitMQ pods are placed, including anti-affinity rules to spread pods across nodes. * Configured affinity rules are applied to RabbitMQ pods. When affinity is empty or unset, no affinity rules are added. * **Documentation** * Updated RabbitMQ configuration guidance to describe the affinity setting, its empty default, and how to use anti-affinity to distribute pods across nodes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
3b65cebea3 |
feat(kafka)!: run on the Strimzi v1 API and Kafka 4.x
Strimzi 1.2 serves only the v1 API and runs Kafka 4.2 and 4.3. The node-pool hook no longer drives the ZooKeeper to KRaft migration or the drain that freed the shared "kafka" pool name: Strimzi 1.x has no ZooKeeper support, and the platform migration refuses to upgrade while a ZooKeeper cluster is left. A cluster migrated earlier keeps its "kafka" broker pool. Without the drain the hook takes seconds, so the seven-hour install timeout goes too. Kafka 4 rejects the topic configs it removed and a segment.bytes below 1 MiB, which Kafka 3.x accepted. A KafkaTopic that sets one stays NotReady while the release reports Ready, so the chart refuses to render such a topic. It reads segment.bytes the way Kafka does: trimmed, with an optional sign, leading zeros decimal. BREAKING CHANGE: the Kafka application accepts version v4.3 (default) and v4.2; v3.8 and v3.9 are gone, and the platform migration moves existing applications to v4.3. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la> |