Skip to content

[controller] Astef prototype enlarge our rsc controller#525

Open
IvanOgurchenok wants to merge 5 commits into
astef-prototypefrom
astef-prototype-enlarge-our-rsc-controller
Open

[controller] Astef prototype enlarge our rsc controller#525
IvanOgurchenok wants to merge 5 commits into
astef-prototypefrom
astef-prototype-enlarge-our-rsc-controller

Conversation

@IvanOgurchenok

Copy link
Copy Markdown
Contributor

Description

Add ReplicatedVolumeOperation (RVO) API and rolling operations support to RSC controller.

API changes:

  • New cluster-scoped ReplicatedVolumeOperation CRD for tracking rolling updates
  • New fields in ReplicatedStorageClassStatus: SortSalt, RollingOperationsCursor
  • New LastOperation field in ReplicatedVolumeStatus for UI observability

Controller changes:

  • RSC controller now creates RVO objects for volumes that need configuration updates or eligible nodes conflict resolution
  • Round-robin cursor-based selection ensures fair distribution across volumes
  • Budget limits (maxParallel) control concurrent operations
  • Automatic cleanup of completed operations when cursor advances

Does not restart any critical cluster components.

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

When ReplicatedStorageClass configuration changes (e.g., topology, replication mode) or eligible nodes list changes, existing volumes need to be updated to match the new configuration.

Previously, there was no mechanism to:

  1. Track which volumes need updates
  2. Control the rollout pace (avoid updating all volumes at once)
  3. Provide visibility into the rollout progress

This PR adds the foundation for controlled rolling updates with:

  • RollingUpdate strategy — gradually apply changes to existing volumes
  • RollingRepair strategy — automatically fix eligible nodes conflicts
  • Configurable parallelism via maxParallel setting

What is the expected result?

After applying:

  1. New CRD available: kubectl get crd replicatedvolumeoperations.storage.deckhouse.io

  2. RVO objects created when RSC has ConfigurationRolloutStrategy: RollingUpdate or EligibleNodesConflictResolutionStrategy: RollingRepair and volumes need updates: kubectl get rvo

  3. RSC status shows rolling state:

    • status.sortSalt — random value for deterministic ordering
    • status.rollingOperationsCursor — tracks progress
  4. Conditions reflect rollout status:

    • ConfigurationRolledOut: False with reason ConfigurationRolloutInProgress
    • VolumesSatisfyEligibleNodes: False with reason ConflictResolutionInProgress

Note: RVO objects are created but not processed yet — a separate RVO controller (future PR) will handle the actual volume updates.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

@IvanOgurchenok IvanOgurchenok linked an issue Jan 23, 2026 that may be closed by this pull request
@IvanOgurchenok
IvanOgurchenok marked this pull request as ready for review January 23, 2026 13:58
@IvanOgurchenok IvanOgurchenok self-assigned this Jan 23, 2026
@IvanOgurchenok
IvanOgurchenok force-pushed the astef-prototype-enlarge-our-rsc-controller branch from f041f5d to 7cbf220 Compare January 25, 2026 23:21
@IvanOgurchenok
IvanOgurchenok force-pushed the astef-prototype-enlarge-our-rsc-controller branch from a003467 to ea874cd Compare February 2, 2026 00:56
…ions support

Introduce ReplicatedVolumeOperation (RVO) API for managing rolling
configuration updates and eligible nodes conflict resolution.

API changes:
- Add ReplicatedVolumeOperation type with Spec (Type, ReplicatedVolumeName,
  ResolveEligibleNodesConflict) and Status (Conditions)
- Add RollingOperationsCursor and SortSalt to ReplicatedStorageClassStatus
- Add LastOperation field to ReplicatedVolumeStatus for UI observability
- Add RSCRVOLockFinalizer and OperationCursorLabelKey constants

RSC controller changes:
- Add RVO watch with predicates (Completed condition changes)
- Add RVO indexes (by RSC owner ref, by RV owner ref)
- Implement selectTargetRollingOperations with filter-before-compute
  optimization (reduces hash computations from O(N) to O(C))
- Implement round-robin cursor-based volume selection with budget limits
- Add removeRVOLockFinalizers for cleanup when cursor advances
- Add defensive check for empty cursor label (migration safety)

Performance:
- Add go-performance-patterns.mdc rule with Schwartzian transform
  and filter-before-compute patterns

Tests:
- Add 36 new unit tests for rolling operations logic

Signed-off-by: Ivan Ogurchenok <ivan.ogurchenok@flant.com>
- Remove OperationCursorLabelKey, parse cursor from RVO name
- Rename SortSalt to RollingOperationsSortSalt in RSC status
- Remove LastOperation from ReplicatedVolume (single owner principle)
- Add MaxLength validation: rollingOperationsSortSalt=8, cursor=16
- Refactor RVO spec: ResolveEligibleNodesConflict → UpdateConfigOptions
- Move name suffix constants from public API to controller (internal)
- Fix cursor hash from 32-bit to 64-bit to avoid collisions at scale
- Simplify parseRVOCursor to use last segment after "-"

Signed-off-by: Ivan Ogurchenok <ivan.ogurchenok@flant.com>
add usage for list UnsafeDeepCopy, make wrapper for avoid strith usage, we got full copy only if need to modify

Signed-off-by: Ivan Ogurchenok <ivan.ogurchenok@flant.com>
Signed-off-by: Ivan Ogurchenok <ivan.ogurchenok@flant.com>
- Refactor selectTargetRollingOperations → pure computeTargetRollingOperations
  (move salt generation and cursor mutation to ensureRollingOperations)
- Extract applyRollingOperationsCursor helper for cursor updates
- Rename removeRVOLockFinalizers → patchCompletedRVOsRemoveFinalizer
  (align with patchScheduledReplicas batch patch naming convention)
- Remove accidental patchStrategy:"merge" on Datamesh field (rebase artifact)

Signed-off-by: Ivan Ogurchenok <ivan.ogurchenok@flant.com>
@IvanOgurchenok
IvanOgurchenok force-pushed the astef-prototype-enlarge-our-rsc-controller branch from ea874cd to ce8b89a Compare February 9, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[controller] implement our rsc controller

1 participant