Skip to content

Commit c3beea5

Browse files
committed
Update CRDs to include additional get information
1 parent 883842f commit c3beea5

5 files changed

+122
-19
lines changed

config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml

+18-5
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,32 @@ apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: (devel)
8-
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/139"
7+
controller-gen.kubebuilder.io/version: v0.2.5
8+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/260"
99
creationTimestamp: null
1010
name: volumesnapshotclasses.snapshot.storage.k8s.io
1111
spec:
12+
additionalPrinterColumns:
13+
- JSONPath: .driver
14+
name: Driver
15+
type: string
16+
- JSONPath: .deletionPolicy
17+
description: Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass
18+
should be deleted when its bound VolumeSnapshot is deleted.
19+
name: DeletionPolicy
20+
type: string
21+
- JSONPath: .metadata.creationTimestamp
22+
name: Age
23+
type: date
1224
group: snapshot.storage.k8s.io
1325
names:
1426
kind: VolumeSnapshotClass
1527
listKind: VolumeSnapshotClassList
1628
plural: volumesnapshotclasses
1729
singular: volumesnapshotclass
18-
scope: Cluster
1930
preserveUnknownFields: false
31+
scope: Cluster
32+
subresources: {}
2033
validation:
2134
openAPIV3Schema:
2235
description: VolumeSnapshotClass specifies parameters that a underlying storage
@@ -27,7 +40,7 @@ spec:
2740
apiVersion:
2841
description: 'APIVersion defines the versioned schema of this representation
2942
of an object. Servers should convert recognized schemas to the latest
30-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
43+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
3144
type: string
3245
deletionPolicy:
3346
description: deletionPolicy determines whether a VolumeSnapshotContent created
@@ -47,7 +60,7 @@ spec:
4760
kind:
4861
description: 'Kind is a string value representing the REST resource this
4962
object represents. Servers may infer this from the endpoint the client
50-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
63+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
5164
type: string
5265
parameters:
5366
additionalProperties:

config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml

+39-7
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,53 @@ apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: (devel)
8-
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/139"
7+
controller-gen.kubebuilder.io/version: v0.2.5
8+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/260"
99
creationTimestamp: null
1010
name: volumesnapshotcontents.snapshot.storage.k8s.io
1111
spec:
12+
additionalPrinterColumns:
13+
- JSONPath: .status.readyToUse
14+
description: Indicates if a snapshot is ready to be used to restore a volume.
15+
name: ReadyToUse
16+
type: boolean
17+
- JSONPath: .status.restoreSize
18+
description: Represents the complete size of the snapshot in bytes
19+
name: RestoreSize
20+
type: integer
21+
- JSONPath: .spec.deletionPolicy
22+
description: Determines whether this VolumeSnapshotContent and its physical snapshot
23+
on the underlying storage system should be deleted when its bound VolumeSnapshot
24+
is deleted.
25+
name: DeletionPolicy
26+
type: string
27+
- JSONPath: .spec.driver
28+
description: Name of the CSI driver used to create the physical snapshot on the
29+
underlying storage system.
30+
name: Driver
31+
type: string
32+
- JSONPath: .spec.volumeSnapshotClassName
33+
description: Name of the VolumeSnapshotClass to which this snapshot belongs.
34+
name: VolumeSnapshotClass
35+
type: string
36+
- JSONPath: .spec.volumeSnapshotRef.name
37+
description: Name of the VolumeSnapshot object to which this VolumeSnapshotContent
38+
object is bound.
39+
name: VolumeSnapshot
40+
type: string
41+
- JSONPath: .metadata.creationTimestamp
42+
name: Age
43+
type: date
1244
group: snapshot.storage.k8s.io
1345
names:
1446
kind: VolumeSnapshotContent
1547
listKind: VolumeSnapshotContentList
1648
plural: volumesnapshotcontents
1749
singular: volumesnapshotcontent
50+
preserveUnknownFields: false
1851
scope: Cluster
1952
subresources:
2053
status: {}
21-
preserveUnknownFields: false
2254
validation:
2355
openAPIV3Schema:
2456
description: VolumeSnapshotContent represents the actual "on-disk" snapshot
@@ -27,12 +59,12 @@ spec:
2759
apiVersion:
2860
description: 'APIVersion defines the versioned schema of this representation
2961
of an object. Servers should convert recognized schemas to the latest
30-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
62+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
3163
type: string
3264
kind:
3365
description: 'Kind is a string value representing the REST resource this
3466
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'
67+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
3668
type: string
3769
spec:
3870
description: spec defines properties of a VolumeSnapshotContent created
@@ -104,7 +136,7 @@ spec:
104136
in the future.'
105137
type: string
106138
kind:
107-
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
139+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
108140
type: string
109141
name:
110142
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
@@ -114,7 +146,7 @@ spec:
114146
type: string
115147
resourceVersion:
116148
description: 'Specific resourceVersion to which this reference is
117-
made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency'
149+
made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
118150
type: string
119151
uid:
120152
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'

