Add lastsyncbytes and lastsyncduration to vol rep status#366
Conversation
Rakshith-R
left a comment
There was a problem hiding this comment.
Can you please add controller and sidecar changes too (in same pr) and (keep it in draft) / open it for review when completed ?
| LastStartTime *metav1.Time `json:"lastStartTime,omitempty"` | ||
| LastCompletionTime *metav1.Time `json:"lastCompletionTime,omitempty"` | ||
| LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty"` | ||
| LastSyncBytes int64 `json:"lastSyncBytes,omitempty"` |
There was a problem hiding this comment.
| LastSyncBytes int64 `json:"lastSyncBytes,omitempty"` | |
| LastSyncBytes *int64 `json:"lastSyncBytes,omitempty"` |
This should be a pointer since it is a optional parameter,
nixpanic
left a comment
There was a problem hiding this comment.
the duration.proto file should probably be moved to the commit where it is imported.
| format: int64 | ||
| type: integer | ||
| lastSyncDuration: | ||
| format: date-time |
There was a problem hiding this comment.
is this really date-time? is there not a duration format, there is no date in this, I think?
|
@yati1998 make sure to install protoc v3.19.6, or do not commit the changes in the version of the There is also a crd generation issue, it seems that the duration can not have a |
yeah sure, I am testing with changes, once it is successful, I will update all. |
| // Code generated by protoc-gen-go. DO NOT EDIT. | ||
| // versions: | ||
| // protoc-gen-go v1.30.0 | ||
| // protoc v3.19.6 |
There was a problem hiding this comment.
You are using an old version to re-generate these files, please use protoc v3.19.6
37b2062 to
5f45cec
Compare
|
Working on to revert the protobuf version issue, meanwhile please do review the PR. |
| LastSyncDuration: lastsyncduration, | ||
| LastSyncBytes: lastsyncbytes, |
There was a problem hiding this comment.
instead of new variables you can directly use resp.GetLastSyncDuration() and resp.GetLastSyncBytes() here
| // This field is OPTIONAL. | ||
| .google.protobuf.Duration last_sync_duration = 2; | ||
| // This field is OPTIONAL. | ||
| // A value of 0 is equal to an unspecified field value. | ||
| // The value of this field MUST NOT be negative. | ||
| int64 last_sync_bytes = 3; |
There was a problem hiding this comment.
Make sure to match the comments with csi-addons spec or close to it.
There was a problem hiding this comment.
This has to be edited in spec then, cause it's required to clear it here, will send another PR to update spec comments
| td := info.GetLastSyncDuration() | ||
| if td != nil { | ||
| lastSyncDuration := metav1.Duration{Duration: td.AsDuration()} | ||
| instance.Status.LastSyncDuration = &lastSyncDuration | ||
| } | ||
| tb := info.GetLastSyncBytes() | ||
| if tb != 0 { | ||
| instance.Status.LastSyncBytes = &tb | ||
| } |
There was a problem hiding this comment.
Fields should be explicitly set to nil to indicate missing value.
otherwise, they may inherit values that were previously set.
There was a problem hiding this comment.
I am not sure about this, considering the corner case where lastsynctime retains its value and on requeue other values will be nil. Will verify this once and update if it's fine.
There was a problem hiding this comment.
On line 91 (wow, what a horrible long function this is?!) instance is fetched, so it will have a .Status.LastSyncBytes from the previous reconcile. If there were 0 bytes in the last sync, the information would not be correct in the object. So yes, setting it explicitly to an initial value is probably a good thing.
There was a problem hiding this comment.
@Rakshith-R @nixpanic IMO we should not set this to nil explicitly #366 (comment)
This commit adds lastsyncbytes and lastsyncduration to volume replication status and generates updated crds. Signed-off-by: yati1998 <ypadia@redhat.com>
|
Addressed the changes, @Rakshith-R @nixpanic |
| // last_sync_duration states the time taken to sync | ||
| // to execute the last sync operation. |
There was a problem hiding this comment.
| // last_sync_duration states the time taken to sync | |
| // to execute the last sync operation. | |
| // last_sync_duration represents the time taken | |
| // to execute the last sync operation. |
This commit updates the getvolumereplicationinfo rpc to include lastsyncbytes and lastsyncduration. Signed-off-by: yati1998 <ypadia@redhat.com>
This commit updates the vendor directory to include lastest spec. Signed-off-by: yati1998 <ypadia@redhat.com>
This commit updates the reconcile logic to get more info and update the volrep status. Signed-off-by: yati1998 <ypadia@redhat.com>
| instance.Status.LastSyncDuration = nil | ||
| instance.Status.LastSyncBytes = nil |
There was a problem hiding this comment.
i dont think you should make this nil. You should preserve the last data because you already have lastSyncTime, Duration, Byte to give to complete sync information.
There was a problem hiding this comment.
i dont think you should make this nil. You should preserve the last data because you already have lastSyncTime, Duration, Byte to give to complete sync information.
@Madhu-1 ,
We'll reach this point only when csi driver gives us a valid new lastSyncTime.
It'll be incorrect to keep previous duration and bytes data with new lastSyncTime according to me.
Syncing latest changes from upstream main for kubernetes-csi-addons
This PR adds lastsyncbytes and lastsyncduration to volume replication status and generates updated crds.
Also it adds the logic to update the status in the volume replication object.