Skip to content

Api rework#52

Draft
AleksZimin wants to merge 5 commits into
mainfrom
api-rework
Draft

Api rework#52
AleksZimin wants to merge 5 commits into
mainfrom
api-rework

Conversation

@AleksZimin

Copy link
Copy Markdown
Member

Description

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

What is the expected result?

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.

A snapshot node binds at most one volume, so model the foundation
VolumeCaptureRequest as a single target instead of a list:

- spec.targets[] -> spec.target (single object), namespace omitted
  (the captured PVC always lives in the VCR namespace; the controller
  re-injects it in-memory and fills status.dataRef.target.namespace).
- status.dataRefs[] -> status.dataRef (single object).
- Drop the bulk capture path (merge/validate/upsert helpers, bulk
  progress patch) and rename the snapshot capture file accordingly.
- Regenerate CRD and deepcopy.

Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
…Ref (PVC-only for now)

Collapse spec.targetNamespace + spec.targetPVCName into a single
spec.targetRef (ObjectReference). Restore is never cross-namespace, so
producers do not set targetRef.namespace; the controller derives the
target namespace from metadata.namespace. Symmetrically rename
status.targetPVCRef -> status.targetRef and populate its namespace so
the status stays self-contained.

Only kind=PersistentVolumeClaim is supported for now (empty kind
defaults to PVC); kind reserves space for future cluster-scoped targets
(e.g. PersistentVolume). The controller rejects unsupported target kinds
with a terminal Ready=False/UnsupportedTargetKind condition.

Updates the in-repo VRR producer (data-export snapshot resolver), the
restore controller, tests, and regenerates CRDs + deepcopy. The patched
csi-external-provisioner (external-provisioner-fox) consumes these
fields and is updated separately during re-vendoring.

Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
Add an optional uid field to VolumeDataArtifactRef so the durable
artifact reference (e.g. VolumeSnapshotContent / PersistentVolume) is
self-contained, symmetric with target.uid. The field is omitempty (no
MinLength) because the artifact may be referenced before its UID is
known; producers fill it best-effort from the real object.

The VCR controller now threads the VSC UID (and PV UID on the detach
path) into status.dataRef.artifact.uid. Regenerates the CRD; deepcopy is
unchanged (scalar field). Tests assert the uid propagates on the
snapshot happy path, the snapshot terminal-failure path, and the detach
path.

Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
…ation.deckhouse.io

Move all storage-foundation CRD types (VolumeCaptureRequest, VolumeRestoreRequest,
DataExport, DataImport) from the shared storage.deckhouse.io group to the
per-module storage-foundation.deckhouse.io group, and regenerate CRDs.

- api: register.go APIGroup, doc.go +groupName, GVK/GVR Group fields.
- crds: git mv internal VCR/VRR CRD files to <new-group>_<plural>.yaml and
  regenerate (controller-gen); hand-curated DataExport/DataImport CRDs updated
  in place (metadata.name/spec.group); generate_code.sh rm-f paths follow the
  new names.
- RBAC/hooks/templates/webhooks/CSI patches/docs/tests: group string updated.
- Foundation-private annotation/label/finalizer key domains migrated to
  storage-foundation.deckhouse.io/.

Cross-module boundaries preserved:
- SnapshotContent (owned by state-snapshotter) keeps state-snapshotter.deckhouse.io
  in the data-export resolver GVR, its RBAC, and CRD docs.
- The StorageClass annotation storage.deckhouse.io/volumesnapshotclass (written by
  sds-local-volume) stays on storage.deckhouse.io as an external contract.
- snapshot.storage.k8s.io (CSI) and virtualization.deckhouse.io untouched.

Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
Add an optional UID to DataArtifactReference (symmetric with
VolumeCaptureRequest's status.dataRef.artifact.uid) and carry it through
DataImport. Also fixes a wave1 regression: volumeCaptureArtifact still read
the removed plural status.dataRefs slice; switch it to the single
status.dataRef map (VCR is one target per request after wave1), so the
DataImport artifact resolves again.

Signed-off-by: Aleksandr Zimin <alexandr.zimin@flant.com>
@AleksZimin AleksZimin self-assigned this Jul 4, 2026
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.

1 participant