config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml

+46-6
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,57 @@ apiVersion: apiextensions.k8s.io/v1beta1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
7-
controller-gen.kubebuilder.io/version: (devel)
8-
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/139"
7+
controller-gen.kubebuilder.io/version: v0.2.5
8+
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/260"
99
creationTimestamp: null
1010
name: volumesnapshots.snapshot.storage.k8s.io
1111
spec:
12+
additionalPrinterColumns:
13+
- JSONPath: .status.readyToUse
14+
description: Indicates if a snapshot is ready to be used to restore a volume.
15+
name: ReadyToUse
16+
type: boolean
17+
- JSONPath: .spec.source.persistentVolumeClaimName
18+
description: Name of the source PVC from where a dynamically taken snapshot will
19+
be created.
20+
name: SourcePVC
21+
type: string
22+
- JSONPath: .spec.source.volumeSnapshotContentName
23+
description: Name of the VolumeSnapshotContent which represents a pre-provisioned
24+
snapshot.
25+
name: SourceSnapshotContent
26+
type: string
27+
- JSONPath: .status.restoreSize
28+
description: Represents the complete size of the snapshot.
29+
name: RestoreSize
30+
type: string
31+
- JSONPath: .spec.volumeSnapshotClassName
32+
description: The name of the VolumeSnapshotClass requested by the VolumeSnapshot.
33+
name: SnapshotClass
34+
type: string
35+
- JSONPath: .status.boundVolumeSnapshotContentName
36+
description: The name of the VolumeSnapshotContent to which this VolumeSnapshot
37+
is bound.
38+
name: SnapshotContent
39+
type: string
40+
- JSONPath: .status.creationTime
41+
description: Timestamp when the point-in-time snapshot is taken by the underlying
42+
storage system.
43+
name: CreationTime
44+
type: date
45+
- JSONPath: .metadata.creationTimestamp
46+
name: Age
47+
type: date
1248
group: snapshot.storage.k8s.io
1349
names:
1450
kind: VolumeSnapshot
1551
listKind: VolumeSnapshotList
1652
plural: volumesnapshots
1753
singular: volumesnapshot
54+
preserveUnknownFields: false
1855
scope: Namespaced
1956
subresources:
2057
status: {}
21-
preserveUnknownFields: false
2258
validation:
2359
openAPIV3Schema:
2460
description: VolumeSnapshot is a user's request for either creating a point-in-time
@@ -27,12 +63,12 @@ spec:
2763
apiVersion:
2864
description: 'APIVersion defines the versioned schema of this representation
2965
of an object. Servers should convert recognized schemas to the latest
30-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
66+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
3167
type: string
3268
kind:
3369
description: 'Kind is a string value representing the REST resource this
3470
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'
71+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
3672
type: string
3773
spec:
3874
description: 'spec defines the desired characteristics of a snapshot requested
@@ -121,6 +157,9 @@ spec:
121157
of a snapshot is unknown.
122158
type: boolean
123159
restoreSize:
160+
anyOf:
161+
- type: integer
162+
- type: string
124163
description: restoreSize represents the complete size of the snapshot
125164
in bytes. In dynamic snapshot creation case, this field will be filled
126165
in with the "size_bytes" value returned from CSI "CreateSnapshotRequest"
@@ -130,7 +169,8 @@ spec:
130169
this snapshot, the size of the volume MUST NOT be smaller than the
131170
restoreSize if it is specified, otherwise the restoration will fail.
132171
If not specified, it indicates that the size is unknown.
133-
type: string
172+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
173+
x-kubernetes-int-or-string: true
134174
type: object
135175
required:
136176
- spec

