-
Notifications
You must be signed in to change notification settings - Fork 376
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 VolumeGroupSnapshot to v1beta1 #1150
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: leonardoce The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cc xing-yang |
c3d17b0
to
6592941
Compare
I rebased this PR and added a commit to add and set the new field Thank you! cc: @xing-yang |
4f5aa74
to
e72f89f
Compare
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.
LGTM
@leonardoce We discussed this PR during today's CSI Implementation meeting. @jsafrane suggested that we break this PR into two PRs.
|
Ok. I'll close it and file the one to add the new field |
|
/draft |
#1169 has been merged - can we merge this PR now? |
@leonardoce can I know why this PR is in draft? I think we were good on this part? |
Hi @yati1998. |
e72f89f
to
a920081
Compare
a920081
to
2849922
Compare
Can you please rebase? |
d0b046e
to
06003b4
Compare
client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml
Outdated
Show resolved
Hide resolved
@gnufied can you please review this as well? |
@@ -1,5 +1,5 @@ | |||
--- | |||
apiVersion: groupsnapshot.storage.k8s.io/v1alpha1 | |||
apiVersion: groupsnapshot.storage.k8s.io/v1beta1 |
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.
Hi! If you are referring to app.kubernetes.io/name: postgresql
, that's just the selector this example uses to get the PVC list. I don't think we need to change it 👍
@leonardoce Please ignore my comments:) |
We should compile this branch rebased with master and then run e2e tests in a loop for sometime. I have often done this for testing pre-release code which needs more testing. This will give us greater confidence about this feature. This does not require making a release. |
977bca6
to
a834ee5
Compare
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and | |||
limitations under the License. | |||
*/ | |||
// +kubebuilder:object:generate=true | |||
package v1alpha1 |
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.
Why is VolumeGroupSnapshot.Status.CreationTime
--> metav1.Time
and why is VolumeGroupSnapshotContentStatus.CreationTime
--> int64 ?
I know that change was not introduced in this PR, but since we are moving this to beta, we have to be careful about all the decisions we make.
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.
The same is happening with independent VolumeSnapshots:
CreationTime *metav1.Time `json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"` |
vs:
CreationTime *int64 `json:"creationTime,omitempty" protobuf:"varint,2,opt,name=creationTime"` |
The content object looks more directly related to the GRPC CSI call.
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.
This is how it is displayed in CLI (via kubectl
) then:
creationTime: "2024-11-22T22:14:35Z"
creationTime: 1732313675689050917
@xing-yang can you confirm if this intentional? This doesn't seem right.
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.
We can always convert int64
to metav1.Time
so as this is nicely handled by k8s tooling. I am not sure if this has to be int64...
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.
In CSI spec, the timestamp is .google.protobuf.Timestamp which represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. So in VolumeSnapshotContent and VolumeGroupSnapshotContent, it is a direct mapping to what is returned from the CSI driver.
VolumeSnapshot and VolumeGroupSnapshot are in user namespace, we try to show them nicely in the readable format of metav1.Time
.
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.
VolumeSnapshotContent and VolumeGroupSnapshotContent are admin API objects. We don't need to show them in user readable format. I think they should stay true to the original values returned by the CSI driver.
Since we've already made a decision for this in VolumeSnapshotContent, it also looks inconsistent now if we are showing them differently in VolumeGroupSnapshotContent.
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.
Having time represented as int64
imo causes unnecessary indirection for person reading the output of kubectl
.
status:
creationTime: 1732377314333256450
readyToUse: true
volumeGroupSnapshotHandle: 53e1f6ce-a9b3-11ef-adf7-88c9b3b05f70
volumeSnapshotHandlePairList:
- snapshotHandle: 53e1f6e0-a9b3-11ef-adf7-88c9b3b05f70
volumeHandle: 4711d50d-a9b3-11ef-adf7-88c9b3b05f70
I understand we made this decision for volumesnapshotcontent
already, but this seems like making one bad choice to cover another. I could be wrong of course, @jsafrane @msau42 what do you think?
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.
Since VolumeSnapshot and VolumeGroupSnapshot already have timestamps shown in user readable format, my preference is to keep the timestamps in VolumeSnapshotContent and VolumeGroupSnapshotContent the same as what is returned by the CSI driver as they are admin facing, but let's see what @jsafrane and @msau42 think.
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.
@leonardoce can you please update the comments with the highlighted text?
type VolumeGroupSnapshotStatus struct {
..........
// CreationTime is the timestamp when the point-in-time group snapshot is taken
// by the underlying storage system.
// If not specified, it may indicate that the creation time of the group snapshot
// is unknown.
// 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
// since 1970-01-01 00:00:00 UTC.
// This field is updated based on the CreationTime field in VolumeGroupSnapshotContentStatus
// +optional
CreationTime *metav1.Time json:"creationTime,omitempty" protobuf:"bytes,2,opt,name=creationTime"
type VolumeGroupSnapshotContentStatus struct {
..........
// CreationTime is the timestamp when the point-in-time group snapshot is taken
// by the underlying storage system.
// If not specified, it indicates the creation time is unknown.
// If not specified, it means the readiness of a group snapshot is unknown.
// 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
// since 1970-01-01 00:00:00 UTC.
// This field is the source for the CreationTime field in VolumeGroupSnapshotStatus
// +optional
CreationTime *int64 json:"creationTime,omitempty" protobuf:"varint,2,opt,name=creationTime"
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 improved the comments @xing-yang.
I noticed that following field in
Should this be immutable after creation? |
This field is in the Status. Are we supposed to make fields in Status immutable? We have not done that for VolumeSnapshot APIs. |
011ceb7
to
a475473
Compare
It would have been nice to have. But not a blocker I think. |
// VolumeSnapshotContentRef is a reference to the volume snapshot content resource | ||
VolumeSnapshotContentRef core_v1.LocalObjectReference `json:"volumeSnapshotContentRef,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotContentRef"` | ||
} | ||
|
||
// VolumeGroupSnapshotContentSource represents the CSI source of a group snapshot. |
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.
Not visible in PR - Can VolumeHandle
and SnapshotHandle
inside VolumeSnapshotHandlePair
be empty? Or they both have to be specified. I didn't see these fields marked as required
and neither see any validation kinda logic preventing saving of these fields without any values. Correct me if I missed something.
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.
VolumeSnapshotHandlePair itself is not required, but if a VolumeSnapshotHandlePair is specified, then both VolumeHandle and SnapshotHandle should be required. Otherwise, it is not very useful.
We can add CEL for them.
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.
We can add CEL for them.
Yeah we should IMO.
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.
@leonardoce Can you make changes to make VolumeHandle and SnapshotHandle required in VolumeSnapshotHandlePair?
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.
Sure! I think it's better to file a different PR for that and keep this as a giant substitution. If we use this PR to review the API, it will become really difficult to rebase.
Is that fine with you @gnufied ?
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.
The main reason I wanted all API changes in same PR is, so as we don't have to do follow up API fixes.
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.
@gnufied I see both fields are already marked as required (meaning they are not optional) in the CRD.
See:
external-snapshotter/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml
Lines 290 to 312 in b79aef9
volumeSnapshotHandlePairList: | |
description: |- | |
VolumeSnapshotHandlePairList is a list of CSI "volume_id" and "snapshot_id" | |
pair returned by the CSI driver to identify snapshots and their source volumes | |
on the storage system. | |
items: | |
description: VolumeSnapshotHandlePair defines a pair of a source | |
volume handle and a snapshot handle | |
properties: | |
snapshotHandle: | |
description: |- | |
SnapshotHandle is a unique id returned by the CSI driver to identify a volume | |
snapshot on the storage system | |
type: string | |
volumeHandle: | |
description: |- | |
VolumeHandle is a unique id returned by the CSI driver to identify a volume | |
on the storage system | |
type: string | |
required: | |
- snapshotHandle | |
- volumeHandle | |
type: object |
Do you still need me to add some CEL rules for them? 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.
That should be sufficient. The API server will reject it if VolumeHandle or SnapshotHandle is not set in VolumeSnapshotHandlePair.
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.
Can you add "// Required." as comments for both VolumeHandle and SnapshotHandle in types.go?
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 did it and rebased the PR too.
a475473
to
7ceb7bb
Compare
@gnufied @xing @leonardoce i have tested this PR + #1219 https://jenkins-ceph-csi.apps.ocp.cloud.ci.centos.org/blue/organizations/jenkins/mini-e2e_k8s-1.31/detail/mini-e2e_k8s-1.31/201/pipeline/ ceph/ceph-csi#4974 (we already have framework for volumegroupsnapshot) This is what it does
Repeat the above in a loop of 20 , let me know if you guys wants me to test anything else? |
f866a51
to
529df83
Compare
529df83
to
24e5a53
Compare
What type of PR is this?
/kind api-change
What this PR does / why we need it:
Update the definition of CRDs to move VolumeGroupSnapshot, VolumeGroupSnapshotContent, and VolumeGroupSnapshotClass from v1alpha1 to v1beta1.
cc: @xing-yang
Which issue(s) this PR fixes:
Fixes #1119
Special notes for your reviewer:
This PR entirely removes the capability to serve the
v1alpha
version. Existing clients will be broken.This is consistent with the relative PR comment and the related Kubernetes documentation.
The underlying structure of
v1alpha
andv1beta1
is consistent.Does this PR introduce a user-facing change?: