Skip to content

[controller] Enforce CephClusterConnection spec.cephFS immutability via CEL (safe when cephFS is absent)#75

Merged
AleksZimin merged 1 commit into
mainfrom
fix/cel-rule-for-cephclusterconnection
Aug 14, 2025
Merged

[controller] Enforce CephClusterConnection spec.cephFS immutability via CEL (safe when cephFS is absent)#75
AleksZimin merged 1 commit into
mainfrom
fix/cel-rule-for-cephclusterconnection

Conversation

@AleksZimin
Copy link
Copy Markdown
Member

@AleksZimin AleksZimin commented Aug 14, 2025

Description

  • Add a robust CEL validation to the CRD to make spec.cephFS fully immutable (cannot be added, removed, or changed after creation).
  • Use a guarded rule that handles objects without cephFS to avoid validation errors during controller updates:
    • Rule: oldSelf == null || (has(self.spec.cephFS) == has(oldSelf.spec.cephFS) && (!has(self.spec.cephFS) || self.spec.cephFS == oldSelf.spec.cephFS))
    • Message: “The spec.cephFS field is immutable (cannot be added, removed, or changed).”
  • Keep spec.cephFS.subvolumeGroup immutability as-is.

No restarts of critical components are expected.

Why do we need it, and what problem does it solve?

  • Previous validation attempts caused reconcile failures on resources created without spec.cephFS when the controller tried to add a finalizer (validation referenced a missing key).
  • We also want to prevent bypassing immutability by deleting the whole cephFS block and setting a different value later, since changing the CephFS subvolume group affects data placement/behavior.
  • This change enforces the policy while ensuring resources without cephFS remain valid during normal controller updates.

What is the expected result?

  • Creating a CephClusterConnection without spec.cephFS works; the controller can add finalizers and update status without validation errors.
  • Any attempt to add, remove, or modify spec.cephFS after creation is rejected with a clear validation message.
  • If spec.cephFS.subvolumeGroup was set on creation, it remains immutable as before.

Checklist

  • The code is covered by unit tests. (CRD validation only; no code changes)
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
@AleksZimin AleksZimin changed the title fix cel [controller] Enforce CephClusterConnection spec.cephFS immutability via CEL (safe when cephFS is absent) Aug 14, 2025
@AleksZimin AleksZimin self-assigned this Aug 14, 2025
@AleksZimin AleksZimin requested a review from duckhawk August 14, 2025 15:39
@AleksZimin AleksZimin marked this pull request as ready for review August 14, 2025 15:39
@AleksZimin AleksZimin requested a review from kneumoin August 14, 2025 15:42
@AleksZimin AleksZimin added the bug Something isn't working label Aug 14, 2025
@AleksZimin AleksZimin requested a review from astef August 14, 2025 15:57
@AleksZimin AleksZimin merged commit 2d52e15 into main Aug 14, 2025
17 of 18 checks passed
@AleksZimin AleksZimin deleted the fix/cel-rule-for-cephclusterconnection branch August 14, 2025 15:58
duckhawk pushed a commit that referenced this pull request Mar 2, 2026
…ia CEL (safe when cephFS is absent) (#75)

Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
duckhawk added a commit that referenced this pull request May 13, 2026
The check_previous_channel_release composite action now swaps the
domain of module_source with its `registry` input before pulling, so
the previous-channel image can be read from a read-only registry mirror
without changing the deploy target. Pass `vars.PROD_REGISTRY_READ` to
take advantage of that.

Depends on the swap-domain change in deckhouse/modules-actions (PR #75
for v14).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants