Commit Graph
2344 Commits
Author SHA1 Message Date
Aleksei Sviridkin 89da4a121c fix(cdi): stop make update from deleting first-party templates (#4097)
## What this PR does

`make update` in `packages/system/kubevirt-cdi` began with `rm -rf
templates` and then refetched one file, `cdi-cr.yaml`. Nothing in that
directory is purely vendored. Two of the three manifests, the
upload-proxy Ingress and TLSRoute from the Gateway API work, are ours
and no fetch recreates them, so the next CDI bump would have dropped
upload-proxy exposure from the chart and still exited 0. The third is
`cdi-cr.yaml` itself, which despite its name carries Helm templating,
the `ExpandDisks` gate, a toleration and the two RBAC documents that
preauthorize cloning from `cozy-public`; the fetch overwrites it, and
removing the wipe does not change that.

That recipe now opens with `mkdir -p templates` and deletes nothing,
which is where `packages/system/kubevirt-operator` landed at the last
KubeVirt bump. The wipe bought nothing there anyway: `wget -O` truncates
the file it writes.

`kubevirt-cdi-operator` has the same recipe shape, and the same edit
there would be a regression rather than a fix. It applies two patches,
and since #3920 moved them to `-p4` they resolve, so a hunk upstream has
moved out from under leaves `templates/cdi-operator.yaml.rej`; its `awk
-i inplace` step leaves `templates/cdi-operator.yaml.gawk.XXXXXX` if
gawk dies abnormally. Helm renders every file under `templates/`, and I
reproduced both: the reject fails the package with a YAML parse error,
and the gawk temp renders a duplicate object at exit 0. The wipe is what
takes both, so removing it for symmetry would trade a latent loss for a
live one, and the quieter of the two is the one that survives.

Deleting the wipe there wants the recipe restructured to transform
outside `templates/` and move the result in once, which is what
`kubevirt-operator` does today and what its own comment gives this exact
reason for. That is a larger change than this one and belongs on its
own; #4383 makes it. Meanwhile the scan below covers the package: I
added a first-party file to its `templates/` and the guard reported it,
so the day that package grows one, this fails rather than the file being
lost.

`hack/package-update-templates.bats` guards this across the tree rather
than in these two packages. It scans every package Makefile and fails
when a recipe that clears its own `templates/` leaves behind a tracked
file it never names. Put the removal back into `kubevirt-cdi` and it
goes red naming both upload-proxy files. A file counts as named only
outside the Makefile's own `NAME` and `NAMESPACE`, however the
assignment is written. The match is on the variable name rather than on
a list of spellings: the tree already carries three of them, `export
NAME=`, the bare `NAME=`, and `NAME := ` in `packages/core/testing`, and
the hole is identical in each. Without that, a package called `foo-bar`
satisfies the check for its own `templates/bar.yaml` through its
identity alone. Nothing the scan reaches is exempted that way as the
tree stands, so the exclusion is there for the first package that would
be: rename the asset in `kubevirt-cdi-operator`'s recipe and put the
removal back, and the guard reports the orphaned template only with the
exclusion in place. The two variables are matched by name rather than by
a `[A-Z_]+=` shape, because a shape that broad is one unspaced
assignment away from swallowing a variable that does name templates,
which is how `etcd-operator-crds` names all five of its CRDs. A control
test runs the same helpers over a fixture broken the same way, over one
whose name swallows a template stem, then over that fixture rewritten to
spell the removal with a trailing slash, to take one file instead of the
directory, and to drop the removal entirely. Both cases pass under
`hack/cozytest.sh hack/package-update-templates.bats`.

Two limits, both written into the file's header. The check fires on the
consequence rather than the shape, so `rm -rf templates` in a package
that does refetch everything stays green, which is what keeps
`kubevirt-cdi-operator` green for as long as its recipe wipes. And it
only looks at a recipe clearing its own directory: `cert-manager` clears
`../cert-manager-crds/templates/*` across the package boundary, which
needs the removal's target resolved rather than the wiping package's
own, so that directory is unguarded. The other packages that clear their
own `templates/` refetch all of it and are untouched here.

Two more limits the header names. The scan reads the text of each
package's own `update:` recipe, so a removal made elsewhere is out of
range: in a prerequisite target, behind an include, or behind a
recursive make. `capi-operator`, `clustersecret-operator`, `openbao` and
`reloader` write `update: clean <name>-update` and take both recipes
from `hack/package.mk`, which removes nothing under `templates/` today.
And the glob stops at `packages/*/*/Makefile`. The package Makefiles off
that depth are the group aggregators such as `packages/system/Makefile`
and the vendored kamaji subcharts, and none of them declares `update`.

One behaviour of the matcher worth naming, and deliberately not changed
here. `wipe_command` evaluates `/^update:/` ahead of its terminator, so
a second `update:` in the same Makefile re-arms the scan instead of
ending it, and what that means depends on what sits between the two:
adjacent or separated by a blank line, both recipes are read; separated
by another target, only the first is. The direction that matters is a
false positive rather than a miss. A Makefile whose first `update:`
clears `templates/` and whose second does not would be reported by this
scan, while make runs only the second, so the package fails over a
recipe that never executes. No package in the tree defines `update:`
twice today.

Three more notes, all non-blocking and none acted on. The header says
what the scan leaves uncovered is a recipe clearing someone else's
`templates/`; that is the uncovered set for *deletion*, and
`kubevirt-cdi` is green under the scan while still losing
`cdi-cr.yaml`'s content to the in-place `wget -O` on every run, which
the Makefile comment records but the header does not. The identity strip
has a false-positive direction the header does not argue: a wiping
package writing `templates/$(NAME).yaml` would be reported even though
the recipe writes it, which no package does today. And the fixture
stages `.gitkeep` with `git add --all`, so a developer whose global
excludes list that name would get a red for environment rather than
defect; `--force` would remove the dependency.

The stem match is generous, and the helper's comment now names the two
live shapes. A sibling name: `templates/crds.yaml` next to the existing
`templates/crds-experimental.yaml` on `gateway-api-crds`. A mention from
an unrelated context: `templates/sidecar.yaml` on
`objectstorage-controller`, whose Makefile says `sidecar` across its
image targets while its recipe clears `templates/` and writes only
`templates/controller.yaml`. I fed both to the helper and both come back
exempted; a stem the Makefile never mentions is still reported.

The duplicate `test:` target in this Makefile is #4157 and stays there.
It sits outside the hunks this diff touches, so removing it here would
be reaching past what this change is about.

One more note, not a defect. Where the comment points at
`kubevirt-operator` as the shape that closes the transient-file class,
`packages/system/kubevirt/Makefile` is the closer analogue for the
`cdi-cr.yaml` half specifically: its `update` downloads nothing and
re-applies the parameterization onto a hand-maintained CR with a
per-marker self-check. And the failure message offers a third option,
staging into a tmpdir the way `etcd-operator-crds` does, in a
parenthetical that reads as a gloss on the option before it.

What this PR does not fix, and what does. `make update` here still
overwrites `templates/cdi-cr.yaml`, which the Makefile comment says
plainly. A wholesale overwrite is loud: upstream's object carries
neither `podResourceRequirements` nor `cloneStrategyOverride`, and
`tests/importer-resources_test.yaml` and
`tests/clone_strategy_test.yaml` pin both, so `helm unittest` goes red.
The silent case is a partial hand reconciliation that keeps those two
and drops something else, because nothing here pins the `ExpandDisks`
gate, the `CriticalAddonsOnly` toleration, the `uploadProxyURL` override
or the two RBAC documents that preauthorize tenant cloning from
`cozy-public`. #4107, stacked on this branch, stops `update` writing the
file at all and adds `tests/local_templates_test.yaml`, which pins
those.

One limit the header does not name, left alone here. The comment strip
is anchored to the start of a line, so a trailing comment on a recipe
line survives into the searched text and counts as naming the file it
mentions. I confirmed it by feeding `wget ... -O templates/cdi-cr.yaml #
local-extra.yaml is written by hand` through the filter. Nothing in the
tree is written that way, and the header only claims comment lines are
dropped, which is what it does. `sed 's/#.*//'` in place of the `grep
-v` closes it if it ever matters.

Closes #4028.

### Screenshots

No UI change.

### Downstream repositories

Walked the trigger map in `docs/agents/contributing.md` against the
diff. Two entries come close: the website's "developer tooling (the
package `Makefile`s)" line, and ccp's "move or rename anything under
`hack/`". Neither fires. `make update` still behaves as the website's
development page describes, nothing under `hack/` moved or was renamed,
and the two files ccp's skills key on (`hack/package.mk`,
`hack/common-envs.mk`) are untouched.

