Commit Graph
7777 Commits
Author SHA1 Message Date
Aleksei Sviridkin 25e88dfe23 fix(mariadb): narrow the server certificate to server authentication
The leaf carried client auth alongside server auth. MariaDB treats
server and client certificates as separate roles, and a user declared
REQUIRE X509 accepts any client certificate signed by a trusted CA, so
a server key that also bears client auth can authenticate as that user.
The operator issues its own server certificates with server auth alone
and keeps client auth on the client certificates it manages separately;
match that split.

Drop key encipherment at the same time. It covers RSA key transport and
is inapplicable to the P-256 key this chart issues, where the usage that
matters is digital signature for the ECDHE signature.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-03 01:38:34 +03:00
Aleksei Sviridkin 3d2dd4271a fix(mariadb): align TLS wiring with the operator's own TLS surface
Two things the chart got wrong about how mariadb-operator handles TLS.

The operator only reconciles on changes to the Secrets behind
serverCASecretRef and serverCertSecretRef when those Secrets carry its
watch label; the watches are predicate-gated on it. Neither Secret had
the label, and cert-manager owns them rather than the MariaDB resource,
so ownership does not trigger a reconcile either. The leaf rotates its
private key on every renewal, so a renewal would land in the Secret and
the running pods would keep serving the superseded certificate until
the next full resync. Label both Secrets.

The operator also reconciles a trust bundle of its own, named
<release>-ca-bundle, whenever TLS is enabled. It contains only ca.crt,
never a private key, and it spans a CA rollover. That is exactly the
trust anchor the tenant needs, and it already exists in the namespace,
so grant it to the tenant instead of stating that no CA is available.
The previous wording told operators to skip verification or to turn
enforcement off, which weakened security to work around a problem that
was not real.

Point the backup job at the bundle too. It was projecting ca.crt out of
the leaf Secret, which only ever holds the CA that signed the current
certificate and needlessly couples backups to leaf rotation.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-03 01:38:33 +03:00
Aleksei Sviridkin b7bde37832 docs(mariadb): document TLS connections and the migration path
Enabling TLS sets require_secure_transport=ON, and external instances
get that automatically, so every plaintext client stops connecting the
moment the change lands. Nothing user-facing said so, and the recovery
HowTo still gave commands that fail against a TLS-enforcing server.

Describe how to connect with verification, note that the verification
flags are MariaDB spellings rather than the MySQL ones, state that CA
distribution to the tenant is not available yet, and give the staged
migration using tls.required: false for instances that already have
clients.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-03 01:38:33 +03:00
Aleksei Sviridkin 73ac690f1d fix(mariadb): close SAN gap and guard the external hostname lookup
The headless wildcard was listed at three resolution depths while every
named service was listed at four. A client resolving the missing
3-label form presents that name during the handshake, and a SAN gap
fails verification, so the wildcard now covers the same depths as the
rest of the list.

The external hostname was also read straight off _namespace, which
raises a raw nil pointer error naming neither the value nor the reason
when the key is absent. Route it through required, and tolerate an
absent or null _namespace so the explanatory message is what surfaces
rather than an index error.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-03 01:38:32 +03:00
Aleksei Sviridkin 6e51e31510 chore(mariadb): drop duplicate test targets from the package Makefile
The target was defined three times, so make emitted an override warning
on every invocation and the last definition silently won. All three
recipes were identical, so collapsing them to the one declared .PHONY
changes no behaviour.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-03 01:38:32 +03:00
Aleksei Sviridkin b43f00d2bb feat(mariadb): publish a key-free CA projection to the tenant
The tenant needs the CA certificate to verify TLS connections, but the
cert-manager Secrets that back the chain are key-bearing: <name>-ca-tls
holds the CA private key and <name>-tls holds the server private key.
The dashboard Role granted the tenant read access to both whenever TLS
was on, which handed out signing material where only a trust anchor was
required.

Drop both from the tenant grant and mark the CA Secret as the source of
a key-free projection instead. The chart owns the cert-manager chain
here, so it labels the CA Secret directly, inside the existing TLS gate:
with TLS disabled the chain is not rendered and nothing is marked. Only
the CA carries the labels, never the leaf.

The selector added to the ApplicationDefinition is deliberately specific.
An empty selector would compile to a match-everything label selector and
project every Secret in the namespace to the tenant.

The source Secret and the projection are matched by two different
labels on purpose: the source stays key-bearing and internal, while the
published copy is key-free. Selecting the source directly from the
consumer would defeat the split and leak the CA private key.

Note that the labels and the selector are inert until the controller
that produces the projection exists: nothing reads the labels yet, and
the selector matches no Secret.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-03 01:38:32 +03:00
Aleksei Sviridkin bafaca0991 fix(mariadb): use MariaDB TLS verification flags in backup script
The backup image is alpine plus mariadb-client, so the backup script is
parsed by the MariaDB client. That client implements no ssl-mode option:
it is MySQL 8 syntax, and the MariaDB client rejects it while parsing
arguments ("unknown variable", exit 7) before it ever opens a
connection. Every TLS-enabled backup run therefore failed at the first
client invocation.

Replace it with the MariaDB equivalent, --ssl-ca combined with
--ssl-verify-server-cert, which validates the chain against the CA and
checks the server hostname against the certificate SANs.

Also align the cluster-domain fallback in the certificate template with
the rest of the catalog, which defaults to cozy.local rather than the
upstream Kubernetes cluster.local. These names go into the leaf
certificate SAN list that the backup client now verifies against, so a
mismatched fallback would produce certificates that fail hostname
verification.

The previous assertions only checked that an SSL string appeared in the
rendered script, so they stayed green against a script the client
refuses to parse. They now pin the client dialect instead: the MariaDB
verification flags must be present, the MySQL-only option must never be
emitted in any TLS state, and both client invocations must carry the
options.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-03 01:38:31 +03:00
Arsolitt e4280292fc refactor(mariadb): drop null from tls.enabled schema, use kindIs invalid pattern
The tls.enabled field was previously patched in the Makefile via jq to
emit "type": ["boolean","null"], which breaks cozystack-api's
apiextv1.JSONSchemaProps.Type (single string field) and silently
disables server-side defaulting.

cozyvalues-gen correctly emits "type": "boolean" from the @param {*bool}
annotation. The jq patch and its precondition/postcondition checks are
no longer needed and are removed from the Makefile.

