-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update VolumeSnapshot CRD version to v1beta #139
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
|
||
--- | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: (devel) | ||
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/139" | ||
creationTimestamp: null | ||
name: volumesnapshotclasses.snapshot.storage.k8s.io | ||
spec: | ||
group: snapshot.storage.k8s.io | ||
names: | ||
kind: VolumeSnapshotClass | ||
listKind: VolumeSnapshotClassList | ||
plural: volumesnapshotclasses | ||
singular: volumesnapshotclass | ||
scope: Cluster | ||
preserveUnknownFields: false | ||
validation: | ||
msau42 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
openAPIV3Schema: | ||
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 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. Required. | ||
enum: | ||
- Delete | ||
- Retain | ||
type: string | ||
driver: | ||
description: driver is the name of the storage driver that handles this | ||
VolumeSnapshotClass. Required. | ||
type: string | ||
msau42 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' | ||
type: string | ||
parameters: | ||
additionalProperties: | ||
type: string | ||
description: parameters is a key-value map with storage driver specific | ||
parameters for creating snapshots. These values are opaque to Kubernetes. | ||
type: object | ||
msau42 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
required: | ||
- deletionPolicy | ||
- driver | ||
type: object | ||
version: v1beta1 | ||
versions: | ||
- name: v1beta1 | ||
served: true | ||
storage: true | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: [] | ||
storedVersions: [] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would strongly recommend setting
preserveUnknownFields: false
and making sure these CRDs are structural (creating it and checking status doesn't show a non-structural condition). That will ensure they are well-positioned to work with the v1 CRD APIThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, since this is an official k8s.io-suffixed API, add an
api-approved.kubernetes.io
annotation containing a URL to the PR/Issue where the API is approved (see https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/20190612-crd-group-protection.md#summary for details). That can be this PR if this is the canonical home for this API.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are pending issues like this to be resolved if kubebuilder is used. As the schemas in this PR are generated using controller-gen, I manually removed metadata field from validation to make crd valid for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an automatic way to validate that this schema is structural with v1beta? Or should we test it out as v1 to verify that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I am wrong @msau42, you were asking to check whether the schema is valid with v1beta?
If that's your question, I have conducted manual tests on 3 different k8s versions, 1.14/1.15/1.16, all seems to be fine. v1 CRD API is stable in k8s 1.16. I have not tested using v1 though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean to test that this v1beta1 schema is compatible with v1. Can we temporarily convert this to v1 and try it on a 1.16 cluster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've double verified the schemas could be seamlessly converted to v1 in a 1.16 cluster with following output.
k get crd volumesnapshotclasses.snapshot.storage.k8s.io -o yaml
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
api-approved.kubernetes.io: #139
controller-gen.kubebuilder.io/version: (devel)
creationTimestamp: "2019-10-24T20:37:44Z"
generation: 1
name: volumesnapshotclasses.snapshot.storage.k8s.io
resourceVersion: "1238"
selfLink: /apis/apiextensions.k8s.io/v1/customresourcedefinitions/volumesnapshotclasses.snapshot.storage.k8s.io
uid: 524ff8f2-b783-46d4-953f-60a6fd3c32af
spec:
conversion:
strategy: None
group: snapshot.storage.k8s.io
names:
kind: VolumeSnapshotClass
listKind: VolumeSnapshotClassList
plural: volumesnapshotclasses
singular: volumesnapshotclass
scope: Cluster
versions:
schema:
openAPIV3Schema:
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status:
status:
acceptedNames:
kind: VolumeSnapshotContent
listKind: VolumeSnapshotContentList
plural: volumesnapshotcontents
singular: volumesnapshotcontent
conditions:
message: no conflicts found
reason: NoConflicts
status: "True"
type: NamesAccepted
message: the initial names have been accepted
reason: InitialNamesAccepted
status: "True"
type: Established
message: approved in Update VolumeSnapshot CRD version to v1beta #139
reason: ApprovedAnnotation
status: "True"
type: KubernetesAPIApprovalPolicyConformant
storedVersions: