-
Notifications
You must be signed in to change notification settings - Fork 382
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
Changes from all commits
57560c1
58bae80
341ac4c
42b9deb
2c63f95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and | |||||||||||||||||||||||||||||||||||||||||||||||
limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||||||||||||
// +kubebuilder:object:generate=true | ||||||||||||||||||||||||||||||||||||||||||||||||
package v1alpha1 | ||||||||||||||||||||||||||||||||||||||||||||||||
package v1beta1 | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
leonardoce marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||
import ( | ||||||||||||||||||||||||||||||||||||||||||||||||
core_v1 "k8s.io/api/core/v1" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -90,6 +90,7 @@ type VolumeGroupSnapshotStatus struct { | |||||||||||||||||||||||||||||||||||||||||||||||
// 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"` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -110,15 +111,6 @@ type VolumeGroupSnapshotStatus struct { | |||||||||||||||||||||||||||||||||||||||||||||||
Error *snapshotv1.VolumeSnapshotError `json:"error,omitempty" protobuf:"bytes,4,opt,name=error,casttype=VolumeSnapshotError"` | ||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
// PVCVolumeSnapshotPair defines a pair of a PVC reference and a Volume Snapshot Reference | ||||||||||||||||||||||||||||||||||||||||||||||||
type PVCVolumeSnapshotPair struct { | ||||||||||||||||||||||||||||||||||||||||||||||||
// PersistentVolumeClaimRef is a reference to the PVC this pair is referring to | ||||||||||||||||||||||||||||||||||||||||||||||||
PersistentVolumeClaimRef core_v1.LocalObjectReference `json:"persistentVolumeClaimRef,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeClaimRef"` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
// VolumeSnapshotRef is a reference to the VolumeSnapshot this pair is referring to | ||||||||||||||||||||||||||||||||||||||||||||||||
VolumeSnapshotRef core_v1.LocalObjectReference `json:"volumeSnapshotRef,omitempty" protobuf:"bytes,2,opt,name=volumeSnapshotRef"` | ||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
//+genclient | ||||||||||||||||||||||||||||||||||||||||||||||||
//+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -333,6 +325,7 @@ type VolumeGroupSnapshotContentStatus struct { | |||||||||||||||||||||||||||||||||||||||||||||||
// 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"` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -354,16 +347,6 @@ type VolumeGroupSnapshotContentStatus struct { | |||||||||||||||||||||||||||||||||||||||||||||||
VolumeSnapshotHandlePairList []VolumeSnapshotHandlePair `json:"volumeSnapshotHandlePairList,omitempty" protobuf:"bytes,6,opt,name=volumeSnapshotHandlePairList"` | ||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
// PVVolumeSnapshotContentPair represent a pair of PV names and | ||||||||||||||||||||||||||||||||||||||||||||||||
// VolumeSnapshotContent names | ||||||||||||||||||||||||||||||||||||||||||||||||
type PVVolumeSnapshotContentPair struct { | ||||||||||||||||||||||||||||||||||||||||||||||||
// PersistentVolumeRef is a reference to the persistent volume resource | ||||||||||||||||||||||||||||||||||||||||||||||||
PersistentVolumeRef core_v1.LocalObjectReference `json:"persistentVolumeRef,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeRef"` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
// 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 commentThe reason will be displayed to describe this comment to others. Learn more. Not visible in PR - Can There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah we should IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 commentThe 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. external-snapshotter/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml Lines 290 to 312 in b79aef9
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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I did it and rebased the PR too. |
||||||||||||||||||||||||||||||||||||||||||||||||
// Exactly one of its members must be set. | ||||||||||||||||||||||||||||||||||||||||||||||||
// Members in VolumeGroupSnapshotContentSource are immutable. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -408,9 +391,11 @@ type GroupSnapshotHandles struct { | |||||||||||||||||||||||||||||||||||||||||||||||
type VolumeSnapshotHandlePair struct { | ||||||||||||||||||||||||||||||||||||||||||||||||
// VolumeHandle is a unique id returned by the CSI driver to identify a volume | ||||||||||||||||||||||||||||||||||||||||||||||||
// on the storage system | ||||||||||||||||||||||||||||||||||||||||||||||||
// Required. | ||||||||||||||||||||||||||||||||||||||||||||||||
VolumeHandle string `json:"volumeHandle" protobuf:"bytes,1,opt,name=volumeHandle"` | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
// SnapshotHandle is a unique id returned by the CSI driver to identify a volume | ||||||||||||||||||||||||||||||||||||||||||||||||
// snapshot on the storage system | ||||||||||||||||||||||||||||||||||||||||||||||||
// Required. | ||||||||||||||||||||||||||||||||||||||||||||||||
SnapshotHandle string `json:"snapshotHandle" protobuf:"bytes,2,opt,name=snapshotHandle"` | ||||||||||||||||||||||||||||||||||||||||||||||||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 isVolumeGroupSnapshotContentStatus.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:
external-snapshotter/client/apis/volumesnapshot/v1/types.go
Line 158 in 07425bd
vs:
external-snapshotter/client/apis/volumesnapshot/v1/types.go
Line 408 in 07425bd
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:@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
tometav1.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.
@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.
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 believe we concluded last week to use
metav1.Time
for 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.
Opened an issue: #1234
cc @leonardoce
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.
@msau42 PR is submitted here: #1235