The tri-state behavior (unset tls.enabled inherits external) is
preserved through the kindIs "invalid" check in the _tls.tpl helper,
which catches the unset case. Explicitly passing null is rejected by
schema validation, which is the correct behavior for a boolean field.

Assisted-by: LLM
Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:31 +03:00
Arsolitt ec9f9863be feat(mariadb): support TLS in backup CronJob via --ssl-mode=VERIFY_IDENTITY
When mariadb-operator sets require_secure_transport=ON (tls.required:
true), the server rejects plaintext TCP connections. The backup CronJob
used plain mysql and mysqldump commands with no SSL flags, causing all
backups to fail silently.

The leaf certificate SAN list already covers the primary and secondary
service names that the backup uses via MYSQL_HOST, so
--ssl-mode=VERIFY_IDENTITY (strictest mode with hostname validation)
is correct here.

The fix conditionally adds:
- SSL_OPTS variable in the backup script with --ssl-ca and --ssl-mode
- A tls-ca volume mounting ca.crt from the leaf TLS Secret
- A corresponding volumeMount at /etc/mysql-ssl in the backup container

The TLS path is activated through the same mariadb.tls.enabled helper
used elsewhere in the chart, so it follows the external inheritance
tri-state correctly.

Assisted-by: LLM
Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:30 +03:00
Arsolitt 83852538e3 refactor(mariadb): switch CA and leaf private keys to ECDSA P-256
ECDSA P-256 keys offer equivalent or better security than RSA-4096 with
significantly smaller key material and faster handshake operations. Both
CA and leaf certificates are updated; existing rotation policies are
preserved (Never for CA, Always for leaf).

Note: cert-manager will re-issue both CA and leaf on next reconcile.
Existing trust anchors that pin the CA cert will break; tenants must
refresh their ca.crt after upgrading.

Assisted-by: LLM
Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:30 +03:00
Arsolitt 810a0d5c46 feat(mariadb): add short-form SAN variants for ndots-shortened clients
Some DNS clients shorten hostnames before resolving them based on the
ndots setting. For example, a client inside the same namespace with
ndots:5 may try "svc-name.namespace" before the full
"svc-name.namespace.svc.cluster.local" form. Without the short-form
SANs in the certificate, the TLS handshake fails for those clients
even though they reach the correct endpoint.

Adds "*.name-internal" and "name.namespace" (without .svc suffix)
variants to the leaf certificate SAN list.

Assisted-by: LLM
Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:30 +03:00
Arsolitt fa2f1918dc feat(mariadb): add crl sign to CA cert usages
Adds the crl sign key usage to the CA certificate for conventional
compliance with RFC 5280. CA certificates that may sign CRLs should
advertise this usage even when CRL distribution is not currently
configured.

Assisted-by: LLM
Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:29 +03:00
Arsolitt 30c5d7b95e feat(mariadb): add digital signature to leaf cert usages
TLS 1.3 and TLS 1.2 ECDHE require the server certificate to have the
digital signature key usage so that ephemeral key-exchange parameters
can be signed. Without it, strict TLS stacks (Go crypto/tls, BoringSSL)
reject the handshake at the ServerKeyExchange step.