- [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(cdi): `make update` in kubevirt-cdi no longer deletes its first-party templates
```


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

- **Bug Fixes**
- Updated Kubernetes CDI package updates to preserve existing template
files while refreshing downloaded manifests.
- Prevented update operations from clearing first-party and vendored
template content.

- **Tests**
- Added safeguards to detect package update recipes that could remove
tracked templates without restoring them.
  - Added Helm unit test support for the Kubernetes CDI package.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-23 12:23:58 +04:00
Aleksei Sviridkin ce35da451f docs(api): separate the healthCheckExprs failure modes (#4387)
## What this PR does

The `healthCheckExprs` field doc said any bad expression makes the
HelmRelease hang until its timeout. That is true for some mistakes and
wrong for others, and the text ships in the CRDs, so `kubectl explain`
sends people to the wrong place.

The doc now lists the cases separately, checked against the controller
versions this repo installs (helm-controller v1.5.0, fluxcd/pkg runtime
v0.100.2, Helm v4.1.1). An expression that does not parse, an empty
`current`, or a duplicate group and kind stall the release right away
with reason `InvalidCELExpression`, and no Helm action runs. An
expression that errors on the object keeps the wait polling until the
timeout with the CEL error in the message. A `current` expression that
evaluates but never turns true also runs the timeout out, with no error
to point at it. A wrong group or kind leaves the expressions unused.

Two details go against the issue text. Reading `status` before the CR's
controller writes one errors even inside `has()`, as the issue says, but
the object is only Unknown on that poll, and the wait still succeeds
once a status shows up. A CRD that is not installed does not hang the
wait: Helm fails to build the manifest and the action fails before any
wait starts.

Doc comments and the regenerated CRD YAML only, no behaviour change.

Closes #4154

### Screenshots

No UI change.

### Downstream repositories

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

### Release note

```release-note
docs(api): describe each healthCheckExprs failure mode separately in the ApplicationDefinition and PackageSource field docs.
```


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

## Summary by CodeRabbit

* **Documentation**
* Expanded the health-check expression guidance to explain how invalid
or duplicate expressions, evaluation errors, expressions that remain
false, unmatched resource types, and missing CRDs affect Helm releases.
* Clarified that health-check expressions are not evaluated when Helm
action waiting is disabled.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-23 11:52:49 +04:00
Aleksei Sviridkin d48d3ecc91 test(console): add coverage for enrichSchemaWithEnums (#4186)
## What this PR does

backup-utils.ts (in the in-tree console dashboard) had no test file at
all, despite sibling files in the same directory
(dynamic-options.test.ts, crd-option-sources.test.ts,
immutable-paths.test.ts) establishing that convention. Adds
backup-utils.test.ts covering enrichSchemaWithEnums: the non-object
passthrough, a path with no match in the enum map, a top-level enum
attach, a nested one, and that the caller's path array is not mutated
(verified by reading the function, it builds a new array via spread on
every recursive call rather than mutating the one it receives).

Test-only change, no production code touched. Verified with vitest run
src/lib/backup-utils.test.ts (5 tests pass) and tsc --noEmit (no new
errors).

### Screenshots

N/A, test-only change, no UI impact.

### Downstream repositories

Walked the trigger map in docs/agents/contributing.md against the diff.
This is a single new test file for a pure function, no production code,
schema, API, CRD, annotation, or naming changed.

- [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

- **Tests**
- Added coverage for schema enum enrichment, including top-level and
nested paths.
  - Verified that unrelated schemas remain unchanged.
- Confirmed unmatched paths and caller-provided path arrays are handled
safely.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-23 11:42:16 +04:00
Aleksei Sviridkin 90a1a947c5 feat(kube-ovn): bump kube-ovn to v1.15.26 (#4331)
## What this PR does

Bumps kube-ovn from `v1.15.10` to `v1.15.26` (package `cozy-kubeovn`
`0.38.0` -> `0.39.0`).

The motivation is a cold-start failure mode in the OVN NB/SB raft leader
checker. In `v1.15.10`, `checkDBClusterIntegrity`
(`pkg/ovn_leader_checker/ovn.go:336`) called `os.Remove` on a healthy
local raft DB (`ovn.go:367`) whenever a leader observed fewer members
than expected. That count drops below the target transiently during
cluster growth, a rolling restart, or recovery after a node address
change, so the check could delete a valid DB and leave `ovn-central`
unable to elect a leader. `v1.15.26` removes that function entirely, so
the DB is no longer deleted. It is a removal of the faulty check, not a
grace-period around it.

The chart is re-vendored with `make update`, not hand-edited, so the
templates match the image:

- `charts/kube-ovn` is re-pulled from the `v1.15.26` tag and
`patches/mtu.diff` is re-applied; the image build args are regenerated.
- This brings the whole v1.15.26 chart: the reworked master-node
affinity helpers, the widened kube-ovn CRD schema
(`bandwidth.ingress`/`egress` from `integer` to int-or-string,
`u2oFeatures` added), and the new `OVN_CENTRAL_MODE`
(`cluster`/`single`) support with its `central-svc`, `central-pvc` and
`central-hcp-rbac` templates. `OVN_CENTRAL_MODE` defaults to `cluster`
(raft on hostPath), so an in-place upgrade keeps the existing topology.
- Two vendored patches now included upstream in `v1.15.26` are dropped:
`fix-keepvmip-portgroup.diff` (`hasAliveSiblingVMPod`, `pod.go:2437`)
and `fix-vmim-scheduling-retry.diff` (scheduling requeue,
`kubevirt.go:195`). `fix-vmim-target-pod-retry.diff` is kept: `v1.15.26`
still returns nil at `kubevirt.go:215`.

The image also picks up `kube-ovn-bfdd-supervisor`, which v1.15.26 adds
(`makefiles/build.mk:33`) and upstream's `dist/images/Dockerfile:12`
copies into `/kube-ovn`. `pkg/controller/vpc_egress_gateway.go:47`
hardcodes that path for the `bfdd` container a `VpcEgressGateway` with
`spec.bfd` gets, so a copy that stops at `kube-ovn-controller` ships a
container that cannot exec. `hack/check-kubeovn-image-copies.sh`
compares what our Dockerfile and upstream's copy into the image, `make
update` runs it against the tag it pulls and
`hack/check-kubeovn-image-copies.bats` runs it on every CI run, because
`make update` otherwise rewrites only the ARG lines and the copy drifts
at each bump.

The `multus` commit moves the `kube-ovn-cni-plugins-checked-against`
marker to `v1.15.26`. `CNI_PLUGINS_VERSION` is `v1.9.1` in kube-ovn's
base image at both releases and in multus, so portmap and macvlan stay
in lockstep; the marker is the only change.

The image ref stays digest-pinned (`repository` + `tag@sha256`), which
the promote-retag release contract requires for a cozystack-built image.
The digest is carried over from `v1.15.10` as a placeholder and is
refreshed to the real `v1.15.26` image by the release-candidate
digest-vendoring step; no PR or main job rebuilds it.

Verification: `helm unittest .` passes (22 tests), `helm template .`
renders clean, the `cni-plugins-staging-contract` and `promote-retag`
unit contracts are green, and the image-build
`TestVMIMigrationSchedulingRetry` gate passes 6/6 on the patched
v1.15.26 tree.

> [!NOTE]
> `start-db.sh` was substantially reworked upstream between `v1.15.10`
and `v1.15.26`. The privileged fork E2E run installs into a sandbox and
passes, but the in-tree E2E job is skipped on a fork PR, and a fresh
install is not an upgrade. An in-place upgrade on a multi-node control
plane (image rebuild plus OVN raft re-convergence) is still untested
before merge.

### Screenshots

N/A: no UI changes.

### Downstream repositories

Walked the trigger map against the diff. The change is confined to
`packages/system/kubeovn` (re-vendored chart, image build args, version
pins) and a one-line marker in `packages/system/multus`. It does not
add, rename or remove a package, does not touch platform values,
variants, components, release assets, `ApplicationDefinition` semantics,
the Talos version, or any hand-typed CRD schema in a downstream
provider. No downstream trigger matches.

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

### Release note

```release-note
feat(kube-ovn): bump kube-ovn to v1.15.26, which removes the OVN leader-checker integrity check that could delete a healthy raft DB and prevent ovn-central from electing a leader after a node address change or rolling restart
```


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

- **New Features**
- Added hosted control-plane support for OVN Central with StatefulSet
deployment, persistent storage, service exposure, and dedicated RBAC.
- Added split-cluster and data-plane-only configuration with external
OVN endpoints.
- Added configurable TLS, leader election, service, and storage
settings.
- Enhanced CRDs with overlay-only routing and flexible bandwidth
quantities.

- **Bug Fixes**
- Improved VM migration retries during scheduling and preserved
connectivity during live migration.
  - Improved upgrade handling and service configuration validation.

- **Updates**
  - Upgraded Kube-OVN components and images to version 1.15.26.
- Documented required OVN IPsec directory preparation for read-only
filesystems.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-23 02:42:25 +04:00
Aleksei Sviridkin 0f21d06520 fix(dashboard): raise the console nginx header buffers for large OIDC tokens (#4376)
## What this PR does

A user whose OIDC access token carries many group claims cannot use the
console: nginx answers `400 request header or cookie too large` before
the request reaches the apiserver proxy. The config baked into the
console image kept the nginx defaults, 1k for
`client_header_buffer_size` and four buffers of 8k for
`large_client_header_buffers`, while the token arrives as one Cookie
header several kilobytes long. A header field has to fit into a single
buffer, so the per-buffer size is what decides this. Both directives are
now 16k, at the top level of that config rather than inside the server
block: a header field read before the `Host` header has selected the
virtual server is measured against the default server's buffers, so the
same lines inside a server block cover that server only while it stays
the default one.

Measured in the pinned nginx base image: a 12 KB cookie gets 400 on the
old config and 200 on the new one, a 20 KB one still gets 400. `nginx
-t` accepts the result.

This hop sees more than the browser sent. The gatekeeper in front of it
runs with `--pass-access-token=true` and
`--pass-authorization-header=true`, so the request arrives carrying the
`kc-access` cookie, an `Authorization: Bearer` header and
`X-Forwarded-Access-Token`, three separately bounded header fields where
the edge saw one.

This is the console image only. The platform ingress-nginx controller
also runs on the defaults, which is #2853. Worth reading that trace
again before fixing it there: the controller logged `upstream_status
400`, so it forwarded the request and the 400 came back from behind the
gatekeeper, which is this layer.

The check in `hack/console-nginx-header-buffers.bats` reads the config
out of the Containerfile heredoc and fails when either directive is
missing, below 16k, or no longer ahead of the first server block. That
config lives inside an image build, so no chart template and no
helm-unittest case can reach it. `make unit-tests` picks the file up on
its own.

No image reference changes here. CI stamps the console digest.

Closes #3113

### Screenshots

No UI change. This is the nginx config in front of the SPA.

### Downstream repositories

The diff is the console image's nginx config plus one new `hack/*.bats`
file. `cozystack-ui` is archived and the console lives in this repo, so
a console change belongs in this PR. Nothing under `hack/` moved or was
renamed, and no make target changed behaviour.

- [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(dashboard): the console no longer answers `400 request header or cookie too large` to users whose OIDC access token carries many group claims
```


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

## Summary by CodeRabbit

* **Bug Fixes**
* Increased the console’s NGINX request-header buffer capacity to
support larger header fields and request headers.
* Improved handling of requests with headers that previously exceeded
the default buffer limits.

* **Tests**
* Added automated checks to verify the console’s NGINX header-buffer
settings remain correctly configured.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-23 01:31:45 +04:00
Aleksei Sviridkin 65a038caa4 docs(api): separate the healthCheckExprs failure modes
The field doc filed every mistake under one outcome, a HelmRelease
that hangs until its timeout. helm-controller treats them differently.
An expression that does not parse is rejected before any Helm action
and stalls the release at once, with a named reason. One that parses
but errors on the object keeps the wait polling with the CEL error
attached, and a current expression that evaluates cleanly but never
turns true runs the wait out with no error at all. A read of status
errors until the CR's controller writes one, even inside has(), but
the wait survives it. A wrong group or kind silently falls back to
the built-in readiness rules, and a CR whose CRD is missing fails the
Helm action before the wait starts.

The text ships in the CRDs and is what kubectl explain shows, so a
reader who cannot check it against the controller source was sent
to the wrong place for the parse error and the missing CRD.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-23 00:05:35 +03:00
Aleksei Sviridkin 2f5625f0dc fix(cdi): stop make update from deleting first-party templates
The update recipe in kubevirt-cdi opened with `rm -rf templates` and
then refetched one upstream manifest. The directory keeps two more
files -- the upload-proxy Ingress and TLSRoute -- that are written by
hand and never refetched, so the next CDI bump would drop upload-proxy
exposure from the chart while `make update` still exited 0. The clean
slate bought nothing either way: wget -O truncates the file it writes.

The recipe now creates the directory with `mkdir -p` and leaves the
rest of it alone, which is what kubevirt-operator moved to when it was
last bumped.

kubevirt-cdi-operator keeps its wipe. The same change there would be
for symmetry rather than for a loss, and it is not free: both its
patch calls resolve, so a hunk upstream has moved out from under
leaves templates/cdi-operator.yaml.rej, and gawk's inplace edit leaves
templates/cdi-operator.yaml.gawk.XXXXXX if it dies abnormally. Helm
renders every file under templates/, so the first fails the package
loudly and the second renders a duplicate object at exit 0. The wipe
is what takes both. Removing it wants that recipe restructured to
transform outside templates/ the way kubevirt-operator now does, which
is its own change. Until then the scan below is what watches that
package, with the limit the scan already documents: it reports a
tracked template whose stem the Makefile never mentions, so a name
that collides with something already written there, templates/
tolerations.yaml against the patches/tolerations.diff line, is
exempted. It catches the loss it was written for, not every loss.

The bats case scans every package Makefile rather than a pinned list,
so a first-party template added under a recipe that clears templates/
fails the commit that adds it instead of vanishing at the next bump.
A package's own NAME and NAMESPACE do not count as naming a file,
because a package called foo-bar would otherwise vouch for its
templates/bar.yaml with nothing writing it. A removal reaching into
another package is outside the scan's range, and the header records
the case in the tree that this leaves uncovered.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-22 23:53:49 +03:00
Aleksei Sviridkin a75919087e fix(opensearch-operator): bound every call to a cluster's HTTP API (#4341)
<!-- 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

A call to a cluster's HTTP API has no bound of its own.
`NewOsClusterClient` builds its own `http.Transport`, and a fresh
transport carries no dial, TLS-handshake or response-header timeout; the
config sets no `http.Client`, so there is no timeout there either; the
calls the client makes on its own behalf pass `context.Background()`;
and the calls that take a context from the caller are handed one with no
deadline on it, since nothing on the reconcile path sets one. The
`Timeout` field the request types carry is the server-side query
parameter: it bounds how long the server waits before answering, which
helps only once something answers.

Each controller runs a single worker, so one call that never returns
stops every `OpenSearchCluster` from being reconciled, and the finalizer
on the next deletion waits out its whole termination timeout with
nothing in the log to say why. Reported in #4337, measured in #4332.

A fourth patch on the image bounds every request the operator's client
sends, at two levels.

- Every request goes out through a `RoundTripper` that puts a 30s
deadline on it. That is the only level that reaches the request
opensearch-go builds for itself: before a client's first request the
library runs a product check with a `context.Background()` of its own
and decodes the body of the answer, and a client is built per reconcile,
so that check runs on every one. The deadline cannot be released when
`RoundTrip` returns, because the body goes back to the caller still
open, so the cancel rides on the body and is released by `Close`, which
is how `http.Client` applies its own `Timeout`.
- That bounds one attempt. opensearch-go retries a request up to three
more times on 502, 503 and 504, and the transport's deadline starts over
on each of them, so the calls carry a 30s deadline a second time for the
series: the 15 calls in `os_client.go` that request and decode before
returning through `requestContext`, and the 28 that go through the
`doHTTP*` helpers in `performRequest`.
- The transport keeps a 10s dial and a 10s TLS handshake, so an
unreachable node fails in a third of the budget with an error that names
what went wrong.

`ResponseHeaderTimeout` is gone from the transport. It stops counting
the moment the headers arrive, so it is no bound on a body that starts
and then stops, and at 60s it sat above a request deadline that now
covers everything it covered.

This bounds the wait, it does not make an unresponsive cluster answer: a
call that passes its deadline fails the reconcile, which requeues.

The change belongs upstream, and there is no upstream issue for it yet.
The Dockerfile entry carries the drop condition the other entries carry.

### Tests

Seven, in the package the image's own `go test -race` step already runs:

- a call to a cluster that accepts the request and answers nothing
returns instead of running forever;
- a new client, against a cluster whose product check flushes its
headers and then stops, returns instead of running forever;
- a request through the operator's transport, to a server that accepts
the connection and then says nothing, returns instead of running
forever;
- a body that arrives with its headers and then stops is abandoned;
- a call retried on 503 is bounded as a series rather than per attempt;
- a body is still readable after the call that fetched it has returned;
- the transport carries the handshake bound by value, and the dial bound
through the dialer it is built from.

Every bound was checked against the mutation that removes it, and all
seven turn a test red: the transport wrapper dropped from the
constructor, the deadline dropped from `RoundTrip`, the cancel moved off
the body there, the deadline dropped from `performRequest`, one call
site reverted to `context.Background()`, and the dial and handshake
timeouts dropped in turn. Waits are measured from the test goroutine, so
an unbounded call fails the test rather than hanging the run until CI
kills it. The silent-server test holds its accepted connections and
forces a collection while the call is in flight, because an unreachable
`net.Conn` is closed by the collector (`net/fd_posix.go` puts a
finalizer on `netFD`) and that turns the silent server into one that
resets the connection.

The full four-patch sequence applies to a pristine v2.8.0 tree in the
glob order the build relies on, with no offsets and no fuzz; `gofmt` and
`go vet` are clean; and `docker buildx build images/opensearch-operator`
builds the image on linux/arm64 with the `go test -race` step green.

### Screenshots

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.
-->

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

Walked the trigger map against the diff: one comment block in
`packages/system/opensearch-operator/images/opensearch-operator/Dockerfile`
and one new file in that image's `patches/`. No package added, renamed
or removed, no values key, no schema, no enum, no `hack/` file, no make
target, no namespace and no `ApplicationDefinition`.

### 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(opensearch-operator): time out calls to a cluster's HTTP API, so one unanswered request no longer stops the operator reconciling
```


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

* **Bug Fixes**
* Added timeout handling for OpenSearch cluster connections, including
connection, TLS-handshake, response-header, and request deadlines.
* Prevented requests from hanging indefinitely when a cluster is
unavailable, unresponsive, or stops returning data.
* Ensured response bodies remain readable after the initial request
completes when applicable.
* Bounded the full request lifecycle, including response-body reads and
retried calls.

* **Tests**
* Added coverage for connection, response, retry, and body-read timeout
scenarios.
  * Enabled race detection for relevant package tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-23 00:47:46 +04:00
Aleksei Sviridkin 4bf95815a8 fix(kubernetes): render the aggregation-layer UID header for tenant OIDC (#3539)
## What this PR does

Tenant clusters with `spec.oidc.mode: System` or `CustomConfig`
authenticate users fine, but a UID does not survive the hop to an
aggregated API server. The tenant kube-apiserver publishes
`requestheader-uid-headers` into the
`extension-apiserver-authentication` ConfigMap only when the flag is
set, and the chart never set it. The aggregation layer still sends
`X-Remote-Uid`, but the extension server trusts only the header names
published in that ConfigMap, so it ignores the one it gets and the call
arrives without a UID. The field documentation even told operators to
add the flag by hand via `controlPlane.apiServer.extraArgs`.

It forwards a UID rather than creating one. ServiceAccount tokens carry
one, and for those the aggregation hop starts working. Users
authenticated by `spec.oidc.mode: System` still have none, because the
generated AuthenticationConfiguration maps `username` and `groups` only;
giving them one means mapping a claim, which changes the identity of
users who have none today, and is tracked separately.

The chart now renders `--requestheader-uid-headers=X-Remote-Uid` on
v1.32 and newer, and adds `--feature-gates=RemoteRequestHeaderUID=true`
on v1.32, where the gate is still alpha and the apiserver rejects the
flag without it. From v1.33 the gate is beta and on by default, so only
the header flag is rendered. v1.31 gets nothing: the flag does not exist
there, and writing it by hand stops the apiserver from starting.
`--emulated-version` in the same passthrough moves that decision,
because the gate resolves through the versioned spec at the emulated
version.

Rendering the gate on every version from v1.32 rather than on v1.32
alone was the alternative, and it would remove the migration step
entirely, because an opt-out would then drop two entries instead of one
and move the entry count by itself. It loses on what it leaves behind: a
redundant gate term on every cluster, which stops the apiserver from
starting on the day the gate is retired from the known list. The design
also prefers rendering over failing for the same reason the fail
branches are narrow, since a cluster stranded on a HelmRelease that no
longer converges is a worse outcome than one that never gets the UID
fix.

The chart reads an operator entry the way the apiserver reads it: header
list elements matched whole and untrimmed and folded as `EqualFold`
folds them, gate names compared exactly, gate values resolved as
`strconv.ParseBool` resolves them, `AllAlpha` and `AllBeta` blankets
honoured, an empty value treated as no entry. On v1.32 an entry that
says nothing about `RemoteRequestHeaderUID` gets a second one carrying
the operator's own terms plus `RemoteRequestHeaderUID=true`. Carrying
those terms into the merged copy is what makes it land correctly whether
the tenant control plane collapses duplicate flags into the last one or
hands both to the apiserver, which merges them in the order it reads
them.

Tests cover the render matrix over mode, version and operator input:
every fail path with its exact message, the ownership and merge paths,
duplicate entries in both orders, blanket gates, empty values, and case
variants on the header name and on the gate value. The latest-version
tenant lane creates its tenant with `spec.oidc.mode: System` and asserts
the flag on the rendered KamajiControlPlane, so the tenant apiserver
starts with the flag in CI. Nothing asserts the UID arriving at an
aggregated apiserver; that needs an extension server inside the tenant
and is not in this change. The layer where the count-keyed reset
actually bites is the tenant Deployment's arguments, and asserting there
needs a live tenant control plane, so it is not in this change either.

The rule this follows is that a configuration which renders and boots
today keeps rendering. Both flags are new, so an `extraArgs` shape
reaching this code was rendering before it existed, and stranding a
running tenant on a HelmRelease that no longer converges is a worse
outcome than one that never gets the fix. A few shapes do stop
rendering, and reaching any of them takes writing
`--requestheader-uid-headers` into the passthrough by hand, attempting
exactly what the chart now does and getting it wrong; in each the
kube-apiserver fails option validation and never starts, so nothing that
was working is lost. `docs/oidc-tenant.md` covers these shapes. One
known limitation is in there and worth naming here: on v1.33 and newer,
adding the documented opt-out is count-neutral in `extraArgs`, and so is
removing it again, and on v1.33 and v1.34 adding or removing
`--emulated-version=1.31`. The pinned Kamaji build rewrites a running
apiserver's arguments only when that count changes and otherwise keeps
every flag that has left the list, so either the header flag stays
beside a now-disabled gate or the disabled gate stays beside the header
flag, and the apiserver refuses to start. Changing the entry count in
the same edit is the mitigation, and the fix belongs to the pin rather
than to this chart, tracked in #3541. The paths that need no operator
edit are clear: turning the feature on for a default tenant moves the
count, and a tenant already carrying the opt-out renders
byte-identically before and after.

Out of scope: `mode: None` still publishes no UID header even though
ServiceAccount tokens carry UIDs. That is pre-existing, and widening the
condition changes the render for every default tenant. Tracked
separately, along with the claim mapping above.

Closes #3377

### Screenshots

Not a UI change.

### Downstream repositories

- [x] No downstream repository is affected by this change

Checked the trigger map against the diff: no package added or removed,
no schema field, enum or default changed (description text only), no
ApplicationDefinition surface touched, no hack/ layout moved. The
managed-apps reference page picks up the new field description through
release-time README regeneration.

### Release note

```release-note
fix(kubernetes): tenant clusters with `spec.oidc.mode` set to `System` or `CustomConfig` now render `--requestheader-uid-headers=X-Remote-Uid` on the tenant kube-apiserver, plus the `RemoteRequestHeaderUID` feature gate on v1.32, so that an aggregated API server can read the caller's UID out of the request headers. Without that flag the tenant apiserver never publishes `requestheader-uid-headers`, and an aggregated API server ignores the UID header even for callers that have one, ServiceAccount tokens among them. It forwards a UID rather than creating one: users authenticated by `spec.oidc.mode: System` still have none, because the generated AuthenticationConfiguration maps `username` and `groups` only, and that is tracked separately. Adding the flag by hand through `controlPlane.apiServer.extraArgs` is no longer necessary, and an entry of your own is respected: the chart steps aside when yours already carries `X-Remote-Uid` or already enables the gate, merges `RemoteRequestHeaderUID=true` into a copy of a v1.32 `--feature-gates` entry that says nothing about the gate, and renders neither flag when you switch the gate off. The render fails where a `--requestheader-uid-headers` list of your own would stop the kube-apiserver from starting anyway: one that omits `X-Remote-Uid`, one with an empty element, and a list of your own while the gate is off. On v1.33 and newer there is a migration step, and it applies in both directions: the pinned Kamaji build rewrites a running apiserver's arguments only when the number of `extraArgs` entries changes, and otherwise keeps every flag that has left the list. Adding the documented opt-out keeps that number the same, so the header flag already on the Deployment stays beside the now-disabled gate. Removing the opt-out later keeps it the same too, so the disabled gate stays on the Deployment beside the header flag the chart renders again, although your spec no longer shows it. Adding or removing `--emulated-version=1.31` has the same shape both ways on v1.33 and v1.34. The apiserver refuses to start in each case, so change the entry count in the same edit.
```
2026-09-23 00:03:20 +04:00
IvanHunters 48058dcc74 build(opensearch-operator): run the patched tree's tests under -race
The timeout tests drive a listener from one goroutine and inspect what it
accepted from another. The plain run passes an unsynchronised access there, so
nothing in this repository would catch one. The builder image carries cgo and
gcc, and the package images are built natively on x86-64 runners, so the
detector is supported where this runs.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-22 22:50:24 +03:00
IvanHunters 1a2c87635a fix(opensearch-operator): bound every call to a cluster's HTTP API
Upstream gives the operator's calls to a cluster no deadline of any kind. The
transport it builds carries no dial, handshake or response-header timeout, no
http.Client is configured, the calls the client makes on its own behalf pass
context.Background(), and the ones that take a context from the caller are
handed one with no deadline on it. A cluster that accepts a connection and then
says nothing holds such a call for as long as the process lives, and with one
worker per controller that single call stops every OpenSearchCluster from being
reconciled. The deletion that then waits out its whole termination timeout is
the visible end of it.

The bound goes on the RoundTripper, the one level every request passes through,
the ones opensearch-go builds for itself included: before a client's first
request the library runs a product check that carries a context.Background() of
its own and decodes the body of the answer, and a client is built per reconcile,
so that check runs on every one. The deadline cannot be released when RoundTrip
returns, because the body goes back to the caller still open; it rides on the
body and is released by Close, the way http.Client applies its own Timeout.

That bounds one attempt. opensearch-go retries a request up to three more times
on 502, 503 and 504 and the transport's deadline starts over on each, so the
calls carry a deadline a second time for the series: through requestContext
where the call decodes the answer before it returns, and through performRequest
where the still-open body goes back to the caller. The dial and the TLS
handshake keep a shorter bound of their own, so an unreachable node fails in a
third of the budget with an error that names what went wrong.

Each of those bounds has a test that fails when it is removed.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-22 22:50:24 +03:00
Aleksei Sviridkin 08bbed3fb5 feat(talos-log-collector): add talos-log-collector package (#3260)
## What this PR does

Adds `talos-log-collector`, an optional system package: a node-local
Vector
DaemonSet that receives Talos machine and kernel logs and forwards them
to the
tenant VictoriaLogs (vlinsert), alongside the container/audit/event logs
already collected by monitoring-agents.

Talos keeps system and kernel (kmsg) logs inside the OS and does not
write them
to a host file the Fluent Bit `tail` input could read, so these logs are
currently never collected. Vector receives them over the node loopback
(Talos pushes to 127.0.0.1:5170). Talos exposes the two streams through
independent config paths, and both must point at the loopback socket:
`machine.logging.destinations` forwards the JSON-lines service logs, and
a
`KmsgLogConfig` document forwards the kernel (kmsg) stream (including
DRBD
kmsg). The node-side setup for both is in the README.

Design notes:
- The pod stays on the pod network so cluster DNS resolves vlinsert with
no
  extra config. Talos pushes to 127.0.0.1:5170; a `hostPort` bound to
`hostIP: 127.0.0.1` publishes that loopback socket into the pod via
portmap,
  keeping the receiver off the host network (no node-wide pod exposure).
- The receiver binds inside the pod netns, so a NetworkPolicy is
load-bearing:
a CiliumNetworkPolicy restricts ingress to the host entity when Cilium
is
present, otherwise a default-deny-ingress `networking.k8s.io/v1`
fallback
  keeps the socket protected on non-Cilium variants.
- Runs non-root, read-only root filesystem, all capabilities dropped.
- Optional package (opt-in via `bundles.enabledPackages`): inert until
each
Talos node is configured to push logs. Node-side setup is in the README.

Verified end-to-end on a Talos v1.12 dev cluster: service and kernel
logs
(including DRBD kmsg) reach VictoriaLogs; pods run non-root with 0
restarts.

### Release note

```release-note
feat(talos-log-collector): add talos-log-collector package to collect Talos machine and kernel logs into VictoriaLogs
```


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

* **New Features**
* Added an optional node-local Talos log collector (via system bundle
packages) that forwards Talos service and kernel logs over loopback to
the platform log ingestion endpoint.
* Introduced the collector Helm chart (Vector-based) with configurable
log level, loopback TCP receive port, digest-pinned image, default
resources, and routing target.
* Added conditional Cilium network policy support with a safe
deny-by-default fallback.
* **Security**
* Hardened the collector to run non-root with reduced privileges,
read-only filesystem, and dropped Linux capabilities (and disabled
service account token automount).
* **Documentation**
* Documented configuration requirements (including kernel log
enablement), operational behavior, and teardown steps.
* **Build & Release**
  * Extended the build to include building the collector’s image.
* **Tests**
* Added Helm rendering/contract tests covering daemonset, configmap,
service account, and network policy.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-22 23:49:33 +04:00
IvanHunters 47a611cf9e docs(kube-ovn): point the update comment at the test that asks for the fixture
The comment said the bats suite compares against "a fixture this step
tells you to refresh", but the update step never mentions the fixture:
its failure asks you to fix our Dockerfile. The test named "the fixture
tracks the vendored chart version" is the one that asks, and it fires
after a bump lands.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-22 22:47:57 +03:00
Aleksei Sviridkin 4fbef512b4 fix(opensearch-operator): name the component reconciler a stall sits in (#4333)
## What this PR does

The cluster controller runs nine component reconcilers in sequence, and
none of them logs unconditionally when it is entered. The TLS one has a
line above its work, but it sits on the early return for a cluster with
no security section, which
`packages/apps/opensearch/templates/opensearch.yaml` never renders, and
the rolling restart one opens at `V(1)`, off at the verbosity the
operator ships with. So a call that stops returning leaves nothing
behind at all: the operator log ends on whatever ran before it, the
object stops being reconciled, and from the outside that is
indistinguishable from an operator with nothing to do.

That is not hypothetical. Two e2e runs on 2026-09-18 ended that way, and
the evidence is the operator's own log, read out of the crust-gather
host snapshot each failed run uploads, at
`snapshots/opensearch/host/namespaces/cozy-opensearch-operator/v1/pod/opensearch-operator-controller-manager-*/operator-controller-manager/current.log`.

In run 35343282947 the operator reconciled `OpenSearchCluster` 27 times
on a steady cadence, gaps of 10.2s for almost all of them and 26.5s at
the widest. Its last line is at 13:51:33.225Z. helm-controller applied
the CR revision that moves the cluster onto the chart CA at 13:51:35Z.
Nothing was written for the remaining four minutes, the pod stayed
Running and Ready with 0 restarts, and the admin certificate the step
was waiting on was never re-minted. Run 35333289958, a different branch
and a different operator pod, has the same shape: last line
10:56:35.706Z, Apply at 10:56:38Z, widest gap before that 24.2s, then
silence. The securityconfig Job had completed successfully in both, and
the cluster itself was quiet. #4332 tracks it.

A patch on the image now wraps each component so a call still in flight
after a minute reports the component's own name and how long it has been
running, and keeps reporting on the same interval while it is stuck. A
pass through the components takes seconds on a healthy cluster and the
controller requeues itself every 30s, so a minute is well past anything
normal. Nothing at all is written while a component behaves, which is
why this is a watchdog rather than an entry log: logging every entry
would put nine lines per cluster into the log on every reconcile. The
finalizer path is deliberately left alone, because every
`DeleteResources` at this version returns immediately and a watchdog
there could only spawn goroutines for calls that cannot block.

The e2e lane already collects that log and nothing in it changes here.
#4279 put a `podLogs` leg on the operator's own namespace into the
opensearch catch, `namespace: cozy-opensearch-operator`, `selector:
control-plane=controller-manager`, `tail: 2000`, and this branch sits on
top of it. The other `podLogs` leg takes the cluster's own pods in the
test namespace, and cozyreport's per-pod walk keeps only pods that are
not Running or not Ready, which a stalled operator is neither, so before
#4279 these lines reached the job log only through the crust-gather
snapshot.

This is a diagnostic, not the fix. Where the reconcile stops is still
unknown, and the next occurrence should name it. The Dockerfile comment
says to drop the patch once the stall itself is understood and fixed.

The new code lives in `pkg/reconcilers`, already covered by the image's
`go test` step. Five specs hold it: the wrapped result and error pass
through untouched, a call that returns before the threshold is never
reported, a call that returns before the threshold also takes the
watchdog with it, the report names the component and a moving elapsed
while the call is in flight, and the report repeats rather than firing
once. Six mutations each fail the spec that owns them: dropping
`close(done)`, `time.NewTimer(0)`, an empty component name, a frozen
elapsed, a fire-once ticker, and a swallowed result. The full four-patch
sequence applies to a fresh v2.8.0 tree in the alphabetical order the
build relies on, and builds, vets and tests clean there, with five
`-race` runs of the new specs.

### Screenshots

Not a UI change.

### Downstream repositories

Walked the trigger map against the diff: one Dockerfile comment block
and one new patch file under
`packages/system/opensearch-operator/images/`. No values key, schema,
make target or documented workflow changes.

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

### Release note

```release-note
NONE
```


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

## Summary by CodeRabbit

- **New Features**
- Added stall monitoring for OpenSearch component reconciliation. When
reconciliation remains in progress beyond the configured threshold, the
operator logs the component name and elapsed time at regular intervals.
- Monitoring remains silent for promptly completed operations and
preserves existing results and errors.

- **Documentation**
- Clarified reconciliation watchdog behavior and documented why certain
resource deletion operations are not monitored.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-22 23:44:30 +04:00
scooby87 95b8549238 feat(dashboard): brand the token-proxy login page from the console config (#4255)
## What this PR does

Part of #4217. Dashboard branding (title, logo) is only reachable
through the authenticated dashboard/kube-api path, so the pre-auth
surfaces render unbranded. This PR fixes the first of them: the
token-proxy login page — the first screen an unauthenticated user sees
on a non-OIDC cluster — hardcoded `<title>Login</title>` and had no
branding hookup at all.

The branding config lives in the `cozy-dashboard-console-config`
ConfigMap, which the SPA reads only through the authenticated kube-api.
This mounts that same ConfigMap read-only into the token-proxy container
and renders its `titleText`, `logoText` and `logoSvg` on the login page,
falling back to the historical unbranded page when the file is absent or
unreadable so a cluster without branding is unaffected. The SVG is
encoded into an `<img>` data URI rather than inlined, which keeps any
embedded script inert. The OIDC branch is untouched: its login is served
by Keycloak, already branded through the realm login theme.

The unauthorized/access-denied screens rendered by the SPA itself (for a
logged-in user without kube-api RBAC) are handled in a separate PR.

Verified with `go test`, `go vet`, `gofmt`, and `helm unittest`
(branding mount asserted present in the non-OIDC branch and absent in
the OIDC branch).

### Downstream repositories

The diff touches only `packages/system/dashboard` (the in-repo
token-proxy image and its chart). No app is added, renamed or removed,
no `values.schema.json` / enum / default changes, no CRD or namespace
changes, and the `config.json` branding keys are unchanged. Nothing in
the trigger map applies.

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

### Release note

```release-note
feat(dashboard): the token-proxy login page now renders the deployment's branding (title and logo from `branding.titleText` / `branding.logoText` / `branding.logoSvg`) instead of the hardcoded default, so unauthenticated users on non-OIDC clusters see a branded sign-in screen.
```


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

## Summary by CodeRabbit

* **New Features**
* Added deployment branding to the login page, including a custom title,
logo, and heading.
* Branding is automatically loaded from the dashboard configuration when
available.
* Login pages continue to display a default unbranded experience when
branding configuration is unavailable or invalid.

* **Tests**
  * Added coverage for branded and unbranded login-page rendering.
* Added validation for branding volume mounts across authentication
modes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-22 22:07:32 +03:00
Aleksei Sviridkin 7d53f7af22 fix(dashboard): raise the console nginx header buffers for large OIDC tokens
The nginx config baked into the console image kept the nginx defaults for
client_header_buffer_size (1k) and large_client_header_buffers (4 8k). An
OIDC access token carrying many group claims arrives as a single Cookie
header of several kilobytes, which no longer fits into one buffer, so
nginx answered 400 "request header or cookie too large" before the
request reached the /apis, /api or /k8s/ upstream.

Raise both to 16k, at the top level of that config rather than inside the
server block: a header field read before the Host header has selected the
virtual server is measured against the default server's buffers, so the
same lines inside a server block cover that server only while it stays
the default one. Measured against the pinned nginx base image, a 12 KB
cookie gets 400 on the old config and 200 on the new one. The ceiling
moves rather than disappears: a 20 KB cookie is still rejected.

This is the console hop alone. The platform ingress-nginx controller in
front of it runs on the same defaults, so where the dashboard is published
through an Ingress a token large enough to exceed them is still rejected
at the edge; where it is published through the gateway, whose edge has no
per-header ceiling of this kind, the console was the hop returning the
400. Raising the controller is a separate change in a separate package.

The accompanying check extracts the config from the Containerfile heredoc
and fails if either directive is missing, below 16k, or no longer ahead of
the first server block: the config lives inside an image build, where no
chart template and no helm-unittest case can reach it.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-22 21:43:23 +03:00
Aleksei Sviridkin 12e64a99cd fix(rabbitmq): right-size the default resources preset to s1.nano (#3936)
## What this PR does

Raises the RabbitMQ default resource preset from `t1.nano` (128Mi
memory) to `s1.nano` (250m CPU / 512Mi memory).

A default-sized RabbitMQ 4.2 broker on Cozystack 1.6.1 was OOMKilled
with exit 137, reached 10 restarts, and never became Ready. A canary on
a larger preset reached 3/3 Ready with zero restarts; its working set
peaked at 125.8Mi. Against the 128Mi `t1.nano` ceiling that is 98% of
the limit in steady state, and cgroup accounting (working set plus page
cache) crosses it under load. The canary and its storage were removed
after validation.

### Sizing

`s1.nano` keeps the CPU of `t1.nano` (250m) and quadruples memory to
512Mi — a 4x margin over the observed 125.8Mi peak.

An earlier revision of this PR proposed `u1.nano` (1Gi). Review
correctly objected that 1Gi reserves 8x the observed working set with no
measured peak to justify it, and asked to either report that peak or
right-size the default. The peak is reported above, and the default is
right-sized to the smallest preset that clears the ceiling with a real
margin rather than to the first one that is comfortably large.

### Upgrade impact

cozystack-api applies OpenAPI schema defaults on the read path and
stores what the client sent: `Get` runs `applySpecDefaults` on its way
out (`pkg/registry/apps/application/rest.go:1232`) and the write puts
`app.Spec` into `HelmRelease.spec.values` (`rest.go:1652`). That splits
existing brokers in two.

**Brokers with no stored `resourcesPreset`** pick up the new chart
default on the next Helm reconcile. For them this upgrade is:

- a rolling restart of every replica, and
- a rise in guaranteed memory reservation from 128Mi to 512Mi per
replica, because the sanitize helper sets memory request equal to limit
— roughly 1.1Gi extra reserved per 3-replica instance.

**Brokers whose values went through a read-modify-write keep `t1.nano`
and are not resized.** `Update` opens with `r.Get` (`rest.go:489`), so a
GET-then-PUT — `kubectl edit` is the unambiguous case, and any client
that reads before writing behaves the same — freezes the schema default
of the moment into the stored values, and a stored value beats the chart
default. Those brokers are not restarted, not resized, and keep hitting
the ceiling this PR raises.

Nothing downstream can separate a deliberate `t1.nano` from one a round
trip baked in, so this is documented rather than migrated. After the
upgrade the affected brokers are the ones that still report the old
preset:

```
kubectl get rabbitmq -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,PRESET:.spec.resourcesPreset
```

The same command before the upgrade tells you nothing: the cozyrd
default is still `t1.nano` then, so the read path fills it in for both
groups. Afterwards, anything reading `t1.nano` carries a stored value;
setting `resourcesPreset: s1.nano` explicitly on the ones that should
move is the fix.

PVCs are untouched, so there is no data loss, but node headroom should
be checked before upgrading.

Also worth knowing when reading the parameter table: the preset does not
only apply to a fully omitted `resources`.
`cozy-lib.resources.defaultingSanitize` merges it key by key, so a
broker pinned to `resources: {cpu: 700m}` keeps its CPU and moves from
128Mi to 512Mi with everyone else. The field descriptions now say so,
and a test pins it.

The values, generated schema, ApplicationDefinition, typed API, and
README all carry the same default. Tests cover the new default, an
explicit legacy override, explicit resources, and a partially set
`resources` map inheriting the preset for what it leaves out.

Validation:

- `helm template` with the chart's `cozy-lib` dependency renders `limits
250m / 512Mi` and `requests 0.025 / 536870912` for the default; an
explicit `t1.nano` renders `128Mi / 134217728`; explicit `700m / 2Gi`
renders `0.07 / 2147483648`. The unit test asserts exactly these values.
- Provider counterpart: cozystack/terraform-provider-cozystack#34.

### Screenshots

Not a UI change.

### Downstream repositories

The default is restated by the Terraform provider, so the linked
provider PR updates it and documents the state-plan implication. No
other trigger-map entry matches this diff.

- [ ] 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/pull/34
- [ ]
[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:

### Release note

```release-note
fix(rabbitmq): raise the default resource preset from t1.nano to s1.nano so default-sized brokers are no longer OOMKilled. Brokers with no stored `resourcesPreset` are restarted on upgrade and their guaranteed memory reservation grows from 128Mi to 512Mi per replica; check node headroom before upgrading. Brokers whose values already pin `resourcesPreset`, including ones where a read-modify-write through the API froze the old default into them, keep their old size: list them after the upgrade with `kubectl get rabbitmq -A -o custom-columns=NAME:.metadata.name,PRESET:.spec.resourcesPreset` and set `resourcesPreset: s1.nano` explicitly on the ones that should move. The preset also fills any resource a partially set `resources` leaves out, so a broker pinned to cpu alone moves too. A tenant that opted into `resourceQuotas` and sits near its memory ceiling has the extra reservation rejected by quota admission, which shows up as a StatefulSet that never scales rather than as pods left Pending.
```
2026-09-22 21:53:02 +04:00
Alexey Artamonov 05b121809c feat(dashboard): brand the token-proxy login page from the console config
The dashboard branding (title, logo) lives in the
cozy-dashboard-console-config ConfigMap, which the SPA reaches only
through the authenticated kube-api. The token-proxy login page — the
first screen an unauthenticated user sees on a non-OIDC cluster — had no
access to it and rendered the hardcoded default title and heading,
defeating branding for customer-facing deployments.

Mount that ConfigMap read-only into the token-proxy container and render
its titleText, logoText and logoSvg on the login page, falling back to
the historical unbranded page when the file is absent or unreadable so a
cluster without branding is unaffected. logoSvg is already base64 in the
config — the SPA's Logo.tsx consumes it that way — so it is served
verbatim through an <img> data URI, never re-encoded, which keeps any
embedded script inert. The OIDC branch is untouched: its login is served
by Keycloak, already branded through the realm theme.

Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
2026-09-22 19:20:36 +03:00
scooby87 7d07bbe3ce [kafka] Migrate from ZooKeeper to KRaft mode (#2352)
## Summary

- Replace ZooKeeper-based Kafka deployments with KRaft (Kafka Raft)
metadata mode
- Existing ZooKeeper instances migrate automatically and in place via a
Helm `pre-install,pre-upgrade` hook Job that drives Strimzi's
ZK-to-KRaft migration state machine
- New instances deploy directly in KRaft mode with broker and controller
`KafkaNodePool`s
- The node pools are owned by the migration hook, not by regular chart
manifests (see "Why the pools are hook-managed")
- Kafka version is user-configurable (v3.9 default, v3.8 available)
- Strimzi operator is unchanged in this PR (stays at 0.45.1-rc1); 0.45.x
is the last line that supports ZooKeeper→KRaft migration
- ZooKeeper removed from the dashboard UI (ApplicationDefinition)

## Migration strategy

Both fresh installs and ZooKeeper→KRaft migrations are driven by a
single Helm hook Job (`templates/migration-hook.yaml`,
`pre-install,pre-upgrade`) that owns the `KafkaNodePool`s. On every
install and upgrade the Job:

1. Ensures both node pools exist (idempotent): a broker pool named
exactly `kafka` for a migrating cluster — so Strimzi adopts the existing
`<cluster>-kafka-N` brokers and their PVCs in place — or `b-<hash>` for
a fresh cluster, plus a controller pool `c-<hash>`. The controller pool
pins `strimzi.io/next-node-ids` above the broker range so the broker
pool keeps node IDs `[0..N-1]` and Strimzi cannot hand the existing
broker IDs to the fresh controllers. The shared `kafka` name is claimed
atomically (via `kubectl create`) so only one migration per namespace
can win it.
2. Inspects the Kafka CR: no CR → fresh install (pools ensured; the main
apply then creates the KRaft Kafka CR, nothing to migrate); already
`strimzi.io/kraft=enabled` or `status.kafkaMetadataState: KRaft` → done;
any other read error → fail closed. Otherwise (a ZooKeeper cluster) it
migrates.
3. Annotates `strimzi.io/node-pools=enabled` then
`strimzi.io/kraft=migration`, polls `status.kafkaMetadataState` through
`ZooKeeper → KRaftMigration → KRaftDualWriting → KRaftPostMigration →
PreKRaft → KRaft`, and only once a safe state is reached flips
`strimzi.io/kraft=enabled`. If it times out in an intermediate state it
aborts without finalising, so Helm fails the upgrade and the next
reconcile retries from where it left off.

Data is migrated in place: brokers keep their node IDs and reuse their
existing PVCs, nothing is copied. Migration is one-way — Strimzi has no
supported KRaft→ZooKeeper rollback once complete, so lowering the
`version` field or rolling the app back to a pre-KRaft chart is
unsupported (take a backup first).

### Why the pools are hook-managed

The hook must create the pools and walk the migration state machine
*before* the main release apply. A resource a hook creates cannot also
be a regular chart manifest across the ZK→KRaft boundary: Helm's main
apply finds the pool live in the cluster but absent from the previous
(ZooKeeper) release revision and aborts with `original object
KafkaNodePool ... not found`, leaving the release `failed` even though
the cluster migrated fine (reproduced under server-side apply, the
helm-controller default). Managing the pools only from the hook avoids
that, so `templates/kafkanodepools.yaml` and the deployed-version gate
ConfigMap (`templates/version.yaml`) are removed and the pools are
applied idempotently by the Job on every install and upgrade.

## Bug fixes included

- ZooKeeper `metricsConfig` referenced wrong ConfigMap key
(`kafka-metrics-config.yml` instead of `zookeeper-metrics-config.yml`)
- ZooKeeper `storageClass` used `kafka.storageClass` instead of
`zookeeper.storageClass`
- WorkloadMonitor used `.Values.replicas` instead of
`.Values.kafka.replicas`
- `validateNameLength` now caps a Kafka app name at the KRaft controller
pod-hostname budget (`<release>-c-<hash>-<id>` must fit 63 chars),
instead of admitting names that later fail the chart render forever

## What's next

A follow-up PR will upgrade Strimzi to 0.51.0 and Kafka to 4.2 once all
instances are confirmed migrated to KRaft. That PR is already prepared
on branch `KRaft-upgrade-strimzi-051`.

## Test plan

- [x] `helm template` renders correctly for new KRaft instances (no
ZooKeeper refs)
- [x] `helm template` with custom values (1 replica, external, topics,
v3.8)
- [x] Version validation rejects unsupported versions via JSON schema
- [x] helm-unittest: 86/86 across 9 suites
- [x] `hack/kafka-migration-hook.bats`: 12/12 — the real hook script
executed against a stub kubectl (resolution branches, fail-closed reads,
atomic collision guard, finalize guard)
- [x] Operator template renders with the unchanged Strimzi 0.45.1-rc1
- [x] Live migration on a disposable cluster under server-side apply:
fresh install → healthy KRaft, release `deployed`; in-place migration of
a 20000-message ZooKeeper cluster → release `deployed`, broker PVCs
adopted in place (same UIDs), and the KRaft data byte-for-byte identical
to the pre-migration ZooKeeper data (matching sha256 over every
`partition:offset:key:value`)

### Release note
```release-note
[kafka] Enable KRaft metadata mode with automatic, in-place ZooKeeper-to-KRaft migration. Kafka version is now configurable (v3.9, v3.8). The Strimzi operator is unchanged (0.45.1-rc1).
```

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

* **New Features**
* Added chart-level Kafka version selector (default v3.9) and
KRaft-aware node pool rendering with controller storage sizing.

* **Updates**
* Default Kafka appVersion updated to 3.9.0; operator and image tag
defaults aligned to 0.45.0.
* Templates now omit ZooKeeper resources and metrics when KRaft is in
use.

* **Tests**
* New Helm unit tests for Kafka CR, node pools, metrics, topics,
dashboard mappings, and workload monitors.

* **Documentation**
* Values, schema, and README updated to document new version and
controller storage options.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-22 19:19:21 +03:00
Aleksei Sviridkin ad4ea5c937 feat(keycloak): publish only the named realms on the login host (#4363)
## What this PR does

`ingress.adminHost` moves the admin console and Administration REST API
onto
their own hostname and narrows the public login route to `/realms`,
`/resources` and `/.well-known`. That `/realms` prefix publishes every
realm
the deployment has, `master` among them, so the super-admin login page
and
token endpoint stay reachable from the internet on the login hostname —
a
brute-force target the admin split was meant to remove. The Keycloak
reverse
proxy guide marks `/realms/master/` as internal-only.

The login route now enumerates the realms that are meant to be public:
the
platform realm (`authentication.oidc.realmName`, default `cozy`), which
every
component's issuer URL points at and which is therefore always
published, plus
whatever a deployment adds in the new `ingress.exposedRealms`.

Each realm is published as an exact path plus a prefix carrying the
trailing
slash. ingress-nginx renders `pathType: Prefix` as a plain nginx prefix
location rather than the element-wise match the Ingress API specifies,
so a
lone `/realms/cozy` would also serve `/realms/cozy-admin` there; the
pair
bounds the match on the segment and is equivalent to element-wise
matching on
a conformant controller and on Gateway API.

`master` is refused outright — both in `ingress.exposedRealms` and as
`authentication.oidc.realmName`, where the guard sits next to the
existing
realm-name checks so it applies whether or not a separate admin hostname
is
configured. Naming that realm puts the platform clients, the
cluster-admin
roles and every end user inside the realm that holds the Keycloak
super-admin.

This is a path boundary, not a network one. `KC_HOSTNAME_ADMIN` never
was a
security boundary, `expose-ingress-admin` defaults to the public
Gateway/ingressClass, and with `adminHost` unset the login route still
serves
`/`. Which hostnames the edge accepts and where the admin route attaches
decide the rest.

**Behavior change**, confined to deployments that already set
`ingress.adminHost`: a realm published on the login hostname beyond the
platform one now answers 404 until it is listed in
`ingress.exposedRealms`.
The `master` guard on `authentication.oidc.realmName` breaks nobody,
since
that parameter has not shipped in a release yet.

### Screenshots

Not applicable — no UI change.

### Downstream repositories

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

Walked the trigger map against the diff: it touches
`packages/system/keycloak`
and the realm-name guard in
`packages/core/platform/templates/apps.yaml`. No
app package, no `packages/core/platform/values.yaml` key the Ansible
role
sets, no platform variant or component, no `ApplicationDefinition`, no
`hack/`
layout, no telemetry metric, no vendored chart contract.

### Release note

```release-note
feat(keycloak): with `ingress.adminHost` set, the login hostname publishes only
the platform realm and any realm listed in the new `ingress.exposedRealms`,
keeping the `master` realm login page and token endpoint off the public route.
A deployment that serves additional realms on that hostname must list them.
`authentication.oidc.realmName` no longer accepts `master`.
```


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

## Summary by CodeRabbit

- **New Features**
- Added `ingress.exposedRealms` to control which additional identity
realms are reachable through the login hostname.
- Login routes now target the platform realm and configured exposed
realms with precise realm-specific paths.
  - Duplicate realm names are handled automatically.

- **Bug Fixes**
  - Prevented publishing the privileged `master` realm.
  - Added validation for invalid realm names and configurations.
- Enforced the gateway route limit, supporting up to 31 published
realms.

- **Documentation**
- Updated configuration guidance for realm exposure and security
restrictions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-22 19:47:53 +04:00
scooby87 176dd78c1a feat(dashboard): serve console branding without kube-api access (#4256)
## What this PR does

Part of #4217. The SPA fetched its branding (title, logo) only by
reading the `cozy-dashboard-console-config` ConfigMap through the
kube-api. That read already works for any signed-in user —
`console-rbac.yaml` binds `get` on it to `system:authenticated` — but it
still depends on the kube-api being reachable and on the apiserver
authenticating the session's token. A dashboard login whose token the
apiserver rejects (an OIDC session the kube-api does not accept) gets no
branding at all. (The unauthenticated login page is a separate surface,
branded in #4255.)

This mounts that ConfigMap read-only under the nginx web root and serves
it at `/branding/config.json`, and reads that static asset first in
`loadConfig`, falling back to the kube-api ConfigMap for charts that
predate the mount (their static path serves the SPA `index.html`, whose
non-JSON body trips the fallback). Branding then resolves with no
kube-api call at all, so it renders regardless of whether the apiserver
authenticates the session and without the `console-config-reader` RBAC.

Because `config.json` is now a static asset reachable by anyone past the
proxy, it is restricted to the documented white-labeling keys: the
branding map also carries Keycloak-only keys, including
`loginThemeImage`, which can point at a private registry. Keycloak reads
those from `_cluster.branding` directly. The mount uses an `items`
selector so only `config.json` is exposed under the web root.

Verified with `pnpm typecheck`, `pnpm test` (7 `loadConfig` cases),
`eslint`, and `helm unittest` (mount + `items`, the `config.json` key
the mount serves, white-label keys kept incl. `tenantText`,
Keycloak-only keys absent). Also validated live on a dev cluster:
`console-rbac.yaml` binds the ConfigMap read to `system:authenticated`
(`kubectl auth can-i get` this CM as an unbound user → yes; another CM →
no), and a throwaway pod on the real console image serving the mounted
ConfigMap returns `200 application/json` at `/branding/config.json`
while an `items`-excluded key falls through to `index.html`.

### Screenshots

No visual regression to show in a static render: this changes where the
branding config is fetched from, not how it is displayed.

### Downstream repositories

The diff touches only `packages/system/dashboard` (the in-repo console
image and its chart). No app is added, renamed or removed, no
`values.schema.json` / enum / default changes, no CRD or namespace
changes, and the branding keys the SPA reads are unchanged — only the
transport (static asset vs kube-api) and a narrowing of which keys are
served. Nothing in the trigger map applies.

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

### Release note

```release-note
feat(dashboard): the console serves its branding as a static asset (`/branding/config.json`) read with no kube-api call, so branding renders even when the apiserver does not authenticate the session and without the console-config-reader RBAC; the served file is narrowed to the documented white-labeling keys.
```
2026-09-22 18:36:47 +03:00
Aleksei Sviridkin f4e923aa82 docs(kubernetes): restate the apiServer extraArgs contract for OIDC
The extraArgs field documentation told operators to add
--requestheader-uid-headers themselves, which the chart now renders
whenever OIDC is on. Describe what it renders per version, when it
defers to an operator entry, when it merges into one, and that it still
refuses to render shapes the apiserver would not start on.

The version field says it too: choosing v1.32 is what makes the chart
render the feature gate next to extraArgs, and a reader of that field
alone would otherwise not learn that the two interact. The package's
hack/update-versions.sh writes that description itself on every make
update, so it carries the same text, or the next version bump would
drop the sentence again.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-22 18:23:48 +03:00
Akanksha Trehun 34acabae49 test(console): add coverage for enrichSchemaWithEnums
backup-utils.ts had no test file despite sibling lib files
establishing that convention. Covers the non-object passthrough,
no-match case, a top-level enum attach, a nested one, and that the
caller's path array is not mutated.

Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
2026-09-22 18:43:04 +04:00
IvanHunters a4547a6fe0 test(kube-ovn): compare image copies against upstream's Dockerfile
packages/system/kubeovn/images/kubeovn/Dockerfile is a hand-kept copy
of upstream's dist/images/Dockerfile, and `make update` rewrites only
its ARG VERSION and ARG TAG. A binary upstream starts shipping
therefore does not reach our image on its own, and nothing read the two
files together: kube-ovn-bfdd-supervisor went missing that way with the
whole suite green.

hack/check-kubeovn-image-copies.sh normalizes the COPY instructions of
both files and reports either side's surplus. It compares only the
stages built FROM kubeovn/kube-ovn-base, because our builder stage
clones and patches kube-ovn and its COPY lines have no upstream
counterpart, and it treats an empty result as a broken check rather
than agreement.

`make update` now runs it against the tag it pulls, so the next bump
stops on a mismatch, and hack/check-kubeovn-image-copies.bats runs it
on every CI run against a verbatim copy of upstream's Dockerfile at the
vendored appVersion.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-22 17:10:05 +03:00
IvanHunters b59510abe6 fix(kube-ovn): ship kube-ovn-bfdd-supervisor in the image
v1.15.26 adds cmd/bfdd_supervisor and builds it as
dist/images/kube-ovn-bfdd-supervisor (makefiles/build.mk:33), and
upstream's dist/images/Dockerfile:12 copies it into /kube-ovn. Ours,
which the comment above its COPY block names as a copy of that file,
stopped at kube-ovn-controller.

pkg/controller/vpc_egress_gateway.go:47 hardcodes
/kube-ovn/kube-ovn-bfdd-supervisor. A VpcEgressGateway with spec.bfd
gets a bfdd container that takes the binary as its command (:1014) and
probes it for liveness (:1107), from the kube-ovn image itself, so
without the COPY that container cannot exec. The
vpc-egress-gateways.kubeovn.io CRD ships from this chart, so the path
is reachable.

v1.15.10 has neither the binary nor the container, so this arrives with
the bump rather than predating it.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-22 17:09:56 +03:00
Yan Bondarenko 6d5666f7e6 fix(rabbitmq): describe the preset as filling what resources leaves unset
cozy-lib merges the preset under resources key by key, so a partially set
resources map still takes the preset for everything it omits: with
resources.cpu=700m alone the broker renders 700m of CPU against the
preset's 512Mi of memory, and this upgrade moves that broker from 128Mi to
512Mi as well. The description said the preset applies when resources is
omitted, and cozyvalues-gen copies it verbatim into values.schema.json, the
README parameter table and the cozyrd openAPISchema the dashboard renders,
so one sentence made the claim on three surfaces.

The suite covered a fully omitted resources map and one that sets both cpu
and memory, which is the one shape that does not exercise the merge. The
new case pins it: reverting defaultingSanitize to replace the preset
instead of merging over it turns that case red and leaves the other three
green.

Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
2026-09-22 17:47:55 +04:00
Yan Bondarenko cf749988a4 fix(rabbitmq): right-size the default resources preset to s1.nano
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
Assisted-by: LLM
2026-09-22 17:47:55 +04:00
IvanHunters 6a34c9f037 fix(opensearch-operator): name the component reconciler a stall sits in
The cluster controller runs nine component reconcilers in sequence and none
of them logs unconditionally when it is entered: the TLS one's only line
above its work sits on the no-security early return, which the chart in this
repository never renders, and the rolling restart one opens at V(1), off at
the verbosity the operator ships with. So a call that stops returning leaves
nothing behind at all. The operator log ends on whatever ran before it, the
object is silently no longer reconciled, and from the outside that is
indistinguishable from an operator with nothing to do. Two e2e runs ended
exactly that way, the operator going quiet at the moment the chart rewrote
the CR and never coming back: https://github.com/cozystack/cozystack/issues/4332.

Each component is now wrapped so a call still in flight after a minute
reports its own name and how long it has been running, and keeps reporting on
that interval while it is stuck. A single line dated at the start of a stall
does not answer the question a reader has five minutes in, which is whether
the call is still there. Nothing is written while a component behaves, so a
healthy cluster costs no extra lines.

The finalizer path is left alone: every DeleteResources at this version
returns immediately, so a watchdog there could only spawn goroutines for
calls that cannot block.

A diagnostic rather than a fix: drop it once the stall itself is understood.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-22 16:07:36 +03:00
IvanHunters a8c4119050 fix(multus): move kube-ovn CNI plugins marker to v1.15.26
The cni-plugins-staging-contract test pins the kube-ovn release whose
CNI_PLUGINS_VERSION was last checked against multus's, and bumping
kube-ovn to v1.15.26 trips it while the marker still reads v1.15.10.

kube-ovn v1.15.26's base image (dist/images/Dockerfile.base) still uses
CNI_PLUGINS_VERSION=v1.9.1, identical to multus, so portmap and macvlan
stay in lockstep across the two daemonsets. Only the marker moves; the
plugins pin and per-arch checksums are unchanged.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-22 13:08:39 +03:00
IvanHunters 75eebb5f3c feat(kube-ovn): bump kube-ovn to v1.15.26
Update kube-ovn from v1.15.10 to v1.15.26.

v1.15.26 removes the checkDBClusterIntegrity check from the OVN leader
checker (pkg/ovn_leader_checker/ovn.go). In v1.15.10 that check called
os.Remove on a healthy local raft DB whenever a leader observed fewer
members than expected (ovn.go:367). That count drops below the target
transiently during cluster growth, a rolling restart, or recovery after
a node address change, so the check could delete a valid DB and leave
ovn-central unable to elect a leader. The function is gone in v1.15.26,
so the DB is no longer deleted.

The chart is re-vendored with `make update`, which re-pulls
charts/kube-ovn from the v1.15.26 tag, re-applies patches/mtu.diff, and
regenerates the image build args. This brings the full v1.15.26 chart:
the reworked master-node affinity helpers, the widened kube-ovn CRD
schema (bandwidth ingress/egress become int-or-string, u2oFeatures
added), and the new OVN_CENTRAL_MODE (cluster/single) support with its
central-svc, central-pvc and central-hcp-rbac templates. OVN_CENTRAL_MODE
defaults to cluster (raft on hostPath), so an in-place upgrade keeps the
existing topology.

Two vendored patches are dropped as now upstream in v1.15.26:
fix-keepvmip-portgroup.diff (hasAliveSiblingVMPod, pod.go:2437) and
fix-vmim-scheduling-retry.diff (scheduling requeue, kubevirt.go:195).
fix-vmim-target-pod-retry.diff is kept: v1.15.26 still returns nil at
kubevirt.go:215.

The image ref stays digest-pinned (repository + tag@sha256), which the
promote-retag release contract requires for a cozystack-built image. The
digest is carried over from v1.15.10 as a placeholder and is refreshed to
the real v1.15.26 image by the release-candidate digest-vendoring step;
no PR or main job rebuilds it.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-22 13:08:39 +03:00
Aleksei Sviridkin b18281ef0c feat(dashboard): serial console for virtual machines, and paste into the VNC console (#4356)
## What this PR does

Adds a serial console tab to the VM detail page, and makes the VNC
console accept a paste.

Moving text into a VM was the starting point, and the two consoles
answer it very differently. The VNC console carries pixels and key
events and nothing else, so a paste there has to be typed, one emulated
key press per character. The serial console carries text, so a paste is
a single write and the guest's output is real text the user can select
and copy.

Measured on a running VM, 1000 characters, checked by piping the pasted
string through `md5sum` in the guest and comparing with the digest
computed locally:

| | time | integrity |
| --- | --- | --- |
| serial console | **0.87 s** | digest matched |
| VNC, 25 ms per key event | 56.6 s | digest matched |
| VNC, no pacing | 10.3 s | **characters dropped and reordered** |

The VNC rows were taken by driving the typing loop directly rather than
through a real keypress, so they measure the typing and not the
shortcut. The pacing is the measured floor either way: with none, the
guest loses and reorders characters.

### Serial console

New tab backed by KubeVirt's `virtualmachineinstances/console`
subresource and xterm.js. A VM's tabs now lead with its two consoles —
serial first, labelled Console, with VNC beside it — because reaching a
console is why people open a VM. VNC keeps its place: the serial port
does not reach a desktop session, a bootloader, or a Windows guest, and
Windows guests are supported here, down to their own scheduling in the
VM charts.

Copy stays on the terminal's own chord, Ctrl+Shift+C or Cmd+C, so a
plain Ctrl+C still interrupts the foreground process. Paste needed one
thing handled, and only off a Mac: xterm turns Ctrl with a letter into a
control byte and cancels the keydown, so Ctrl+V never reached the
browser's paste and the guest received SYN (0x16) instead. Reproduced on
a real terminal, where the shortcut put a single `0x16` on the wire and
nothing else. The key handler now returns that chord to the browser, at
the cost of the terminal's quoted-insert. On a Mac the browser pastes on
Cmd+V, so there the terminal keeps the key.

One detail worth knowing before touching this code: virt-api negotiates
the `plain.kubevirt.io` subprotocol and reads **binary frames only**. A
text frame is accepted by the socket and then silently dropped, which is
indistinguishable from a dead console. That is why the stream is a small
module of its own with its own tests, rather than xterm's stock attach
addon, which sends text.

### Paste in the VNC console

The graphical console still matters where the serial port cannot reach —
a desktop session, a bootloader, Windows — so a paste works there too,
typed key by key.

**The shortcut is the platform's own: Cmd+V on macOS, Ctrl+V everywhere
else.** That means Ctrl+V no longer reaches the guest on Linux and
Windows, where it is visual block in vim or the guest's own clipboard.
Taking both chords bought nothing, because no browser pastes on Ctrl+V
on a Mac, and cost the guest a key it has its own use for.

Nothing is added to the interface: the toolbar's existing status line
reports `Pasting 12/270` while the text goes in, then returns to the
connection state.

Four constraints shaped the rest, each found by running it rather than
by reading:

- `navigator.clipboard.readText()` puts a permission prompt in front of
**every** paste. Instead the shortcut moves the focus to a hidden field
and lets the browser paste into it, which costs nothing and asks
nothing.
- noVNC calls `preventDefault()` on keydown. Letting the shortcut reach
it would cancel the browser's paste outright, so the shortcut is taken
on the capture phase and only its propagation is stopped. If no paste
follows, the focus returns to the console instead of being parked in an
invisible box.
- The paste starts while the user is still holding the chord, and noVNC
told the guest that modifier is down the moment it was pressed. Typing
into that state sends chords rather than characters — under Ctrl an `m`
is Return — so the host's modifiers are released before the first
character. On Windows noVNC sits on the first Ctrl for 100 ms and
delivers it on a timer, after that release has already happened, so the
release is sent once more when the pacing has covered that window.
- A character the keymap cannot produce changes what the rest means, and
the newline after it still submits: `rm -rf /srv/данные` would become
`rm -rf /srv`. Nothing is sent unless the whole paste can be typed, and
the toolbar says how many characters were in the way.

The keymap covers US only. A guest in another layout is the case the
serial console answers, where text travels as bytes and no layout is
involved.

### Screenshots

The serial console on a running VM: the tabs lead with it, the terminal
is live, and the middle line was pasted from the browser clipboard.

<img width="2252" height="1606" alt="cozystack-serial-console"
src="https://github.com/user-attachments/assets/6fac5f95-c142-405b-9b54-8ed040d65167"
/>

### Downstream repositories

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

<!-- The diff touches only packages/system/dashboard/images/console.
Walked the trigger map in
docs/agents/contributing.md file by file: no entry matches a
console-only change, and the map
states outright that UI changes belong in this repository, in the same
PR. -->

### Notes for the reviewer

- New dependencies: `@xterm/xterm` and `@xterm/addon-fit`. The tab is
split at the route with `React.lazy`, the way the YAML editor already
is, so both land in a 347 KB chunk fetched when a console is opened.
Built both revisions with the same `node_modules`: the entry chunk every
dashboard page loads goes 935.91 KB → 896.39 KB, so it ends up smaller
than before this branch.
- The serial console needs a getty on `ttyS0` in the guest. Cloud images
enable it by default; a Windows guest or a graphical desktop is the VNC
console's job.
- The serial console opens with the user's own identity — nginx forwards
the session's `Authorization` untouched — and
`virtualmachineinstances/console` is already granted next to `/vnc` in
`cozy:tenant:use:base`, so no RBAC change is owed.
- Verified against a live VM on a dev cluster: connection, typing, a
1000-character paste round-tripped through `md5sum` on the serial
console, text typed before the serial socket opens (held and flushed), a
real Ctrl+V on the VNC console arriving intact, and two pastes in quick
succession (the second is refused rather than interleaved).
- The Windows modifier path is read from the pinned noVNC in
`node_modules`, not run: there is no Windows host here. The test fake
models that delivery, so the behaviour is at least held by a test.
- There is no cancel affordance for a paste in progress. It stops on its
own when the session drops or the tab is left, and the toolbar then says
how far it got; Reconnect is the manual way out. A length cap is worth
adding separately — at 25 ms per character a large clipboard types for a
long time.
- 418 tests pass; build and typecheck are clean. `eslint .` reports 54
pre-existing problems across twenty files, none of them in the files
this PR touches.

### Release note

```release-note
feat(dashboard): virtual machines gain a serial console tab, where pasting is instant and the output can be selected and copied. The VNC console now pastes the host clipboard on the platform's own shortcut — Cmd+V on macOS, Ctrl+V elsewhere — typing it into the guest on a US keyboard layout; Ctrl+V no longer reaches the guest on Linux and Windows.
```


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

- **New Features**
- Added a serial console for running virtual machines, including
terminal input, output, resizing, reconnection, and connection status.
- Added clipboard paste support to the VNC console with keyboard-layout
handling, progress feedback, and unsupported-character reporting.
  - Added platform-aware paste shortcuts for macOS and Windows/Linux.

- **Improvements**
  - Console content now loads on demand with a loading indicator.
  - Added handling for stopped and unsupported virtual machine states.

- **Documentation**
  - Documented keyboard, clipboard, and console testing behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-22 12:39:03 +04:00
Kirill Ilin 938595afe3 fix(keycloak): validate the realm list wherever it is set
The list was read only inside the adminHost branch, so a value the chart
would refuse — master, a scalar, a name that splits the path — sat in the
values unnoticed until someone turned the admin hostname on, and the refusal
then landed on the change of authentication topology rather than on the edit
that caused it. Build the list on every render and let the branches use the
result.

Assisted-By: LLM
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
2026-09-22 10:54:28 +05:00
Kirill Ilin 13a4029b8b fix(keycloak): count the realms the route budget rejects
The over-budget message derived the realm count from the path list, which
also carries the two static paths, so it named one realm more than the
deployment has — the one number an operator acts on. Keep the realm list in
its own template and count it there, and derive the budget from the static
paths rather than restating 31.

The shape guard also let a falsy scalar through, so `exposedRealms: false`
reached range and failed with a Go template error instead of the message that
says what to write.

Assisted-By: LLM
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
2026-09-22 10:44:08 +05:00
Kirill Ilin 714ced9bab fix(keycloak): refuse more realms than a route rule can match
A Gateway API route rule takes 64 path matches and each published realm takes
two of them, so past 31 realms the apiserver rejects the whole HTTPRoute and
the login hostname stops answering. Fail while rendering, naming the
parameter to shorten, instead of leaving the limit in a comment. The Ingress
path has no such cap, so the check lives with the route.

Assisted-By: LLM
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
2026-09-22 10:35:37 +05:00
Kirill Ilin e87232b822 fix(keycloak): always publish the platform realm and never master
exposedRealms replaced the published realm instead of adding to it, so a
deployment naming only its back-office realm took its own login off the
public route: every component's issuer URL points at the platform realm, and
they would all have met a 404. Publish the platform realm unconditionally and
deduplicate, which is also what the parameter's description promised.

Refuse master in either position rather than warning about it in a comment —
publishing it is exactly what the realm enumeration exists to prevent.

Assisted-By: LLM
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
2026-09-22 10:24:58 +05:00
IvanHunters 0b8296d689 fix(dashboard): release the held modifier before the first character, not after some
The window this had been measuring started before the paste did. noVNC
arms its timer on the keydown, and the modifier is delivered once — by
that timer or by the next keyup, whichever comes first, and the V keyup
is not intercepted. Both land within 100 ms of the keydown, which at the
default pace is somewhere inside the opening releases.

Counting from the end of those releases therefore started the clock
again and let three characters through while the guest still held Ctrl,
where an m is Return. The second release now waits out whatever is left
of the window, measured from the keydown itself, and happens before any
character goes in.

The test that was written for this pinned the wrong placement: it handed
the modifier over after the first character, later than noVNC can, and
the fake's method was the immediate one under a second name. The fake
now delivers on its own schedule, partway through the opening releases,
so a test cannot choose the moment.

The component's own typing pace had no test at all once every existing
one passed its own value, so setting the default to zero left the suite
green. One test renders without the prop and holds it.

The lifecycle tests key on characters typed rather than on a count of
sleeps, which is what let them drift past their code when the opening
releases changed shape.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-22 08:21:56 +03:00
Kirill Ilin 64229b154e fix(keycloak): bound each published realm path to a path segment
ingress-nginx renders `pathType: Prefix` as a plain nginx prefix location
instead of the element-wise match the Ingress API specifies, so a lone
/realms/cozy also served /realms/cozy-admin — a realm the chart claims is
unpublished. Publish each realm as an exact path plus a trailing-slash
prefix, which bounds the match on every controller and on Gateway API.

While here, reject a scalar in place of the realm list instead of failing
inside range, and point a malformed platform realm name at the parameter
that carries it rather than at exposedRealms.

Assisted-By: LLM
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
2026-09-22 10:17:00 +05:00
Kirill Ilin 5149e67dd7 feat(keycloak): publish only the named realms on the login host
The narrowed login route carried a bare /realms prefix, so it also published
realm master: its token endpoint accepted super-admin credentials from the
internet. Enumerate the published realms instead — the platform realm by
default, ingress.exposedRealms when a deployment serves more than one.

Behavior changes only where ingress.adminHost is already set.

Assisted-By: LLM
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
2026-09-22 10:08:07 +05:00
IvanHunters 92b8df076c fix(dashboard): a paste could still type chords on a Windows host
Windows is the platform where noVNC holds the modifier back: the first
Ctrl keydown tells the guest nothing, arms AltGr detection and starts a
100 ms timer, and Ctrl reaches the guest when that timer fires. Taking
the shortcut on the capture phase hides the V from noVNC, so the timer
is what delivers — after the paste released a modifier the guest had not
yet been told about. Everything typed between the two goes in as chords.

The release is now sent a second time, once the pacing has covered that
window. It happens once rather than per character, and it leaves Shift
alone, because that one is held deliberately for capitals.

Two tests had drifted past the code they are named for. Both dropped the
session on the first sleep, which since the prelude lands before
anything is pressed, so they held whatever the typing loop did: removing
the session check from the loop left them green. They drop it after a
character now, and a third covers the closing release, which no test
reached at all.

The fake learns the Windows path it could not express, and decodes
function keysyms: Enter is 0xff0d, and treating it as a Unicode offset
produced a negative code point, so the first test to paste a newline
would have thrown instead of failing an assertion.

The typing pace is injectable, so tests no longer run at the speed of a
real keyboard and stop crowding their neighbours out on timeouts.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 23:48:25 +03:00
IvanHunters 6209a0b8d3 refactor(dashboard): code-split the serial console at the route
The tab pulled xterm through a dynamic import inside its own effect,
which split the chunk but left the stylesheet on a fragile path: the dev
server failed to fetch it once after a dependency rebuild, and the tab
came up with the terminal missing.

Splitting at the route instead is what the YAML editor next door already
does. The imports go back to plain ones, React.lazy gives the tab its
own chunk, and the stylesheet travels with it rather than through an
import() of a CSS file.

The entry chunk every dashboard page loads ends up smaller than before
this branch: 935.91 KB at the merge base, 895.99 KB here, with the tab
and xterm in a 347 KB chunk fetched when a console is opened.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 23:09:44 +03:00
IvanHunters 4a10497d3d fix(dashboard): a VNC paste typed chords, and could run a command nobody pasted
Three defects on the same surface, all of them where this code meets
noVNC, the platform and the guest — and all of them invisible to every
test here, because the fake had no keyboard.

A paste began while the user was still holding the chord. noVNC tells
the guest a modifier is down the moment it is pressed and releases it
only on keyup, so the pasted text arrived as chords: under Ctrl an m is
Return, and on macOS, where noVNC maps Cmd to Alt, the same under Alt.
The host's modifiers are now released before the first character.

A character the keymap cannot produce was dropped and the rest was typed
anyway, newline included, with the notice arriving after the line had
run: rm -rf /srv/данные became rm -rf /srv. Nothing is sent now unless
the whole paste can be typed.

The shortcut was taken on every platform, so the guest lost a key it has
its own use for — visual block in vim, its own clipboard on Windows —
and on macOS gained nothing, because no browser pastes on Ctrl+V there.
Each platform's own chord only.

The fake now models the guest's keyboard: which modifiers it believes
are down, and what it received with chords marked. That is what makes
the first defect expressible as a test rather than something only a
person at a keyboard could notice.

Also pins three behaviours the suite was not holding: a frame arriving
after cleanup, a real close reason behind a synthetic 1006, and the
25 ms pacing the description calls measured.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 22:45:15 +03:00
IvanHunters d113d02e03 feat(dashboard): lead a VM's tabs with its consoles, serial first
Reaching a console is why people open a virtual machine, so the two
consoles now sit directly after Overview instead of below the resource
tabs. Serial leads and is labelled Console: text goes in and out of it
directly, at a speed the emulated-keyboard path cannot reach.

VNC keeps its place beside it, because the serial port does not reach a
desktop session, a bootloader, or a Windows guest — and Windows guests
are a supported case here, with their own scheduling in the VM charts.

The order is pinned by a test: it was ordinary prose in a push() call
before, so the next edit to this list could reorder it in silence.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 22:45:15 +03:00
IvanHunters 25cd86c560 fix(dashboard): Ctrl+V pasted nothing in the serial console
xterm turns Ctrl with a letter into a control byte and cancels the
keydown, so on Windows and Linux Ctrl+V never reached the browser's
paste and the guest received SYN (0x16) instead. Cmd+V and Shift+Insert
were unaffected, which is why testing on a Mac missed it: reproduced on
a real terminal, where the shortcut put a single 0x16 byte on the wire
and nothing else.

The key handler now returns the event to the browser, at the cost of the
terminal's quoted-insert on that chord — the same trade the VNC console
already makes for the same shortcut. The test stub keeps the handler now
instead of dropping it, so the chord is reachable from a test at all.

Three smaller repairs in the same paths:

A frame arriving after cleanup was written into a disposed terminal,
because the message handler never consulted the stream's own state.

onerror synthesised a 1006 and the real onclose behind it was swallowed
by the already-closed latch, so a close carrying 1008 Forbidden reached
the user as connection error. The error is recorded and the close
reports what the server actually said.

navigator.clipboard is SecureContext-only and absent over plain http,
which the console's own URL builder supports; copying threw there
instead of falling back to the selection the user can copy by hand.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 22:45:15 +03:00
IvanHunters 58d0c90e0b test(dashboard): pin the console behaviours nothing was holding
Three behaviours the code promises had no test: the refusal of a second
paste while one is still typing, the focus-restore timer, and the serial
console's copy chord. The chord was untestable by construction — the
Terminal stub accepted the handler and dropped it, so nothing could ever
call it. The stub keeps it now.

Each test was checked by reverting the behaviour it covers and watching
that one test, and only that one, go red.

The VNC paste also acts on how typeKeystrokes ended instead of
discarding it. A paste cut short by a dropped session used to leave the
toolbar reading as though the text had all arrived.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 22:45:15 +03:00
IvanHunters 71bdad69ae fix(dashboard): console input state across a session's lifetime
Five repairs, all on state that outlives a single interaction.

The serial stream marked itself writable before the socket opened, so a
keystroke typed while the pill still said Connecting reached
WebSocket.send() during CONNECTING, which throws. Input is now held and
flushed on open, and discarded if the socket closes first.

A paste in the VNC console outlived the tab. The effect cleanup dropped
the RFB reference but not the sender, and noVNC's disconnect event
arrives too late to clear it, so the typing loop kept running against a
dead session. Cleanup now aborts the paste and clears the sender.

Clipboard blocked had a renderer and no producer: the state survived the
move from the panel to the shortcut, while the only thing that used to
set it did not. The sink timeout sets it now, which is the case the
message was written for — an empty or refused clipboard raises no paste
event at all.

The shortcut matched the physical KeyV position only, so on Dvorak
Ctrl+V reached noVNC instead and was cancelled there.

A clean server-side close left the status pill on amber Connecting,
because the tab tracked a boolean where it needed three states.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 22:45:15 +03:00
IvanHunters 3d026ff611 refactor(dashboard): keep only the US keymap for VNC paste
The layout was never selectable — the tab picks one and nothing offers
the others — so the German, French and Russian tables, and the AltGr
handling that only they needed, were data and code with no reader.

What remains states its assumption plainly: US, the layout a default
cloud image boots with. A guest in another layout is the case the serial
console answers, where text travels as bytes and no layout is involved.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 22:45:15 +03:00
IvanHunters 2f6ec92a20 feat(dashboard): paste into the VNC console with Ctrl+V
The graphical console still matters for guests the serial port cannot
reach — a desktop session, a bootloader, Windows. There a paste has to
be typed, so this maps the clipboard text to key presses for the layout
the guest has active and paces them: without the pacing the guest drops
and reorders characters, which was measured rather than assumed.

The shortcut is taken before noVNC sees it. noVNC calls preventDefault()
on keydown, which would cancel the browser's own paste and hand the
guest a Ctrl+V it cannot use; instead the focus moves to a hidden field
and the browser pastes into it. Reading the clipboard through
navigator.clipboard would have put a permission prompt in front of every
paste. The focus returns to the console even when no paste follows.

Nothing is added to the interface: the toolbar's existing status line
reports progress while the text is typed.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 22:45:15 +03:00
IvanHunters 27d7b0ee03 feat(dashboard): serial console tab for virtual machines
The VNC console carries pixels and key events, so moving text through it
means emulating a keypress per character: measured at 57 seconds for a
1000-character paste, and the text corrupts if the pacing is dropped.

KubeVirt also exposes the guest's serial port as a websocket, and that
one carries text. The same 1000 characters land in under a second, the
guest's output is real text the user can select and copy, and tabs,
newlines and non-Latin characters travel as bytes instead of depending
on the keyboard layout the guest happens to have active.

virt-api negotiates the plain.kubevirt.io subprotocol and reads binary
frames only — a text frame is accepted by the socket and then dropped,
which is indistinguishable from a dead console, so the stream is kept
deliberately narrow and tested on its own.

Copy stays on the terminal's own chord (Ctrl+Shift+C, or Cmd+C) so a
plain Ctrl+C still interrupts the foreground process.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 22:45:15 +03:00
IvanHunters aa20495df3 feat(marketplace): register a tapped repository's apps on connect
Connecting a marketplace repository materialized its PackageSource but created no Package, so its ApplicationDefinitions never rendered and its apps never appeared in the dashboard catalog until a manual `cozypkg add` the dashboard cannot drive (the package list is computed from the ApplicationDefinitions, which do not exist yet).

The tap materializer now creates a tap-managed registration Package for each materialized PackageSource, the way the platform ships a Package per built-in app, so the ApplicationDefinition registrations deploy on connect and the apps become browsable; the app components carry no install block and are still instantiated per user resource.

Privileged install components of an unconfirmed tap auto-registration (a Package that still carries the marketplace-tap label) are refused on several best-effort layers: the Package reconciler skips their HelmRelease and prunes a lingering one at the install site, and the PackageSource reconciler withholds their ExternalArtifact so the helm-controller has no privileged content to deploy, re-running on confirmation via a Package watch. `cozypkg add --allow-privileged` sheds the label as an explicit ownership handover, which is the confirmation; a platform Package never carries the label. A benign component flipped to privileged in a new revision can still be materialized by source-watcher before these layers observe the flip; closing that race fully requires decoupling the catalog registration from install and is tracked in issue #4359.

`cozypkg untap` and the dashboard disconnect remove the registration Package (de-registering the apps) under a UID + ResourceVersion precondition, so a concurrent `cozypkg add` handover is never clobbered; running instances are left but unmanaged. `cozypkg add` re-opens a tap auto-registration for variant selection and hands it over. The cozystack-api ClusterRole gains delete on packages for the disconnect path.

Assisted-by: LLM
Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
2026-09-21 21:57:04 +03:00
Alexey Artamonov 949096694b fix(platform): reject non-string realm names and shell-quote the hook realm
A realmName that YAML resolves to an int or a bool (a bare 123, or a
reserved word like on/off) was coerced with toString, silently renaming
the realm to something the operator never typed (on -> "true"). Fail the
render with a quoting hint at the source instead of surfacing it later as
a broken issuer URL.

The update-email hook Job interpolated the realm into its shell script
unquoted, so a name carrying a space or a shell metacharacter could break
or inject into the script; single-quote it. The Grafana and managed-cluster
issuer helpers build the URL with printf %s straight off the channel value,
so guard them with toString for the same non-string reason.

Name the configured realm in the tenant kube-apiserver oidc.mode
description and the Grafana identity-mode comment, which still read cozy as
if it were fixed.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
2026-09-21 12:15:10 +03:00