kubernetes-csi / external-snapshotter

Sidecar container that watches Kubernetes Snapshot CRD objects and triggers CreateSnapshot/DeleteSnapshot against a CSI endpoint.
Apache License 2.0
490 stars 371 forks source link

VolumeGroupSnapshot static provisioning not working #1153

Open jmccormick2001 opened 2 months ago

jmccormick2001 commented 2 months ago

What happened:

I'm creating a static provisioning test for a VolumeGroupSnapshot, I'm getting errors when I create the VolumeGroupSnapshot when it refers to a statically provisioned VolumeGroupSnapshotContent. The error on the VolumeGroupSnapshot is as follows:

apiVersion: groupsnapshot.storage.k8s.io/v1alpha1
kind: VolumeGroupSnapshot
metadata:
  creationTimestamp: "2024-09-06T20:15:22Z"
  generation: 1
  name: mygroup-groupsnapshot-static
  namespace: infinidat-csi
  resourceVersion: "1041067"
  uid: cd3a727b-8520-4f4b-af7a-447f46224958
spec:
  source:
    volumeGroupSnapshotContentName: statically-created-content
  volumeGroupSnapshotClassName: infinibox-groupsnapclass
status:
  error:
    message: 'GroupSnapshot failed to bind VolumeGroupSnapshotContent, VolumeGroupSnapshotContent.groupsnapshot.storage.k8s.io
      "statically-created-content" is invalid: spec.volumeGroupSnapshotRef: Invalid
      value: "object": volumeGroupSnapshotRef is immutable'
    time: "2024-09-06T20:15:22Z"
  readyToUse: false

I was able to create the VolumeGroupSnapshotContent as folllows:

apiVersion: groupsnapshot.storage.k8s.io/v1alpha1
kind: VolumeGroupSnapshotContent
metadata:
  annotations:
    groupsnapshot.storage.kubernetes.io/deletion-secret-name: infinibox-creds
    groupsnapshot.storage.kubernetes.io/deletion-secret-namespace: infinidat-csi
  name: statically-created-content
spec:
  deletionPolicy: Delete
  driver: infinibox-csi-driver
  source:
    groupSnapshotHandles:
      volumeGroupSnapshotHandle: "138869243" 
      volumeSnapshotHandles:
      - 138869241$$iscsi 
  volumeGroupSnapshotClassName: infinibox-groupsnapclass
  volumeGroupSnapshotRef:
    apiVersion: groupsnapshot.storage.k8s.io/v1alpha1
    kind: VolumeGroupSnapshot
    name: mygroup-groupsnapshot-static
    namespace: infinidat-csi

I tried creating the VolumeGroupSnapshotContent without the volumeGroupSnapshotRef but it will not let me, it gives this error:

15:11:51 ~/infinidat-csi-driver/deploy/examples/volumegroup/static (CSIC-763*) $ kubectl create -f content-example.yaml
The VolumeGroupSnapshotContent "statically-created-content" is invalid: spec.volumeGroupSnapshotRef: Invalid value: "object": both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace must be set

15:11:56 ~/infinidat-csi-driver/deploy/examples/volumegroup/static (CSIC-763*) $ vi content-example.yaml

15:12:31 ~/infinidat-csi-driver/deploy/examples/volumegroup/static (CSIC-763*) $ kubectl create -f content-example.yaml
The VolumeGroupSnapshotContent "statically-created-content" is invalid: 
* spec.volumeGroupSnapshotRef: Required value
* <nil>: Invalid value: "null": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation

What you expected to happen:

I expected the VolumeGroupSnapshot to create as normal, binding to the VolumeGroupSnapshotContent.

How to reproduce it:

Static provision a VolumeGroupSnapshotContent, then try to create a VolumeGroupSnapshot based on that content.

Anything else we need to know?:

Environment:

xing-yang commented 2 months ago

Can you provide "kubectl get volumegroupsnapshotcontent statically-created-content -o yaml"?

jmccormick2001 commented 2 months ago
apiVersion: groupsnapshot.storage.k8s.io/v1alpha1
kind: VolumeGroupSnapshotContent
metadata:
  annotations:
    groupsnapshot.storage.kubernetes.io/deletion-secret-name: infinibox-creds
    groupsnapshot.storage.kubernetes.io/deletion-secret-namespace: infinidat-csi
  creationTimestamp: "2024-09-06T20:13:27Z"
  generation: 1
  name: statically-created-content
  resourceVersion: "1041007"
  uid: d117dc6b-e84a-4ae5-887a-7a893b750ddc
spec:
  deletionPolicy: Delete
  driver: infinibox-csi-driver
  source:
    groupSnapshotHandles:
      volumeGroupSnapshotHandle: "138869243"
      volumeSnapshotHandles:
      - 138869241$$iscsi
  volumeGroupSnapshotClassName: infinibox-groupsnapclass
  volumeGroupSnapshotRef:
    apiVersion: groupsnapshot.storage.k8s.io/v1alpha1
    kind: VolumeGroupSnapshot
    name: mygroup-groupsnapshot-static
    namespace: infinidat-csi
status:
  creationTime: 1725653607991052659
  readyToUse: true
  volumeGroupSnapshotHandle: "138869243"
xing-yang commented 2 months ago

Who set the Status of VolumeGroupSnapshotContent? Is it by the Group Snapshot Controller or did you have some other controller logic that did it? Since the status is already "readyToUse", it seems that VolumeGroupSnapshot mygroup-groupsnapshot-static already exists?

Please provide logs from snapshot-controller and csi-snapshotter.

jmccormick2001 commented 2 months ago

let me verify that I'm attempting this in the right sequence: Here is what I'm trying:

Is this the correct sequence I should follow? just want to confirm this is the sequence. I'll send logs on Monday. I 'think' the status is getting set by the snapshot-controller but can verify with the logs.

jmccormick2001 commented 2 months ago

snapshot controller and side car logs attached. snapshot-controller.log snapshotter.log

nixpanic commented 1 day ago

@yati1998 and I tested static provisioning with #1184 applied (currently merged in the master branch), and with that we can statically provision a VolumeGroupSnapshotContent and bind it with a VolumeGroupSnapshot without validation errors.

yati1998 commented 22 hours ago

Here are the steps to be followed: