Skip to content

Import existing, externally created snapshot into cluster #131

@stiller-leser

Description

@stiller-leser

Hi everybody,

I have started playing around with snapshotting. My usecase is to import an existing snapshot into the cluster (it has been created externaly, not from a pv in the cluster). My current attempt with these two configurations fails with the snapshot source is not specified when creating the VolumeSnapshot:

apiVersion: snapshot.storage.k8s.io/v1alpha1
kind: VolumeSnapshotContent
metadata:
  name: my-own-snapshot-content
  namespace: default
spec:
  csiVolumeSnapshotSource:
    driver: pd.csi.storage.gke.io
    snapshotHandle: projects/my-project/global/snapshots/my-snapshot
  deletionPolicy: Retain
  volumeSnapshotRef:
    kind: VolumeSnapshot
    name: my-own-snapshot-source-pvc
    namespace: default
apiVersion: snapshot.storage.k8s.io/v1alpha1
kind: VolumeSnapshot
metadata:
  name: my-own-snapshot-source-pvc
  namespace: default
spec:
  snapshotClassName: default-snapshot-class
  snapshotContentName: my-own-snapshot-content

( taken from this blog post )

Looking at this code it seems logical.

However, reading through the spec it says for the VolumeSnapshot struct:

// Source has the information about where the snapshot is created from.
// In Alpha version, only PersistentVolumeClaim is supported as the source.
// If not specified, user can create VolumeSnapshotContent and bind it with VolumeSnapshot manually.

This is the part that is confusing me, because the last comment describes what I am trying to do above. I assumed that the PVC created from the referenced VolumeSnapshot could be created from the snapshotHandle defined in the VolumeSnapshotContent. Instead, it seems I need to define an existing PVC in the VolumeSnapshot.

Will my approach become possible in the future (i.e. currently not yet possible, since this is an alpha feature) or is this usecase not intended at all? If not, how else could I do it in Kubernetes (it would of course be possible using the cloud provider sdk).

Best regards,
stiller-leser

P.S. This is related to this question: kubernetes-sigs/gcp-compute-persistent-disk-csi-driver#224

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions