Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import existing, externally created snapshot into cluster #131

Closed
stiller-leser opened this issue Jun 28, 2019 · 5 comments
Closed

Import existing, externally created snapshot into cluster #131

stiller-leser opened this issue Jun 28, 2019 · 5 comments

Comments

@stiller-leser
Copy link

stiller-leser commented Jun 28, 2019

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

@msau42
Copy link
Collaborator

msau42 commented Jul 2, 2019

Importing existing snapshot should be possible. It needs more documentation and testing though.
cc @xing-yang @jingxu97

@nrb
Copy link
Contributor

nrb commented Jul 2, 2019

If you're using GKE, I saw this too. It appears to be fixed in v1.1.0 of csi-snapshotter, but GKE's driver currently comes with v1.0.1. See #94

@msau42
Copy link
Collaborator

msau42 commented Jul 2, 2019

fyi, tracking issue to update snapshotter in pd csi driver: kubernetes-sigs/gcp-compute-persistent-disk-csi-driver#321

@xing-yang
Copy link
Collaborator

@stiller-leser The comment "If not specified, user can create VolumeSnapshotContent and bind it with VolumeSnapshot manually" means you can dynamically create a VolumeSnapshot using an already existing snapshot resource. It does not mean you need to define an existing PVC in VolumeSnapshot.

Can you try v1.1.0 or later of csi-snapshotter as suggested by @nrb? Looks like you need to wait for a fix in the PD CSI driver before testing that.

@stiller-leser
Copy link
Author

Hi everybody,

you rock! Thank you for getting back to me so quickly - this is awesome. Thanks to the pointer of @nrb I was able to see that I was using an old version of the snapshotter. Updated it and it works 👍

Also @xing-yang - I must have misread this then. Guess that happens if you play around way above your K8s knowledge ;) - Thank you for the explanation!

pohly added a commit to pohly/external-snapshotter that referenced this issue Jan 26, 2021
1d60e77 Merge pull request kubernetes-csi#131 from pohly/kubernetes-1.20-tag
9f10459 prow.sh: support building Kubernetes for a specific version
fe1f284 Merge pull request kubernetes-csi#121 from kvaps/namespace-check
8fdf0f7 Merge pull request kubernetes-csi#128 from fengzixu/master
1c94220 fix: fix a bug of csi-sanity
a4c41e6 Merge pull request kubernetes-csi#127 from pohly/fix-boilerplate
ece0f50 check namespace for snapshot-controller
dbd8967 verify-boilerplate.sh: fix path to script
9289fd1 Merge pull request kubernetes-csi#125 from sachinkumarsingh092/optional-spelling-boilerplate-checks
ad29307 Make the spelling and boilerplate checks optional
5f06d02 Merge pull request kubernetes-csi#124 from sachinkumarsingh092/fix-spellcheck-boilerplate-tests
48186eb Fix spelling and boilerplate errors
71690af Merge pull request kubernetes-csi#122 from sachinkumarsingh092/include-spellcheck-boilerplate-tests
981be3f Adding spelling and boilerplate checks.
2bb7525 Merge pull request kubernetes-csi#117 from fengzixu/master
4ab8b15 use the tag to replace commit of csi-test
5d74e45 change the csi-test import path to v4
7dcd0a9 upgrade csi-test to v4.0.2

git-subtree-dir: release-tools
git-subtree-split: 1d60e77
ggriffiths pushed a commit to ggriffiths/external-snapshotter that referenced this issue Apr 15, 2021
bc0504a Merge pull request kubernetes-csi#140 from jsafrane/remove-unused-k8s-libs
5b1de1a go-get-kubernetes.sh: remove unused k8s libs
49b4269 Merge pull request kubernetes-csi#120 from pohly/add-kubernetes-release
a1e1127 Merge pull request kubernetes-csi#139 from pohly/kind-for-kubernetes-latest
1c0fb09 prow.sh: use KinD main for latest Kubernetes
1d77cfc Merge pull request kubernetes-csi#138 from pohly/kind-update-0.10
bff2fb7 prow.sh: KinD 0.10.0
95eac33 Merge pull request kubernetes-csi#137 from pohly/fix-go-version-check
437e431 verify-go-version.sh: fix check after removal of travis.yml
1748b16 Merge pull request kubernetes-csi#136 from pohly/go-1.16
ec844ea remove travis.yml, Go 1.16
df76aba Merge pull request kubernetes-csi#134 from andyzhangx/add-build-arg
e314a56 add build-arg ARCH for building multi-arch images, e.g. ARG ARCH FROM k8s.gcr.io/build-image/debian-base-${ARCH}:v2.1.3
7bc70e5 Merge pull request kubernetes-csi#129 from pohly/squash-documentation
e0b02e7 README.md: document usage of --squash
316cb95 Merge pull request kubernetes-csi#132 from yiyang5055/bugfix/boilerplate
26e2ab1 fix: default boilerplate path
1add8c1 Merge pull request kubernetes-csi#133 from pohly/kubernetes-1.20-tag
3e811d6 prow.sh: fix "on-master" prow jobs
1d60e77 Merge pull request kubernetes-csi#131 from pohly/kubernetes-1.20-tag
9f10459 prow.sh: support building Kubernetes for a specific version
f7e7ee4 docs: steps for adding testing against new Kubernetes release
fe1f284 Merge pull request kubernetes-csi#121 from kvaps/namespace-check
8fdf0f7 Merge pull request kubernetes-csi#128 from fengzixu/master
1c94220 fix: fix a bug of csi-sanity
a4c41e6 Merge pull request kubernetes-csi#127 from pohly/fix-boilerplate
ece0f50 check namespace for snapshot-controller
dbd8967 verify-boilerplate.sh: fix path to script
9289fd1 Merge pull request kubernetes-csi#125 from sachinkumarsingh092/optional-spelling-boilerplate-checks
ad29307 Make the spelling and boilerplate checks optional
5f06d02 Merge pull request kubernetes-csi#124 from sachinkumarsingh092/fix-spellcheck-boilerplate-tests
48186eb Fix spelling and boilerplate errors
71690af Merge pull request kubernetes-csi#122 from sachinkumarsingh092/include-spellcheck-boilerplate-tests
981be3f Adding spelling and boilerplate checks.
2bb7525 Merge pull request kubernetes-csi#117 from fengzixu/master
4ab8b15 use the tag to replace commit of csi-test
5d74e45 change the csi-test import path to v4
7dcd0a9 upgrade csi-test to v4.0.2

git-subtree-dir: release-tools
git-subtree-split: bc0504a
xing-yang pushed a commit to xing-yang/external-snapshotter that referenced this issue Jul 26, 2021
prow.sh: support building Kubernetes for a specific version
dobsonj pushed a commit to dobsonj/external-snapshotter that referenced this issue Dec 13, 2023
…ncy-openshift-4.16-ose-csi-external-snapshotter

OCPBUGS-25052: Updating ose-csi-external-snapshotter-container image to be consistent with ART
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

No branches or pull requests

4 participants