hack/update-crd.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ then
2626
TMP_DIR=$(mktemp -d);
2727
cd $TMP_DIR;
2828
go mod init tmp;
29-
go get sigs.k8s.io/controller-tools/cmd/[email protected].4;
29+
go get sigs.k8s.io/controller-tools/cmd/[email protected].5;
3030
rm -rf $TMP_DIR;
3131
CONTROLLER_GEN=$(which controller-gen)
3232
fi

pkg/apis/volumesnapshot/v1beta1/types.go

+18
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ import (
3131
// +kubebuilder:object:root=true
3232
// +kubebuilder:resource:scope=Namespaced
3333
// +kubebuilder:subresource:status
34+
// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if a snapshot is ready to be used to restore a volume."
35+
// +kubebuilder:printcolumn:name="SourcePVC",type=string,JSONPath=`.spec.source.persistentVolumeClaimName`,description="Name of the source PVC from where a dynamically taken snapshot will be created."
36+
// +kubebuilder:printcolumn:name="SourceSnapshotContent",type=string,JSONPath=`.spec.source.volumeSnapshotContentName`,description="Name of the VolumeSnapshotContent which represents a pre-provisioned snapshot."
37+
// +kubebuilder:printcolumn:name="RestoreSize",type=string,JSONPath=`.status.restoreSize`,description="Represents the complete size of the snapshot."
38+
// +kubebuilder:printcolumn:name="SnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="The name of the VolumeSnapshotClass requested by the VolumeSnapshot."
39+
// +kubebuilder:printcolumn:name="SnapshotContent",type=string,JSONPath=`.status.boundVolumeSnapshotContentName`,description="The name of the VolumeSnapshotContent to which this VolumeSnapshot is bound."
40+
// +kubebuilder:printcolumn:name="CreationTime",type=date,JSONPath=`.status.creationTime`,description="Timestamp when the point-in-time snapshot is taken by the underlying storage system."
41+
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
3442
type VolumeSnapshot struct {
3543
metav1.TypeMeta `json:",inline"`
3644
// Standard object's metadata.
@@ -163,6 +171,9 @@ type VolumeSnapshotStatus struct {
163171
// VolumeSnapshotClasses are non-namespaced
164172
// +kubebuilder:object:root=true
165173
// +kubebuilder:resource:scope=Cluster
174+
// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.driver`
175+
// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.deletionPolicy`,description="Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted."
176+
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
166177
type VolumeSnapshotClass struct {
167178
metav1.TypeMeta `json:",inline"`
168179
// Standard object's metadata.
@@ -212,6 +223,13 @@ type VolumeSnapshotClassList struct {
212223
// +kubebuilder:object:root=true
213224
// +kubebuilder:resource:scope=Cluster
214225
// +kubebuilder:subresource:status
226+
// +kubebuilder:printcolumn:name="ReadyToUse",type=boolean,JSONPath=`.status.readyToUse`,description="Indicates if a snapshot is ready to be used to restore a volume."
227+
// +kubebuilder:printcolumn:name="RestoreSize",type=integer,JSONPath=`.status.restoreSize`,description="Represents the complete size of the snapshot in bytes"
228+
// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.spec.deletionPolicy`,description="Determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted."
229+
// +kubebuilder:printcolumn:name="Driver",type=string,JSONPath=`.spec.driver`,description="Name of the CSI driver used to create the physical snapshot on the underlying storage system."
230+
// +kubebuilder:printcolumn:name="VolumeSnapshotClass",type=string,JSONPath=`.spec.volumeSnapshotClassName`,description="Name of the VolumeSnapshotClass to which this snapshot belongs."
231+
// +kubebuilder:printcolumn:name="VolumeSnapshot",type=string,JSONPath=`.spec.volumeSnapshotRef.name`,description="Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound."
232+
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
215233
type VolumeSnapshotContent struct {
216234
metav1.TypeMeta `json:",inline"`
217235
// Standard object's metadata.

0 commit comments

Comments
 (0)