Skip to content

Commit

Permalink
final adjustment on types.go based on feedback
Browse files Browse the repository at this point in the history
rename variable names in comments to follow OpenAPIV3Schema, enforces namespaced or cluster
comments update
  • Loading branch information
yuxiangqian committed Aug 27, 2019
1 parent 9b86d7c commit 060446d
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 215 deletions.
39 changes: 21 additions & 18 deletions config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,33 @@ spec:
names:
kind: VolumeSnapshotClass
plural: volumesnapshotclasses
scope: ""
scope: Cluster
validation:
openAPIV3Schema:
description: VolumeSnapshotClass describes the parameters for a class of storage
snapshotter for which VolumeSnapshot can be dynamically taken for a given
PersistentVolumeClaim VolumeSnapshotClasses are non-namespaced. The name of
a VolumeSnapshotClass object is significant, it serves as the unique identifier
for a user to request a snapshot to be created using the specific VolumeSnapshotClass
description: VolumeSnapshotClass specifies parameters that a underlying storage
system uses when creating a volume snapshot. A specific VolumeSnapshotClass
is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses
are non-namespaced
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
deletionPolicy:
description: DeletionPolicy defines whether a VolumeSnapshotContent and
its associated physical snapshot on underlying storage system should be
deleted or not when released from its corresponding VolumeSnapshot. If
not specified, the default will be VolumeSnapshotContentRetain for static
binding, and VolumeSnapshotContentDelete for dynamic snapshot creation.
description: deletionPolicy determines whether a VolumeSnapshotContent created
through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot
is deleted. Supported values are "Retain" and "Delete". "Retain" means
that the VolumeSnapshotContent and its physical snapshot on underlying
storage system are kept. "Delete" means that the VolumeSnapshotContent
and its physical snapshot on underlying storage system are deleted. If
not specified, the default value is "Delete"
enum:
- Delete
- Retain
type: string
driver:
description: driver is the name of the driver that handles this VolumeSnapshotClass.
type: string
kind:
description: 'Kind is a string value representing the REST resource this
Expand All @@ -42,15 +49,11 @@ spec:
parameters:
additionalProperties:
type: string
description: Parameters holds parameters for underlying storage system.
These values are opaque to Kubernetes.
description: parameters is a key-value map with storage driver specific
parameters for creating snapshots. These values are opaque to Kubernetes.
type: object
snapshotter:
description: Snapshotter is the name of the driver expected to handle VolumeSnapshot
requests of this VolumeSnapshotClass.
type: string
required:
- snapshotter
- driver
type: object
version: v1beta1
versions:
Expand Down
114 changes: 39 additions & 75 deletions config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
names:
kind: VolumeSnapshotContent
plural: volumesnapshotcontents
scope: ""
scope: Cluster
validation:
openAPIV3Schema:
description: VolumeSnapshotContent represents the actual "on-disk" snapshot
Expand All @@ -30,100 +30,64 @@ spec:
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata'
type: object
spec:
description: Spec represents the desired state of the snapshot content
description: spec defines properties of a VolumeSnapshotContent created
by underlying storage system.
properties:
csiVolumeSnapshotSource:
description: CSI (Container Storage Interface) represents storage that
handled by an external CSI Volume Driver (Alpha feature).
description: csiVolumeSnapshotSource represents a volume snapshot created
by a CSI(Container Storage Interface) driver.
properties:
creationTime:
description: Timestamp when the point-in-time snapshot is taken
by the underlying storage system. This timestamp will be generated
and returned by the CSI volume driver after the snapshot is cut.
The format of this field is a Unix nanoseconds time encoded as
an int64. On Unix, the command `date +%s%N` returns the current
time in nanoseconds (aka, epoch time) since 1970-01-01 00:00:00
UTC. This field is required in the CSI spec however made optional
here to support static binding.
description: creationTime is the timestamp when the point-in-time
snapshot is taken by the underlying storage system. This timestamp
is returned by the CSI driver after the snapshot is cut. The format
of this field is a Unix nanoseconds time encoded as an int64.
On Unix, the command `date +%s%N` returns the current time in
nanoseconds (aka, epoch time) since 1970-01-01 00:00:00 UTC.
format: int64
type: integer
driver:
description: Driver is the name of the driver used to create a physical
snapshot on underlying storage system. This MUST be the same name
returned by the CSI GetPluginName() call for that driver. Required.
description: driver is the name of the CSI driver used to create
the physical snapshot on the underlying storage system. This MUST
be the same name returned by the CSI GetPluginName() call for
that driver. Required.
type: string
restoreSize:
description: When restoring a volume from a snapshot, the volume
size needs to be equal to or larger than the RestoreSize if it
is specified. If RestoreSize is set to nil, in the dynamic snapshot
creation case, it means that the underlying storage system does
not have this information available; in the static binding case,
this piece of information is not available.
description: restoreSize specifies the number of bytes that the
snapshot's data would consume when restored to a volume. When
restoring a volume from a snapshot, the volume size needs to be
equal to or larger than the RestoreSize if it is specified.
format: int64
type: integer
snapshotHandle:
description: SnapshotHandle is the unique id returned from the underlying
storage system by the CSI driver's CreationSnapshot gRPC call.
It serves as the only and sufficient handle when communicating
with underlying storage systems via CSI driver for all subsequent
calls on the specific VolumeSnapshot Required.
description: snapshotHandle is the snapshot id returned by the CSI
driver in the CreateSnapshotResponse and is used as the snapshot
identifier for all subsequent CSI calls. Required.
type: string
required:
- driver
- snapshotHandle
type: object
deletionPolicy:
description: DeletionPolicy defines whether a VolumeSnapshotContent
and its associated physical snapshot on underlying storage system
should be deleted or not when released from its corresponding VolumeSnapshot.
If not specified, the default will be VolumeSnapshotContentRetain
for static binding, and VolumeSnapshotContentDelete for dynamic snapshot
creation.
description: deletionPolicy determines whether this VolumeSnapshotContent
and its bound physical snapshot on the underlying storage system should
be deleted when its VolumeSnapshot is deleted. Supported values are
"Retain" and "Delete". "Retain" means that the VolumeSnapshotContent
and its physical snapshot on underlying storage system are kept. "Delete"
means that the VolumeSnapshotContent and its physical snapshot on
underlying storage system are deleted. If not specified, the default
value is "Retain"
enum:
- Delete
- Retain
type: string
persistentVolumeRef:
description: PersistentVolumeRef represents the PersistentVolume that
the snapshot has been taken from. In dynamic snapshot creation case,
the field will be specified when VolumeSnapshot and VolumeSnapshotContent
are bound.
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of an
entire object, this string should contain a valid JSON/Go field
access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen only
to have some well-defined way of referencing a part of an object.
TODO: this design is not final and this field is subject to change
in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference is
made, if any. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
volumeSnapshotRef:
description: VolumeSnapshotRef is part of bi-directional binding between
VolumeSnapshot and VolumeSnapshotContent. Expect to be non-nil when
bound. VolumeSnapshot.VolumeSnapshotContentName is the authoritative
bind between VolumeSnapshot and VolumeSnapshotContent
description: volumeSnapshotRef specifies the VolumeSnapshot object that
this VolumeSnapshotContent is bound with. The VolumeSnapshot.Spec.VolumeSnapshotContentName
field must reference this VolumeSnapshotContent name for the binding
to be considered valid(a.k.a bi-directional binding). If the referenced
VolumeSnapshot object does not exist(i.e., deleted by user), then
the VolumeSnapshotContent.Spec.DeletionPolicy is triggered.
properties:
apiVersion:
description: API version of the referent.
Expand Down
Loading

0 comments on commit 060446d

Please sign in to comment.