Skip to content

Commit

Permalink
Address Vivek's feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Sim <[email protected]>
  • Loading branch information
ihcsim committed Mar 15, 2022
1 parent 3f1d5c4 commit 94d1fe5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
34 changes: 18 additions & 16 deletions docs/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1335,13 +1335,14 @@ Example:
CreateCSISnapshotStatic
-----------------------

This function creates a pair of CSI VolumeSnapshot and VolumeSnapshotContent.
It is commonly used to pre-provision snapshot volume and snapshot volume content
resources as described in the Kubernetes `documentation
<https://kubernetes.io/docs/concepts/storage/volume-snapshots/#static>`_.
This function creates a pair of CSI ``VolumeSnapshot`` and
``VolumeSnapshotContent`` resources. It assumes the underlying *real* storage
volume snapshot already exists. The deletion behavior is defined by the
``deletionPolicy`` property (``Retain``, ``Delete``) of the snapshot class.

The deletion behavior is defined by the ``deletionPolicy`` property (``Retain``,
``Delete``) of the snapshot class.
For more information on pre-provisioned volume snapshots, see the Kubernetes
`documentation
<https://kubernetes.io/docs/concepts/storage/volume-snapshots/#static>`_.

Arguments:

Expand All @@ -1350,11 +1351,11 @@ Arguments:
:align: left
:widths: 5,5,5,15

`name`, Yes, `string`, name of the new VolumeSnapshot
`namespace`, Yes, `string`, namespace of the new VolumeSnapshot
`driver`, Yes, `string`, name of the CSI driver for the new VolumeSnapshotContent
`handle`, Yes, `string`, unique identifier of the volume created on the storage backend used as the source of the new VolumeSnapshotContent
`snapshotClass`, Yes, `string`, name of the VolumeSnapshotClass to use
`name`, Yes, `string`, name of the new CSI ``VolumeSnapshot``
`namespace`, Yes, `string`, namespace of the new CSI ``VolumeSnapshot``
`driver`, Yes, `string`, name of the CSI driver for the new CSI ``VolumeSnapshotContent``
`handle`, Yes, `string`, unique identifier of the volume snapshot created on the storage backend used as the source of the new ``VolumeSnapshotContent``
`snapshotClass`, Yes, `string`, name of the ``VolumeSnapshotClass`` to use

Outputs:

Expand All @@ -1363,10 +1364,10 @@ Outputs:
:align: left
:widths: 5,5,15

`name`,`string`, name of the new VolumeSnapshot
`namespace`, string, namespace of the new VolumeSnapshot
`name`,`string`, name of the new CSI ``VolumeSnapshot``
`namespace`, string, namespace of the new CSI ``VolumeSnapshot``
`restoreSize`, string, required memory size to restore the volume
`snapshotContent`, string, name of the new VolumeSnapshotContent
`snapshotContent`, string, name of the new CSI ``VolumeSnapshotContent``

Example:

Expand All @@ -1380,9 +1381,10 @@ Example:
name: createCSISnapshotStatic
args:
name: volume-snapshot
namespace: namespace
namespace: default
snapshotClass: csi-hostpath-snapclass
driver: 7bdd0de3-aaeb-11e8-9aae-0242ac110002
driver: hostpath.csi.k8s.io
handle: 7bdd0de3-aaeb-11e8-9aae-0242ac110002
RestoreCSISnapshot
------------------
Expand Down
5 changes: 0 additions & 5 deletions pkg/function/create_csi_snapshot_static.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"context"

v1 "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
"github.com/pkg/errors"

kanister "github.com/kanisterio/kanister/pkg"
"github.com/kanisterio/kanister/pkg/kube"
Expand Down Expand Up @@ -104,10 +103,6 @@ func (*createCSISnapshotStaticFunc) Exec(ctx context.Context, tp param.TemplateP

snapshotter, err := snapshot.NewSnapshotter(kubeCli, dynCli)
if err != nil {
if errors.Is(context.DeadlineExceeded, err) {
timeoutMsg := "SnapshotContent not provisioned within given timeout. Please check if CSI driver is installed correctly and supports VolumeSnapshot feature"
return nil, errors.Wrap(err, timeoutMsg)
}
return nil, err
}

Expand Down

0 comments on commit 94d1fe5

Please sign in to comment.