Skip to content

Commit 038d92c

Browse files
committed
Update VolumeSnapshot CRD version to v1beta
1 parent 1454b6e commit 038d92c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+642
-292
lines changed

cmd/csi-snapshotter/create_crd.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package main
1616
import (
1717
"reflect"
1818

19-
crdv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1alpha1"
19+
crdv1 "github.com/kubernetes-csi/external-snapshotter/pkg/apis/volumesnapshot/v1beta1"
2020
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
2121
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
2222
apierrors "k8s.io/apimachinery/pkg/api/errors"

cmd/csi-snapshotter/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ func main() {
185185
snapClient,
186186
kubeClient,
187187
*snapshotterName,
188-
factory.Snapshot().V1alpha1().VolumeSnapshots(),
189-
factory.Snapshot().V1alpha1().VolumeSnapshotContents(),
190-
factory.Snapshot().V1alpha1().VolumeSnapshotClasses(),
188+
factory.Snapshot().V1beta1().VolumeSnapshots(),
189+
factory.Snapshot().V1beta1().VolumeSnapshotContents(),
190+
factory.Snapshot().V1beta1().VolumeSnapshotClasses(),
191191
coreFactory.Core().V1().PersistentVolumeClaims(),
192192
*createSnapshotContentRetryCount,
193193
*createSnapshotContentInterval,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
---
3+
apiVersion: apiextensions.k8s.io/v1beta1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
creationTimestamp: null
7+
name: volumesnapshotclasses.snapshot.storage.k8s.io
8+
spec:
9+
group: snapshot.storage.k8s.io
10+
names:
11+
kind: VolumeSnapshotClass
12+
plural: volumesnapshotclasses
13+
scope: ""
14+
version: v1beta1
15+
versions:
16+
- name: v1beta1
17+
schema:
18+
openAPIV3Schema:
19+
description: VolumeSnapshotClass describes the parameters used by storage
20+
system when provisioning VolumeSnapshots from PVCs. The name of a VolumeSnapshotClass
21+
object is significant, and is how users can request a particular class.
22+
properties:
23+
apiVersion:
24+
description: 'APIVersion defines the versioned schema of this representation
25+
of an object. Servers should convert recognized schemas to the latest
26+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
27+
type: string
28+
deletionPolicy:
29+
description: 'Optional: what happens to a snapshot content when released
30+
from its snapshot. The default policy is Delete if not specified.'
31+
type: string
32+
kind:
33+
description: 'Kind is a string value representing the REST resource this
34+
object represents. Servers may infer this from the endpoint the client
35+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
36+
type: string
37+
metadata:
38+
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata'
39+
type: object
40+
parameters:
41+
additionalProperties:
42+
type: string
43+
description: Parameters holds parameters for the snapshotter. These values
44+
are opaque to the system and are passed directly to the snapshotter.
45+
type: object
46+
snapshotter:
47+
description: Snapshotter is the driver expected to handle this VolumeSnapshotClass.
48+
type: string
49+
required:
50+
- snapshotter
51+
type: object
52+
served: true
53+
storage: true
54+
status:
55+
acceptedNames:
56+
kind: ""
57+
plural: ""
58+
conditions: []
59+
storedVersions: []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
2+
---
3+
apiVersion: apiextensions.k8s.io/v1beta1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
creationTimestamp: null
7+
name: volumesnapshotcontents.snapshot.storage.k8s.io
8+
spec:
9+
group: snapshot.storage.k8s.io
10+
names:
11+
kind: VolumeSnapshotContent
12+
plural: volumesnapshotcontents
13+
scope: ""
14+
version: v1beta1
15+
versions:
16+
- name: v1beta1
17+
schema:
18+
openAPIV3Schema:
19+
description: VolumeSnapshotContent represents the actual "on-disk" snapshot
20+
object
21+
properties:
22+
apiVersion:
23+
description: 'APIVersion defines the versioned schema of this representation
24+
of an object. Servers should convert recognized schemas to the latest
25+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
26+
type: string
27+
kind:
28+
description: 'Kind is a string value representing the REST resource this
29+
object represents. Servers may infer this from the endpoint the client
30+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
31+
type: string
32+
metadata:
33+
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata'
34+
type: object
35+
spec:
36+
description: Spec represents the desired state of the snapshot content
37+
properties:
38+
csiVolumeSnapshotSource:
39+
description: CSI (Container Storage Interface) represents storage
40+
that handled by an external CSI Volume Driver (Alpha feature).
41+
properties:
42+
creationTime:
43+
description: Timestamp when the point-in-time snapshot is taken
44+
on the storage system. This timestamp will be generated by the
45+
CSI volume driver after the snapshot is cut. The format of this
46+
field should be a Unix nanoseconds time encoded as an int64.
47+
On Unix, the command `date +%s%N` returns the current time
48+
in nanoseconds since 1970-01-01 00:00:00 UTC. This field is
49+
required in the CSI spec but optional here to support static
50+
binding.
51+
format: int64
52+
type: integer
53+
driver:
54+
description: Driver is the name of the driver to use for this
55+
snapshot. This MUST be the same name returned by the CSI GetPluginName()
56+
call for that driver. Required.
57+
type: string
58+
restoreSize:
59+
description: When restoring volume from the snapshot, the volume
60+
size should be equal to or larger than the RestoreSize if it
61+
is specified. If RestoreSize is set to nil, it means that the
62+
storage plugin does not have this information available.
63+
format: int64
64+
type: integer
65+
snapshotHandle:
66+
description: SnapshotHandle is the unique snapshot id returned
67+
by the CSI volume plugin’s CreateSnapshot to refer to the snapshot
68+
on all subsequent calls. Required.
69+
type: string
70+
required:
71+
- driver
72+
- snapshotHandle
73+
type: object
74+
deletionPolicy:
75+
description: 'Optional: what happens to a snapshot content when released
76+
from its snapshot. It will be set to Delete by default if not specified'
77+
type: string
78+
persistentVolumeRef:
79+
description: PersistentVolumeRef represents the PersistentVolume that
80+
the snapshot has been taken from. It becomes non-nil when VolumeSnapshot
81+
and VolumeSnapshotContent are bound.
82+
properties:
83+
apiVersion:
84+
description: API version of the referent.
85+
type: string
86+
fieldPath:
87+
description: 'If referring to a piece of an object instead of
88+
an entire object, this string should contain a valid JSON/Go
89+
field access statement, such as desiredState.manifest.containers[2].
90+
For example, if the object reference is to a container within
91+
a pod, this would take on a value like: "spec.containers{name}"
92+
(where "name" refers to the name of the container that triggered
93+
the event) or if no container name is specified "spec.containers[2]"
94+
(container with index 2 in this pod). This syntax is chosen
95+
only to have some well-defined way of referencing a part of
96+
an object. TODO: this design is not final and this field is
97+
subject to change in the future.'
98+
type: string
99+
kind:
100+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
101+
type: string
102+
name:
103+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
104+
type: string
105+
namespace:
106+
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
107+
type: string
108+
resourceVersion:
109+
description: 'Specific resourceVersion to which this reference
110+
is made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency'
111+
type: string
112+
uid:
113+
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
114+
type: string
115+
type: object
116+
snapshotClassName:
117+
description: Name of the VolumeSnapshotClass used by the VolumeSnapshot.
118+
If not specified, a default snapshot class will be used if it is
119+
available.
120+
type: string
121+
volumeSnapshotRef:
122+
description: VolumeSnapshotRef is part of bi-directional binding between
123+
VolumeSnapshot and VolumeSnapshotContent. It becomes non-nil when
124+
bound.
125+
properties:
126+
apiVersion:
127+
description: API version of the referent.
128+
type: string
129+
fieldPath:
130+
description: 'If referring to a piece of an object instead of
131+
an entire object, this string should contain a valid JSON/Go
132+
field access statement, such as desiredState.manifest.containers[2].
133+
For example, if the object reference is to a container within
134+
a pod, this would take on a value like: "spec.containers{name}"
135+
(where "name" refers to the name of the container that triggered
136+
the event) or if no container name is specified "spec.containers[2]"
137+
(container with index 2 in this pod). This syntax is chosen
138+
only to have some well-defined way of referencing a part of
139+
an object. TODO: this design is not final and this field is
140+
subject to change in the future.'
141+
type: string
142+
kind:
143+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
144+
type: string
145+
name:
146+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
147+
type: string
148+
namespace:
149+
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
150+
type: string
151+
resourceVersion:
152+
description: 'Specific resourceVersion to which this reference
153+
is made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency'
154+
type: string
155+
uid:
156+
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
157+
type: string
158+
type: object
159+
type: object
160+
required:
161+
- spec
162+
type: object
163+
served: true
164+
storage: true
165+
status:
166+
acceptedNames:
167+
kind: ""
168+
plural: ""
169+
conditions: []
170+
storedVersions: []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
2+
---
3+
apiVersion: apiextensions.k8s.io/v1beta1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
creationTimestamp: null
7+
name: volumesnapshots.snapshot.storage.k8s.io
8+
spec:
9+
group: snapshot.storage.k8s.io
10+
names:
11+
kind: VolumeSnapshot
12+
plural: volumesnapshots
13+
scope: ""
14+
version: v1beta1
15+
versions:
16+
- name: v1beta1
17+
schema:
18+
openAPIV3Schema:
19+
description: VolumeSnapshot is a user's request for taking a snapshot. Upon
20+
successful creation of the actual snapshot by the volume provider it is
21+
bound to the corresponding VolumeSnapshotContent. Only the VolumeSnapshot
22+
object is accessible to the user in the namespace.
23+
properties:
24+
apiVersion:
25+
description: 'APIVersion defines the versioned schema of this representation
26+
of an object. Servers should convert recognized schemas to the latest
27+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
28+
type: string
29+
kind:
30+
description: 'Kind is a string value representing the REST resource this
31+
object represents. Servers may infer this from the endpoint the client
32+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
33+
type: string
34+
metadata:
35+
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata'
36+
type: object
37+
spec:
38+
description: Spec defines the desired characteristics of a snapshot requested
39+
by a user.
40+
properties:
41+
snapshotClassName:
42+
description: Name of the VolumeSnapshotClass used by the VolumeSnapshot.
43+
If not specified, a default snapshot class will be used if it is
44+
available.
45+
type: string
46+
snapshotContentName:
47+
description: SnapshotContentName binds the VolumeSnapshot object with
48+
the VolumeSnapshotContent
49+
type: string
50+
source:
51+
description: Source has the information about where the snapshot is
52+
created from. In Alpha version, only PersistentVolumeClaim is supported
53+
as the source. If not specified, user can create VolumeSnapshotContent
54+
and bind it with VolumeSnapshot manually.
55+
properties:
56+
apiGroup:
57+
description: APIGroup is the group for the resource being referenced.
58+
If APIGroup is not specified, the specified Kind must be in
59+
the core API group. For any other third-party types, APIGroup
60+
is required.
61+
type: string
62+
kind:
63+
description: Kind is the type of resource being referenced
64+
type: string
65+
name:
66+
description: Name is the name of resource being referenced
67+
type: string
68+
required:
69+
- kind
70+
- name
71+
type: object
72+
type: object
73+
status:
74+
description: Status represents the latest observed state of the snapshot
75+
properties:
76+
creationTime:
77+
description: CreationTime is the time the snapshot was successfully
78+
created. If it is set, it means the snapshot was created; Otherwise
79+
the snapshot was not created.
80+
format: date-time
81+
type: string
82+
error:
83+
description: The last error encountered during create snapshot operation,
84+
if any. This field must only be set by the entity completing the
85+
create snapshot operation, i.e. the external-snapshotter.
86+
properties:
87+
message:
88+
description: String detailing the error encountered during Attach
89+
or Detach operation. This string may be logged, so it should
90+
not contain sensitive information.
91+
type: string
92+
time:
93+
description: Time the error was encountered.
94+
format: date-time
95+
type: string
96+
type: object
97+
readyToUse:
98+
description: ReadyToUse is set to true only if the snapshot is ready
99+
to use (e.g., finish uploading if there is an uploading phase) and
100+
also VolumeSnapshot and its VolumeSnapshotContent bind correctly
101+
with each other. If any of the above condition is not true, ReadyToUse
102+
is set to false
103+
type: boolean
104+
restoreSize:
105+
description: When restoring volume from the snapshot, the volume size
106+
should be equal to or larger than the RestoreSize if it is specified.
107+
If RestoreSize is set to nil, it means that the storage plugin does
108+
not have this information available.
109+
type: string
110+
type: object
111+
required:
112+
- spec
113+
type: object
114+
served: true
115+
storage: true
116+
status:
117+
acceptedNames:
118+
kind: ""
119+
plural: ""
120+
conditions: []
121+
storedVersions: []

hack/update-generated-code.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge
2929
# instead of the $GOPATH directly. For normal projects this can be dropped.
3030
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
3131
github.com/kubernetes-csi/external-snapshotter/pkg/client github.com/kubernetes-csi/external-snapshotter/pkg/apis \
32-
volumesnapshot:v1alpha1 \
32+
volumesnapshot:v1beta1 \
3333
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt
3434

3535
# To use your own boilerplate text use:

pkg/apis/volumesnapshot/v1alpha1/doc.go renamed to pkg/apis/volumesnapshot/v1beta1/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ limitations under the License.
1717
// +k8s:deepcopy-gen=package
1818
// +groupName=snapshot.storage.k8s.io
1919

20-
package v1alpha1
20+
package v1beta1

0 commit comments

Comments
 (0)