Skip to content

Commit 7663113

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

5 files changed

+117
-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

+38-7
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,52 @@ 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 VolumeSnapshotContent is ready to be used.
15+
name: ReadyToUse
16+
type: boolean
17+
- JSONPath: .status.restoreSize
18+
description: Represents the complete size of the VolumeSnapshotContent in bytes
19+
name: RestoreSize
20+
type: integer
21+
- JSONPath: .spec.deletionPolicy
22+
description: Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass
23+
should be deleted when its bound VolumeSnapshot is deleted.
24+
name: DeletionPolicy
25+
type: string
26+
- JSONPath: .spec.driver
27+
description: Name of the CSI driver used to create the physical snapshot on the
28+
underlying storage system.
29+
name: Driver
30+
type: string
31+
- JSONPath: .spec.volumeSnapshotClassName
32+
description: Name of the VolumeSnapshotClass to which this snapshot belongs.
33+
name: VolumeSnapshotClass
34+
type: string
35+
- JSONPath: .spec.volumeSnapshotRef.name
36+
description: The VolumeSnapshot object to which this VolumeSnapshotContent object
37+
is bound.
38+
name: VolumeSnapshot
39+
type: string
40+
- JSONPath: .metadata.creationTimestamp
41+
name: Age
42+
type: date
1243
group: snapshot.storage.k8s.io
1344
names:
1445
kind: VolumeSnapshotContent
1546
listKind: VolumeSnapshotContentList
1647
plural: volumesnapshotcontents
1748
singular: volumesnapshotcontent
49+
preserveUnknownFields: false
1850
scope: Cluster
1951
subresources:
2052
status: {}
21-
preserveUnknownFields: false
2253
validation:
2354
openAPIV3Schema:
2455
description: VolumeSnapshotContent represents the actual "on-disk" snapshot
@@ -27,12 +58,12 @@ spec:
2758
apiVersion:
2859
description: 'APIVersion defines the versioned schema of this representation
2960
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'
61+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
3162
type: string
3263
kind:
3364
description: 'Kind is a string value representing the REST resource this
3465
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'
66+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
3667
type: string
3768
spec:
3869
description: spec defines properties of a VolumeSnapshotContent created
@@ -104,7 +135,7 @@ spec:
104135
in the future.'
105136
type: string
106137
kind:
107-
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
138+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
108139
type: string
109140
name:
110141
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
@@ -114,7 +145,7 @@ spec:
114145
type: string
115146
resourceVersion:
116147
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'
148+
made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
118149
type: string
119150
uid:
120151
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

+42-6
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: 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: The PVC from where a dynamically taken snapshot will be created.
19+
name: SourcePVC
20+
type: string
21+
- JSONPath: .spec.source.volumeSnapshotContentName
22+
description: The VolumeSnapshotContent from where a snapshot will be created.
23+
name: SourceSnapshotContent
24+
type: string
25+
- JSONPath: .status.restoreSize
26+
description: Represents the complete size of the snapshot in bytes.
27+
name: RestoreSize
28+
type: string
29+
- JSONPath: .spec.volumeSnapshotClassName
30+
description: The name of the VolumeSnapshotClass requested by the VolumeSnapshot.
31+
name: SnapshotClass
32+
type: string
33+
- JSONPath: .status.boundVolumeSnapshotContentName
34+
description: The name of the VolumeSnapshotContent to which this VolumeSnapshot
35+
is bound.
36+
name: SnapshotContent
37+
type: string
38+
- JSONPath: .status.creationTime
39+
name: CreationTime
40+
type: date
41+
- JSONPath: .metadata.creationTimestamp
42+
name: Age
43+
type: date
1244
group: snapshot.storage.k8s.io
1345
names:
1446
kind: VolumeSnapshot
1547
listKind: VolumeSnapshotList
1648
plural: volumesnapshots
1749
singular: volumesnapshot
50+
preserveUnknownFields: false
1851
scope: Namespaced
1952
subresources:
2053
status: {}
21-
preserveUnknownFields: false
2254
validation:
2355
openAPIV3Schema:
2456
description: VolumeSnapshot is a user's request for either creating a point-in-time
@@ -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 the desired characteristics of a snapshot requested
@@ -121,6 +153,9 @@ spec:
121153
of a snapshot is unknown.
122154
type: boolean
123155
restoreSize:
156+
anyOf:
157+
- type: integer
158+
- type: string
124159
description: restoreSize represents the complete size of the snapshot
125160
in bytes. In dynamic snapshot creation case, this field will be filled
126161
in with the "size_bytes" value returned from CSI "CreateSnapshotRequest"
@@ -130,7 +165,8 @@ spec:
130165
this snapshot, the size of the volume MUST NOT be smaller than the
131166
restoreSize if it is specified, otherwise the restoration will fail.
132167
If not specified, it indicates that the size is unknown.
133-
type: string
168+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
169+
x-kubernetes-int-or-string: true
134170
type: object
135171
required:
136172
- 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="The PVC from where a dynamically taken snapshot will be created."
36+
// +kubebuilder:printcolumn:name="SourceSnapshotContent",type=string,JSONPath=`.spec.source.volumeSnapshotContentName`,description="The VolumeSnapshotContent from where a snapshot will be created."
37+
// +kubebuilder:printcolumn:name="RestoreSize",type=string,JSONPath=`.status.restoreSize`,description="Represents the complete size of the snapshot in bytes."
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`
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 VolumeSnapshotContent is ready to be used."
227+
// +kubebuilder:printcolumn:name="RestoreSize",type=integer,JSONPath=`.status.restoreSize`,description="Represents the complete size of the VolumeSnapshotContent in bytes"
228+
// +kubebuilder:printcolumn:name="DeletionPolicy",type=string,JSONPath=`.spec.deletionPolicy`,description="Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass 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="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)