Draft
Conversation
Contributor
Reviewer's GuideIntroduce optional volume snapshot–based provisioning for HTTP data sources and VirtualDisk creation when the annotation 'virtualization.deckhouse.io/use-volume-snapshot' is set, including snapshot lifecycle management and PVC creation from snapshots. Sequence diagram for VirtualDisk creation using VolumeSnapshotsequenceDiagram
participant VD as VirtualDisk Controller
participant VI as VirtualImage
participant VS as VolumeSnapshot
participant PVC as PersistentVolumeClaim
participant K8s as Kubernetes API
VD->>VI: Check for 'use-volume-snapshot' annotation
alt Annotation present
VD->>VI: Fetch VirtualImage
VI->>VS: Fetch VolumeSnapshot (by PVC name)
alt VolumeSnapshot not found
VI->>VS: Create VolumeSnapshot
VI->>VD: Requeue until snapshot ready
else VolumeSnapshot found
VI->>VS: Check ReadyToUse status
alt Not ready
VI->>VD: Requeue until snapshot ready
else Ready
VD->>PVC: Create PVC from VolumeSnapshot
PVC->>K8s: Request PVC creation
K8s-->>PVC: PVC created
end
end
else Annotation not present
VD->>PVC: Standard PVC creation flow
end
Class diagram for CreatePVCFromVSStep and related typesclassDiagram
class CreatePVCFromVSStep {
- pvc: PersistentVolumeClaim
- client: Client
- cb: ConditionBuilder
+ Take(ctx, vd): (*reconcile.Result, error)
+ buildPVC(vd, vs): *PersistentVolumeClaim
+ addOriginalMetadata(vd, vs)
}
class VirtualDisk {
+ Annotations: map[string]string
+ Labels: map[string]string
+ Status: VirtualDiskStatus
+ Spec: VirtualDiskSpec
}
class VolumeSnapshot {
+ Status: VolumeSnapshotStatus
+ Annotations: map[string]string
}
class PersistentVolumeClaim {
+ Name: string
+ Namespace: string
+ OwnerReferences: []OwnerReference
+ Spec: PersistentVolumeClaimSpec
}
CreatePVCFromVSStep --> VirtualDisk
CreatePVCFromVSStep --> VolumeSnapshot
CreatePVCFromVSStep --> PersistentVolumeClaim
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- The CreateVolumeSnapshot method’s bound-state check seems reversed (it errors when PVC is Bound) – flip the condition or message to only snapshot after PVC is Bound.
- There are many scattered checks for the use-volume-snapshot annotation; extract this into a shared helper/constant to reduce duplication and improve maintainability.
- Guard against nil on vs.Status or ReadyToUse pointer (the && check can panic and should treat nil as not ready) to prevent dereference errors.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The CreateVolumeSnapshot method’s bound-state check seems reversed (it errors when PVC is Bound) – flip the condition or message to only snapshot after PVC is Bound.
- There are many scattered checks for the use-volume-snapshot annotation; extract this into a shared helper/constant to reduce duplication and improve maintainability.
- Guard against nil on vs.Status or ReadyToUse pointer (the && check can panic and should treat nil as not ready) to prevent dereference errors.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
dfcbfe0 to
05c28fb
Compare
Signed-off-by: Isteb4k <dmitry.rakitin@flant.com>
Signed-off-by: Isteb4k <dmitry.rakitin@flant.com>
05c28fb to
2ba1f4c
Compare
nevermarine
pushed a commit
that referenced
this pull request
Oct 27, 2025
Signed-off-by: Isteb4k <dmitry.rakitin@flant.com> Signed-off-by: Maksim Fedotov <maksim.fedotov@flant.com> feat(vd): create pvc using volume snapshot Signed-off-by: Isteb4k <dmitry.rakitin@flant.com> Signed-off-by: Maksim Fedotov <maksim.fedotov@flant.com>
danilrwx
pushed a commit
that referenced
this pull request
Oct 30, 2025
Signed-off-by: Isteb4k <dmitry.rakitin@flant.com> Signed-off-by: Maksim Fedotov <maksim.fedotov@flant.com> feat(vd): create pvc using volume snapshot Signed-off-by: Isteb4k <dmitry.rakitin@flant.com> Signed-off-by: Maksim Fedotov <maksim.fedotov@flant.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description