Assisted-by: LLM
Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:29 +03:00
Arsolitt 62f778be19 fix(mariadb): include base service hostname in leaf cert SAN list
The leaf cert now covers the base ClusterIP service `<release>` alongside
the existing `-primary` and `-secondary` services so a client connection
that uses the unqualified release name (e.g. via cozystack platform DNS)
passes hostname verification. The headless `-internal` wildcard and the
external LoadBalancer hostname are unaffected.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:28 +03:00
Arsolitt 924e856878 fix(mariadb): move version to its own section and expose tls.required default
Add a @section Version parameters marker in values.yaml so that the version
parameter is grouped separately from TLS parameters in the generated README
and schema. Explicitly set tls.required: true in values.yaml so UI clients
and schema consumers see the correct default (true, matching the template
behaviour documented in the description field). Also add
[\"spec\",\"tls\",\"enabled\"] and [\"spec\",\"tls\",\"required\"] to keysOrder in
mariadb-rd so TLS child fields render in a stable order in the dashboard.

Regenerate codegen artifacts accordingly.

Assisted-by: LLM
Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:28 +03:00
Arsolitt c1b40d39cf chore(mariadb): regenerate codegen artifacts
Run root and per-package make generate to bring deepcopy, types, README, and CRD
descriptor in sync with values.yaml annotations after the TLS work landed.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:28 +03:00
Arsolitt 6b5c31979e test(mariadb): assert serverCASecretRef and new SAN entries
Add helm-unittest assertions covering the chart changes:
- spec.tls.serverCASecretRef.name in both TLS-enabled MariaDB CR cases
- localhost and wildcard headless-service SAN entries in the leaf
  certificate SAN tests for both external=true and explicit
  tls.enabled=true scenarios

Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:27 +03:00
Arsolitt 63dde5cb91 fix(mariadb): require serverCASecretRef and add localhost/headless SANs
mariadb-operator's admission webhook rejects MariaDB CRs that set
spec.tls.serverCertSecretRef without serverCASecretRef. Point the latter
at the cert-manager-issued CA secret.

The agent sidecar performs startup/health probes against localhost:3306
and pod-to-pod replication uses the headless internal service. Add
localhost and wildcard pod-FQDN entries to the leaf certificate SAN list
so both paths complete the TLS handshake.

Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:27 +03:00
Arsolitt 228635c44b test(mariadb): add TLS test coverage
- Add helm unittest suite covering all tri-state TLS scenarios (unset, false, true, required)
- Verify cert-manager resource creation and naming consistency across RBAC and cert objects
- Pin leaf certificate EKU composition and absence of CA-only key usages
- Cover dashboard-resourcemap tri-state conditional secret exposure

Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:26 +03:00
Arsolitt 9df49190f7 feat(mariadb): implement TLS in Helm templates
- Add _tls.tpl helper with tri-state resolver for tls.enabled (*bool) supporting unset/false/true
- Add certmanager.yaml to provision CA Issuer, CA cert, and leaf cert via cert-manager
- Expose TLS secrets to dashboard through dashboard-resourcemap.yaml
- Wire tls.required and TLS secret references into MariaDB CR spec in mariadb.yaml

Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:26 +03:00
Arsolitt 9ae332cf29 feat(mariadb): add TLS schema and generated artifacts
- Add tls.enabled (*bool) and tls.required fields to API types and values
- Update JSON schema with nullable tls.enabled tri-state and required flag
- Extend Makefile with test target wiring helm-unittest into CI
- Update cozyrds descriptor to expose new TLS fields
- Update README to document tls.required semantics and nullable type

Signed-off-by: Arsolitt <arsolitt@gmail.com>
2026-09-03 01:38:25 +03:00
Aleksei Sviridkin 51471bb5f6 chore(labels): add triage/needs-proposal for requests that go through cozystack/community
Feature requests that need a design decision are routed through
cozystack/community first, as an issue or a design-proposal PR, and
work in this repository starts only once that proposal is accepted.
That rule lived only in chat, so such requests kept being filed here
and were moved by hand, with nothing on the issue recording why.

A dedicated triage state makes the decision visible on the issue
itself: the request is re-filed in cozystack/community and closed
here carrying the label and a link to the proposal. Re-filing rather
than transferring keeps the label on the closed issue, since a
transfer only preserves labels the target repository defines. While
the issue is still open, the daily triage sweep re-applies
triage/needs-triage to any open issue without a triage/* label, so
the routing has to be recorded by replacing the label rather than
removing it. AGENTS.md documents the rule next to the rest of the
triage guidance.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-03 01:17:44 +03:00
Aleksei Sviridkin 61026b732c docs(agents): require the neutral Assisted-by: LLM trailer
The attribution trailer exists for disclosure, not to advertise a
model. A model name in the trailer tells a reviewer nothing they can
act on, and it goes stale with every tool change, so the accepted form
is a single `Assisted-by: LLM` line however many tools took part.

A link to an assistant session is worse still: it rots, and it carries
nothing about the change itself, so no session trailer and no
transcript URL belong in a commit, a PR description, or a comment.

The commit body explains why a change is made; the diff already shows
what changed.

The hygiene rules for messages, trailers and in-code comments are
written down as review blockers for the same reason: a NOT LGTM on one
of them is then a stated rule, not a reviewer's taste.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-03 01:14:58 +03:00
Aleksei Sviridkin 3cf9431f1e test(redis): fail the negative dial probes on an unread state
The two negative dials in the chainsaw suite, the plaintext dial at a
TLS instance and the TLS dial at the instance whose flip was rejected,
decided by whether PONG appeared on stdout with stderr discarded. A
missing pod, a 403 on exec, a wrong container name or the outer cap
firing print no PONG either, so each of them passed as the refusal
being asserted, and the flip case is the check that a rejected flip
left TLS off.

Keep what the dial printed and pass only on the refusal each listener
actually gives, verified in the shipped images: a TLS listener drops a
plaintext client at AUTH and redis-cli reports it as an I/O error; a
plaintext listener holds a ClientHello in silence, because the inline
parser's newline scan stops at a NUL in the handshake header, so the
inner cap expires and kubectl's exit-code trailer carries the 124.
That trailer is what separates the cap firing inside the pod from the
wrapper's cap firing outside it. A listener that answers PONG fails
the check, and anything else fails as a state the check did not read,
with the dial's output in the message.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 20:48:52 +03:00
Andrey Kolkov 6eba4d9fa7 test(backups): use .svc FQDN for rabbitmq backup e2e S3 endpoint
The reworked rabbitmq backup roundtrip reached the upload step and failed
TLS verification: `curl (60) no alternative certificate subject name matches
target hostname 'seaweedfs-s3.tenant-root'`. The demo Bucket, in-cluster
endpoint resolution and the copied SeaweedFS CA all worked; the remaining
gap is the hostname. The seaweedfs filer serving cert's SANs are
`*.tenant-root.svc` and `*.tenant-root.svc.cluster.local`, which the 2-label
`seaweedfs-s3.tenant-root` matches neither; the 3-label `.svc` FQDN does (and
still resolves via search-domain expansion). Point S3_ENDPOINT at
`https://seaweedfs-s3.tenant-root.svc:8333`.

Assisted-By: LLM
Signed-off-by: Andrey Kolkov <androndo@gmail.com>
2026-09-02 21:25:21 +04:00
Loïc Fontaine b142d27376 fix(virtual-machine): guard Kube-OVN IP lookup
Helm's `lookup` propagates the discovery error when the requested API
group is not served, so the vm-instance chart could not render at all on
clusters without the Kube-OVN CRDs. Gate the IP lookup behind
`.Capabilities.APIVersions.Has "kubeovn.io/v1/IP"`.

The regression suite mocks the IP object through kubernetesProvider and
pins both sides: with the API advertised the annotations carry the mocked
MAC and IP, without it they are absent even though the object exists.
helm-unittest's fake lookup never errors on an unserved kind, so only the
second case distinguishes the guard; it fails on main and passes here.

Assisted-By: GPT-5 <noreply@openai.com>
Signed-off-by: Loïc Fontaine <lfinmauritius@users.noreply.github.com>
2026-09-02 20:46:35 +04:00
Myasnikov Daniil 686a81a491 docs(networking): stop claiming the churn coupling is removed
Restoring the target-side pod deny put a cluster-spanning peer selector back on
the webhook endpoint, which is the exact thing the source-side rules were added
to take off it. The comments still said the coupling was "structural and
removed", and the release note still said deleting a namespace no longer
rewrites that endpoint's policy map. Both were true of the previous revision
and are not true of this one.

What ships now is two denies that fail in different directions: the source-side
one keeps enforcing while the webhook endpoint's policy is being recomputed or
has overflowed its map, the target-side one keeps enforcing where Cilium is not
the service load balancer, and neither subsumes the other. So the coupling is
not eliminated, it is made non-load-bearing -- whichever end is degraded the
other still denies, and the map writes are writes rather than an outage.
Eliminating it outright would mean dropping the target-side rule and accepting
a silent fail-open, which is the worse trade.

The chainsaw case's header claimed the deletion "briefly made fail-closed
admission webhooks unreachable". That is the unconfirmed hypothesis, and the
errno in the report contradicts it: EHOSTUNREACH cannot come from a policy
denial, which drops after connect() has returned. It now says what the case
actually asserts -- both webhooks still admit across a namespace deletion --
rather than claiming to reproduce a cause.

Assisted-By: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-09-02 20:52:06 +05:00
Myasnikov Daniil 0335421769 test(e2e): check every webhook registration, and name the controller Service
Three narrowing fixes to the two webhook cases.

The availability precondition resolved only the FIRST registration of each
webhook name (awk ... exit) while every matching registration fires on the
applies below, so an unrelated flaky ingress-nginx release would have aborted
an apply and been reported as a churn-induced outage. It now waits on all of
them and says which one it is waiting for. Split into require_service_up plus a
loop, indexed with sed rather than piped into `while read`, because a
pipeline's body runs in a subshell under dash and a `return` from it would not
reach the caller.

That split immediately produced its own bug, caught by the scenario harness:
POSIX functions share one scope, so the callee's `label="$1"` overwrote the
caller's copy and the second registration reported itself as "(1/2) (2/2)".
The callee now uses distinct names.

The positive control's Service was picked with `grep -v -- '-admission$' |
head -1`, which relies on ingress-nginx-controller sorting before
ingress-nginx-controller-metrics. Deterministic but undocumented, and the
control has to be the Service that actually exposes the https port, so
-metrics is now excluded explicitly.

Also drops a stale sentence: the churn pod's comment claimed the old
target-side policies coupled the webhook endpoint to identity churn, which
overstates a map write as an outage and is moot now that the target-side rule
is back. The pod is there because an empty namespace allocates no identity, so
without it the case would exercise nothing it names.

Eleven scenarios through both scripts under dash with a stubbed kubectl, all as
specified, the new multi-registration case included.

Assisted-By: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-09-02 20:45:22 +05:00
Myasnikov Daniil b78405cede fix(networking): keep a target-side pod deny beside the source-side rules
Restores the deny that does not care who performs the service DNAT, which is
what the source-side rules on their own gave up. Both policies now carry it on
their webhook endpoint for the backend port, alongside the retained world deny,
so losing cilium.kubeProxyReplacement degrades enforcement rather than removing
it.

I argued against this and was wrong. The argument was that a target-side rule
needs a peer covering pods, that such a peer either reattaches namespace churn
to a fail-closed endpoint or, as a wildcard, denies the API server. The second
half does not hold: a CRD-sourced fromEndpoints is never a true wildcard,
because for a clusterwide policy Cilium rewrites every selector to also require
k8s:io.kubernetes.pod.namespace to Exist plus the cluster label (Cilium v1.19.5,
pkg/k8s/apis/cilium.io/utils/utils.go:120-154 getEndpointSelector, whose own
comment at :141 says a wildcard must not become a truly empty allow-all
selector), and no reserved identity carries either label. So this rule denies
pods and leaves host, remote-node and kube-apiserver allowed. `fromEntities:
[all]` and an omitted peer are the shapes that would reach them.

The first half was a cost dressed up as a correctness problem. A cluster-
spanning peer is enumerated per identity, so the rule does add policy-map
entries on the webhook endpoints in proportion to pod-identity count and a map
write per namespace event. It does not add a drop window:
pkg/endpoint/bpf.go:1168-1177 adds entries before deleting them expressly to
avoid transient drops, and inverts that order only when the addition would
overflow the map, warning when it does. The residual risk is therefore
cardinality, not churn -- an endpoint near MaxEntries gets the inverted order,
and cozystack leaves endpointLockdownOnMapOverflow false
(charts/cilium/values.yaml:1250) so an overflow degrades rather than locking the
endpoint down. Both templates now say that where the rule is, rather than
leaving the cost unstated.

The peer is the load-bearing part and both ways of losing it render as a
plausible ingressDeny, so each suite pins it: rule count, the exact peer
selectors, no fromEntities on the pod rule, no fromEndpoints on the world rule.
Mutation-proved by making exactly the two substitutions that would deny the API
server -- fromEntities: [all], and dropping the peer -- in both packages; all
four render cleanly and all four go red.

The ingress-nginx rule carries the konnectivity-agent ServiceAccount exemption
for the same reason the source-side rules do: a Kamaji-hosted tenant cluster
reaches this webhook through that pod, so without it guest-cluster Ingress
admission breaks.

Assisted-By: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-09-02 20:45:10 +05:00
Myasnikov Daniil 3daa83f4b5 feat(cilium): surface a kube-proxy-replacement override instead of nothing
The pin added earlier guards a cozystack developer changing the default. It
cannot observe an operator override in the field, and neither can the e2e,
which only ever runs the default configuration -- so the path Ivan's review
actually names, addons.cilium.valuesOverride on a tenant cluster and the
cozystack.networking Package's cilium component on the host, produced no signal
at all. Both webhook deny policies name their webhook's backend port only,
which covers a pod dialling the ClusterIP solely because Cilium performs the
service DNAT ahead of its own egress hook, so an override degrades that half
silently.

A status-beacon ConfigMap rather than a fail(), following the -awaiting-etcd
beacon in packages/apps/kubernetes/templates/cluster.yaml. Whether Cilium
without kube-proxy replacement is a supported cozystack configuration is a
platform decision, and refusing to render the CNI over a weakened
defence-in-depth control is not a call these charts should make. The host
beacon fires on a bool false, on the string "false", and on the umbrella key
being deleted, because the subchart's own "false" default coalesces into the
parent. The tenant beacon fires on an explicit non-true override only, since
absence means the chart default applies, and it renders on the management
cluster next to the HelmRelease carrying the override -- which is why the
mismatch is detectable there at all rather than inside the guest cluster.

Also withdraws the argument the suite header used to carry, that a target-side
ingressDeny could not be re-added as a fallback. It was wrong, and the next
commit adds that rule. The header now records what the two halves each buy.

Makefile gets .PHONY: test for the reason this branch already argued for
kubeovn-webhook, which applies with more force here now that the suite is
load-bearing for two other packages: hack/package.mk's .PHONY list deliberately
carries only the targets that file defines, so a path named `test` would
otherwise make the target up to date and skip the recipe. Proven both ways.

Assisted-By: LLM
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
2026-09-02 20:44:53 +05:00
scooby87 3a70f91423 fix(vm-disk): fail on storageClass/source edit of existing disk (#3969)
## What this PR does

Fixes #2985. Editing a `VMDisk`'s `storageClass` or `source` after its
DataVolume already exists was silently ignored:
`packages/apps/vm-disk/templates/dv.yaml` looks up the existing
DataVolume and, when found, reused its `spec` verbatim (because
`DataVolume.spec` is immutable in CDI). The edit therefore rendered as a
no-op — the typed CR accepted it and the HelmRelease reported success,
while the DataVolume/PVC kept the original spec and the source of truth
silently diverged from the cluster.

The template now builds the desired `source` into a shared
`$desiredSource` variable (used both for rendering and comparison) and,
when a DataVolume already exists, calls `fail()` with an explicit
message if the requested `storageClass` or `source` differs from the
immutable existing spec — mirroring the explicit size handling already
done in `pvc-resize-hook.yaml`. Storage growth is unaffected and still
flows through the resize hook.

`source` is also marked `@immutable` in `values.yaml`, so the generated
schema now carries the same `x-kubernetes-validations` transition rule
(`self == oldSelf`) that `storageClass` already had; `types.go`,
`values.schema.json` and the generated `vm-disk-rd` CRD are regenerated
to match.

### Verification

- `helm unittest` covers both the immutability guard (via a mocked
existing DataVolume through `kubernetesProvider`, since `lookup` needs a
cluster) and initial-creation source rendering for every source type —
12/12 pass.
- Verified live on a dev cluster with `helm install --dry-run=server`
against a real DataVolume: an unchanged edit renders, a `storageClass`
change fails, a `source` change fails, and a storage grow still renders
the resize hook without tripping the guard.

### Scope note

This PR only makes the drift visible and marks `source` immutable. Two
deeper platform findings sit outside its scope: (1) #2657 (pre-existing)
— the `apps.cozystack.io` aggregated apiserver does not evaluate the
`x-kubernetes-validations` CEL rules on update, so `@immutable` is a
no-op at admission for every Application kind, which is exactly why the
chart-level `fail()` — not the CEL rule — is the substantive guard here;
(2) #3971 — that same apiserver does not honour `--dry-run=server` and
persists the change (surfaced while testing this fix).

### Downstream repositories

Walked the trigger map in `docs/agents/contributing.md` against the diff
file by file. The diff touches only `packages/apps/vm-disk/` (template,
`values.yaml`, regenerated `values.schema.json`, tests), the regenerated
`packages/system/vm-disk-rd/cozyrds/vm-disk.yaml`, and
`api/apps/v1alpha1/vmdisk/types.go`. No package was added, renamed or
removed; no `values.schema.json` field was added, renamed or removed
(only a validation rule on the existing `source` field); no default
changed; `README.md` is unchanged; the `cozyrds` file was regenerated,
not renamed. The terraform provider models fields, defaults and enums
but not CEL immutability, so it is unaffected. No downstream repository
is reached by this change.

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

### Release note

```release-note
fix(vm-disk): editing storageClass or source on an existing VMDisk now fails with a clear message instead of being silently ignored; delete and recreate the disk to change these immutable fields.
```


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

* **New Features**
* Added support for blank, HTTP, image, disk, and upload VM disk
sources.
* VM disk sources and storage classes are now protected from unintended
changes, while storage expansion remains supported.
* Existing disks preserve their configured source and storage settings.

* **Bug Fixes**
  * Invalid or conflicting source configurations are rejected.
* Prevented silent no-op updates and incorrect immutability errors for
existing disks.

* **Documentation**
* Documented source and storage class immutability, including the need
to recreate disks when changing either setting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-02 18:40:24 +03:00
Aleksei Sviridkin 25a0618184 test(redis): exercise TLS end to end in the chainsaw suite
Everything the TLS unit tests can only render now runs on a live
cluster. A second fixture with tls.enabled asserts that cert-manager
issues the chain, that the patched operator brings two Redis replicas
and the Sentinel Deployment to Ready through its --tls probes, that the
operator publishes its CA-only Secret under the widened ClusterRole, and
that the CA-extraction controller hands the tenant exactly ca.crt
through core.cozystack.io/tenantsecrets while the key-bearing Secrets
and the operator's copy stay off that path. The last check completes a
handshake through the rfr- service name with the same CA the tenant
receives.

A third case applies tls.enabled to a running plaintext release and
asserts the refusal end to end: the HelmRelease upgrade fails with the
schema's own message, the StatefulSet keeps its revision and both
replicas Ready, plaintext still answers and no TLS listener appears.

The TLS case also asserts the topology the operator built rather than
stopping at readyReplicas: exactly one master, a replica whose link is
up, and sentinels that moved off the bootstrap address. Ready alone
witnesses the bootstrap, since a pod still replicating from the initial
127.0.0.1 never gets there, but the readiness script exits 0 for
anything reporting role:master, so it stops witnessing once the
bootstrap is over.

Both PING calls note where the pinger credentials come from: the ACL user
the operator writes into every redis.conf it generates, and the one its
own liveness probe uses. Nothing in this tree defines it, so a reader
grepping for it here finds nothing and reads the calls as broken.

Every redis-cli call runs under the container's own timeout, and both
script operations carry an explicit one. The inner cap is the part
that matters. The flip case dials TLS at a plaintext listener that
will never send a ServerHello, and redis-cli has no handshake
deadline of its own. Chainsaw does kill the shell when its exec
budget runs out, but it captures the script's stdout and stderr
through pipes, and Go's exec then waits for every holder of the write
end to close it; the orphaned kubectl is one, so the suite would go
silent until the job ceiling instead of failing. Expiry reads as the
refusal for the negative check and as a named failure for the PINGs.
Both engine images provide /usr/bin/timeout: busybox on the sentinel,
coreutils on the data pods.

The negative half of the tenant-secret pair requires the error to say
NotFound. A 403, a timeout or an unserved CRD would otherwise be read
as proof that the Secret is not served, which is the direction that
fails silently.

The dashboard Role is asserted on the deployed object, not only in the
chart unit tests: it must reach the auth Secret and nothing else, which
is the name-granting half of the pair the label-driven projection
completes. Every kubectl in both scripts runs under a wall-clock bound,
because the per-command cap inside a container cannot fire when the exec
stream itself never establishes, and a kubectl left running holds the
script's stdout open. The plaintext StatefulSet in the flip case waits
5m rather than 2m: it measured 98s of that budget on a real run, being
the third failover the group brings up in one namespace.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:06 +03:00
Aleksei Sviridkin 69fadb2fa6 docs(redis): point the SAN comment at the function the patch defines
The operator side of the carried patch computes the leaf's SAN list in
redisCertificateSANs. The comment in certmanager.yaml still named it
redisCertificateDNSNames, a name the patched source does not contain.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:06 +03:00
Aleksei Sviridkin 2fee484dea test(redis): pin the schema rejection of an unknown tls.authClients value
The no / optional / yes constraint on tls.authClients lives in
values.schema.json, and nothing the chart renders shows whether it is
enforced: a bogus value either fails validation up front or reaches the
template as a string. Assert the failure, so the enum cannot be dropped
from the schema without a red test.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:06 +03:00
Aleksei Sviridkin 9ef1f28855 build(redis-operator): carry TLS support as a downstream patch
freshworks-oss/redis-operator v3.3.5 has no TLS support. The operator
work that packages/apps/redis renders against was ported upstream as
freshworks-oss/redis-operator#85 and is not in a release yet, so carry it
here over the v3.3.5 tarball until one lands.

Three pieces, and TLS is silently off unless all three are present:

- images/redis-operator/patches/tls.diff is the source half. The
  Dockerfile already applies patches/*.diff, and the shell expands that
  to labels.diff then tls.diff; they touch disjoint files, so the order
  does not matter, but it is alphabetically stable either way.
- patches/crd-tls.diff teaches the vendored CRD about spec.tls. Without
  it the apiserver prunes spec.tls from every RedisFailover the redis
  chart renders and the patched binary waits for a field it never sees.
- patches/rbac-tls.diff grants Create, Get and Update on Secrets, so the
  operator can publish the CA-only Secret named by
  spec.tls.caCertSecretName. Those are the only Secret calls in the
  patched source: upstream v3.3.5 only ever reads one, and the patch
  adds Create and Update on a Secret it addresses by name, so nothing
  lists, watches, patches or deletes.

tls.diff is cut from that PR's commit 2ad2ed8d1 rebased onto v3.3.5, and
its header pins that SHA so the next refresh can be diffed against it.
Beyond the TLS listener it carries the renewal roll: on every reconcile the operator stamps a hash of the TLS
Secret's tls.crt and ca.crt into the pod template of the Redis
StatefulSet and the Sentinel Deployment, so a renewed certificate rolls
Redis through the operator's own roller and Sentinel through its
Deployment. The effective spec.tls.authClients value is folded into
the same hash, so changing it rolls the pods the same way instead of
landing at the next unrelated restart, and the operator presents its
client certificate whenever the Secret carries one, independent of that
field, so neither direction of the change locks it out of the instance
it reconciles. It also mounts the TLS volume 0440 when the pod declares an
fsGroup, rejects a caCertSecretName that names the TLS Secret itself,
and waits for the TLS material before it writes the ConfigMaps and the
workloads, so a first TLS install starts its pods once.

tls.enabled is fixed at creation. Redis replication and Sentinel cannot
straddle plaintext and TLS: a replica restarted onto the other protocol
cannot sync from the master, and Sentinels restarted onto it fail over
to such a replica while the master still takes writes. The rule that
refuses the change is a CEL transition rule on the RedisFailover spec;
it lives in the CRD, so it ships here through patches/crd-tls.diff
together with the schema block it references. The cut carries source
only, and the Dockerfile strips the tarball's manifests/, charts/,
example/ and .github/ before applying the patches, so the image builds
from source alone and the two upstream tests that read the CRD YAML skip
instead of failing against v3.3.5's stale copy; the CRD half is
patches/crd-tls.diff.

cert-manager Certificates get no grant. The patched operator manages a
Certificate only under spec.tls.certManager, and packages/apps/redis
pins the other mode: it always supplies spec.tls.certificateSecret, so
that code path is unreachable as the platform ships it. A comment at
the rule site records the decision and names the verbs the rule would
need, so a re-vendor review reads the absence as deliberate.

The chart patches go through the mechanism the packages that customise a
vendored chart already use — reloader, grafana-operator, ingress-nginx,
seaweedfs and kamaji all re-apply a patches/*.diff at the end of update:
— because `rm -rf charts` discards a hand-edit and the next `make update`
would take TLS back out without failing.

tls.diff also carries one change that is not TLS and takes effect with
TLS off: MakeSlaveOfWithPort connects to the replica on its own port
rather than on the master's. It changes a dial, not a pod template, so
nothing rolls when this image ships; the probes dial localhost only
under TLS, and the plaintext pod templates stay byte-identical to
v3.3.5. The patch header names it, so a reader of patches/ does not
take the file for TLS-only.

The grant is narrower than the ported operator's own chart asks for:
that one also grants patch on Secrets, and create, delete, get, list,
patch, update and watch on Certificates. None of that is reachable from
the source as shipped here.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:06 +03:00
Aleksei Sviridkin d0cab491f3 feat(redis): move the tenant trust anchor onto the platform projection
The tenant read path was two grants on Secret names: the operator's
CA-only <release>-ca-cert in the dashboard Role, and the same name in the
ApplicationDefinition's include list. Replace both with the projection
the previous commit declares.

A name grant conveys whatever occupies the name. The operator holds
create and update on Secrets cluster-wide, so what sits at
<release>-ca-cert is the operator's choice rather than the platform's,
and RBAC has no key-level filter to catch it if that ever stops being
just ca.crt. <release>.tenant-ca is written only by the CA-extraction
controller, which copies one named key and refuses PEM private key
material outright. That is the difference between a name that happens to
hold a certificate today and provenance the platform vouches for, and it
is the reason postgres, mongodb, nats and qdrant all reach the tenant
this way — mongodb's operator publishes a CA Secret of its own too, and
that one is excluded rather than granted.

Also drop spec.caCert from the ApplicationDefinition. The
ApplicationDefinition CRD does not define that field and Flux applies
these server-side, so the apiserver rejects the whole object with "field
not declared in schema" and the redis-rd release never goes ready. It was
carried deliberately as a merge-order gate for a controller that reads
it; that controller landed as the TenantProjection reconciler, which
reads a sentinel in the app chart instead, so the gate has nothing left
to wait for.

hack/check-redis-rd-secrets.bats pins the whole rendered Secret surface
rather than probing for known-bad names, alongside the existing guards
for nats, qdrant and mongodb: an include with neither resourceNames nor
matchLabels restricts nothing, and a second matchLabels entry selecting
a label cert-manager also stamps on the key-bearing Secrets would grant
the CA private key while every name in the file stayed correct.

The connection example passes the generated password as well. Password
generation is on by default, so the command as printed connected and then
answered NOAUTH on the first real command.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:06 +03:00
Aleksei Sviridkin cbde93b0cc feat(redis): declare the tenant trust anchor as a TenantProjection
The tenant needs the release's CA certificate to verify the server, and
the platform's contract for handing one over is the key-free
<release>.tenant-ca projection: the CA-extraction controller lifts a
single named key out of a source Secret, refuses to publish anything
that parses as PEM private key material, and stamps
internal.cozystack.io/tenant-ca on what it writes. postgres, mongodb,
nats and qdrant all reach the tenant this way; redis is the fifth.

Source the chart's own cert-manager CA Secret, <release>-ca-tls, rather
than the CA-only Secret the operator publishes at
spec.tls.caCertSecretName. Both carry the same certificate, but
<release>-ca-tls exists as soon as cert-manager issues the CA, so the
tenant read path does not also depend on the operator having reconciled
the RedisFailover and written its copy. That the source holds the CA
private key beside ca.crt is the intended shape rather than a
compromise — projecting one key out of a key-bearing Secret is what the
controller is for, and it refuses private key material outright.

Gated on tls.enabled, because the source Secret only exists when TLS is
on. The test pins that the gate is tls.enabled and not external access:
an externally exposed plaintext release must render no sentinel, or the
controller waits forever on a Secret nothing creates.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:05 +03:00
Aleksei Sviridkin f05af5d0fb docs(redis): state that TLS needs cert-manager
The TLS section described the per-release cert-manager chain without
saying that cert-manager has to be present to issue it. It is present on
every system variant: the platform installs it in the variant-independent
body of the system bundle, so isp-hosted carries it as well. What
isp-hosted lacks is reloader, and the renewal section already covers
that gap.

The cert-manager sentence separates the two ways a cluster can lack it:
without the controller but with its CRDs the resources render and nothing
issues them, and without the CRDs the release fails on an unknown kind.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:05 +03:00
Aleksei Sviridkin 6693ac9571 docs(redis): record why the tls block ships empty
The generated README renders the tls.authClients default as `{}` because the
block carries no keys. Materialising the default to fix that column corrupts
the schema and the CRD, so note the trap at the line someone would edit.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:05 +03:00
Aleksei Sviridkin cf3cb0f133 test(values): reject a boolean default on a string-typed schema property
cozyvalues-gen quotes a default only when the declared type is the literal
`string` or `quantity`; a named alias, including one declared `@enum
{string}`, falls through to a YAML re-parse of the bare value where the 1.1
boolean words resolve. A chart spelling out a `"no"` default under such a
type emits `"default": false` into a string-typed, enum-constrained property
and `+kubebuilder:default:=false` onto the matching Go field. Templates read
values.yaml rather than the schema, so the chart suites stay green while the
shipped schema and CRD carry a default the field rejects.

Vendored schemas under packages/*/*/charts/ are left out of the scan:
cozyvalues-gen never writes them, they change only through `make update`,
and a violation there would have no fix inside this tree.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:05 +03:00
Aleksei Sviridkin 929cac8e8b docs(redis-rd): scope the exclude backstop to what it actually guards
The comment read as a justification and it was wrong. It described the
backstop as guarding against any Secret in the namespace acquiring the
tenant-ca label. The lineage webhook is not namespace-wide — it returns
early for any object whose ownership does not resolve to this release's
app CR — and the two Secrets listed do not even reach it today, because
the platform runs cert-manager with enableCertificateOwnerRef false and
leaves them without an ownerReference. The entries are defence in depth
against a future where that changes, not a gate that fires now. State
the scope rather than implying a broader guarantee.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:05 +03:00
Aleksei Sviridkin 1d3499e36b fix(redis): certify the external LoadBalancer service name
When external access is on the chart creates <release>-external-lb
itself, but the leaf certificate covered only the four Services the
operator creates. That name resolves in-cluster like any other Service,
so a client dialing it under TLS failed hostname verification against a
Service this chart owns. Add its four DNS forms next to the operator's,
gated on the same flag that creates it.

Also record at the image pin how the digest moves: it is refreshed by release preparation, not by this change, so an edit to the Dockerfile under images/ ships only once the next repin lands.

The README list of in-cluster names the certificate covers names the
external LoadBalancer Service as well.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:58:05 +03:00
Aleksei Sviridkin eb4abc8d93 feat(redis): make TLS opt-in instead of following external access
TLS was enabled automatically whenever external was true. In this
operator TLS is not additive — the rendered config sets port 0 and moves
the listener to tls-port — so that inference turned every already-running
externally-reachable Redis into a TLS-only server on its first reconcile
after the upgrade and cut every plaintext client with it. A platform
upgrade must not sever working connections.

Resolve tls.enabled to false when unset, whatever external says. Enabling
TLS becomes an explicit act at creation time, and existing releases keep
the behaviour they have today.

Creation time, not any time: a running instance cannot change mode. A
replica restarted onto the TLS listener cannot replicate from a master
still on plaintext, and Sentinels already on TLS would fail over to a
stale replica, so the operator's RedisFailover schema rejects a change of
tls.enabled and the HelmRelease upgrade fails while the instance keeps
serving what it served before. The README says so and points at creating
a new instance and migrating.

Pin the decision directly: external: true on its own now has to leave the
cert-manager chain unrendered, the operator without spec.tls, and the
tenant without TLS secrets. Every case that previously reached TLS through
external says enabled: true instead, and the null and empty-map forms
resolve to off alongside the unset one.

With nothing inferred there is no upgrade-time behaviour change left, so
the breaking-change marker and footer are gone from this branch.

Say how to get out of it as well. The cozystack Redis API accepts the
change, so the rejection lands on the HelmRelease, and every later edit
to that instance queues behind the failure until tls.enabled goes back
to what it was.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:56:08 +03:00
Aleksei Sviridkin a7ab8ca14f fix(redis): keep hostless tenants rendering when external access is on
Requiring _namespace.host turned a nil dereference into a hard render
failure for a shape that legitimately has no host. packages/apps/tenant
computes an empty host whenever neither the tenant nor its parent sets
one, and Helm's required rejects the empty string as readily as nil, so
an external Redis running in such a tenant would have stopped templating
altogether on upgrade — no object left to inspect and no error pointing
at the cause.

Emit the external SAN when a host exists and skip it when none does. A
tenant without a host has no external name to certify, so there is
nothing being silently dropped, and the in-cluster names still cover
every client that verifies inside the cluster. Reading through a
defaulted dict keeps an absent _namespace from dereferencing nil.

Replace the test that pinned the failure with two that pin rendering,
for an empty host and for an absent namespace map.

Add the coupling the CA-only secret name needs. Its name has to match
across the operator spec that publishes it and the tenant grant that
exposes it; renaming one alone leaves the tenant without a trust anchor
and produces no error anywhere.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:56:07 +03:00
Aleksei Sviridkin b6ffa0cca2 docs(redis): stop promising an external hostname nothing resolves
The certificate covers <release>.<tenant-host> and the TLS section told
users to connect there, but the external Service is a plain LoadBalancer
with no external-dns annotation — unlike the opensearch external Service,
which annotates its hostname explicitly. Nothing points that name at the
LoadBalancer address, so the one documented external path does not work
as written, and the IP fallback fails hostname verification because the
certificate's only IP SANs are loopback.

Describe what is actually true and name the manual step needed to reach
the endpoint from outside. Publishing the name from the chart is the
better fix, but that is a platform-integration decision about which
hostname redis should claim, not a documentation change.

Also disambiguate the CA source comment. Source and destination are
different Secrets — the declared source is read, the projection is
written — and the previous wording put both names close enough together
to read as a contradiction.

The hostname-verification note names which clients it applies to:
redis-cli, the one the README shows, verifies the chain and not the
name, so it connects to a bare IP and hides the mismatch.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:56:07 +03:00
Aleksei Sviridkin 128fc5f1d7 docs(redis): describe how a renewed certificate reaches the pods
Redis and Sentinel read tls-cert-file and tls-key-file once at startup,
so a leaf renewed by cert-manager 30 days before its one-year expiry is
served only after the pods restart. The operator does that restart: on
every reconcile it reads the TLS Secret and stamps a hash of tls.crt and
ca.crt into the pod template of the Redis StatefulSet and the Sentinel
Deployment, so a renewal rolls Redis through the operator's own roller
(the StatefulSet is OnDelete; the roller replaces one pod per reconcile,
replicas before the master) and Sentinel through its Deployment.

The TLS section presented the setup as turnkey and said nothing about
renewal. Say what happens, and name the fallback: when the roll cannot
run, because the operator is down or its reconcile of this RedisFailover
keeps failing, the deadline is the old certificate's expiry, since past
it the operator's own TLS connections to Sentinel and Redis fail along
with the clients.

The CA has a clock of its own: five years, reissued on the same key
before the end, so a ca.crt copied once verifies new leaves only until
the original CA certificate expires. Say that too, and point at
re-reading the projection instead of baking the copy in.

A stakater reloader annotation is not an alternative here and is not
used: the operator regenerates the pod template on every reconcile, so
nothing written into it from outside survives to the next one.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:56:07 +03:00
Aleksei Sviridkin eb5302fb24 fix(redis): surface the CA-only secret to the tenant before the controller lands
The trust anchor was selected only by the internal.cozystack.io/tenant-ca
label, which nothing stamps until the CA-extraction controller merges. A
label-only entry selects nothing until then, so a TLS-enabled Redis gave
the tenant no way to obtain the certificate needed to verify the server —
the dashboard Role grants the Secret by name, but it never became a
tenant secret and so never appeared on the product surface.

Name the operator's CA-only Secret directly alongside the auth secret.
It holds ca.crt and no private key, so this widens tenant visibility by
exactly the object the tenant needs and nothing else. The label selector
stays for the converged path; once the controller publishes its
projection the anchor is reachable under both names.

Cover the two assertions the feature depended on and did not have:
caCertSecretName, which has to agree with both the dashboard Role and the
declared CA source, and the loopback IP SANs, added by their own fix
commit and until now asserted nowhere.

Correct the tri-state helper's comment. It claimed the kindIs "invalid"
guard covers an explicitly null tls.enabled; the schema types that field
as boolean and rejects null before any template runs. The guard covers
the reachable shape, a tls map with no enabled key, now tested.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
Assisted-By: Claude <noreply@anthropic.com>
2026-09-02 17:56:07 +03:00
Aleksei Sviridkin f5206a6e28 docs(redis): declare the TLS-on-upgrade break and fix the parameter sections
TLS replaces plaintext in this operator rather than running beside it —
with TLS on, Redis and Sentinel are configured with port 0 and serve only
on the TLS port. Since tls.enabled falls back to external, an already
deployed instance with external: true switches to TLS-only on its first
reconcile after the upgrade and every plaintext client breaks. That was
documented as a feature and nowhere as a change of behaviour for existing
instances. State it as a breaking change and name tls.enabled: false as
the opt-out.

Also spell out which hostname the certificate actually covers. The SAN
list carries the four service names and the external tenant hostname, and
its only IP entries are the loopback addresses used by the in-pod probes
and the metrics sidecar, so connecting to the external LoadBalancer by IP
fails for clients that verify the hostname.

The TLS section marker sat above the version parameter, which put version
in the TLS table in the generated README instead of Common parameters.
Move the marker below it. Regenerating also reorders version ahead of tls
in keysOrder, matching how postgres orders the same two fields.

Pin the PackageSource CRD replacement policy the way the mongodb-operator
one is pinned. The RedisFailover CRD gained spec.tls with the fork, and
Helm never upgrades CRDs shipped in crds/, so losing CreateReplace would
leave the live CRD behind and the apiserver would strip spec.tls from
every RedisFailover the chart renders — TLS silently off, no error.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:56:07 +03:00
Aleksei Sviridkin 8ee652f734 fix(redis): name the failure when external is on without a namespace host
The external SAN dereferenced .Values._namespace.host directly, so a
render without that injected value aborted on a nil pointer with no
indication of what was missing. TLS now defaults on whenever external is
true, which puts that lookup on the default path for every externally
reachable Redis.

Wrap it in required with an explicit message, matching how the nats chart
guards the same lookup in its own certificate template. Failing is the
right behaviour rather than dropping the SAN: a certificate issued
without the external hostname is accepted by nothing outside the cluster
and the resulting handshake error points nowhere near the cause.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:56:07 +03:00
Aleksei Sviridkin ad9013c237 fix(redis): restore the storage class picker and guard the cluster-domain lookup
Two defects in the generated ApplicationDefinition and the certificate
template.

The regenerated openAPISchema had lost the x-cozystack-options extension
on storageClass that values.schema.json still carries, which is what
drives the storage class picker in the dashboard form. The schema was
generated with cozyvalues-gen 1.5.0 while CI pins 1.6.0, and the older
release drops the extension. Regenerated with the pinned version, which
restores it.

The cluster-domain lookup indexed .Values._cluster directly, so a render
where the platform injects no _cluster map failed with "index of untyped
nil" before the documented cozy.local fallback could apply. Default the
parent map so the fallback is actually reachable, and extend the test to
cover an absent map as well as an empty domain — the previous test only
exercised a domain set to the empty string, which never reached the
failing path.

Signed-off-by: Aleksei Sviridkin <f@lex.la>
Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-09-02 17:56:06 +03:00