Skip to content

Conversation

@hossainemruz
Copy link
Member

@hossainemruz hossainemruz commented Nov 19, 2024

@hossainemruz hossainemruz self-assigned this Nov 19, 2024
@hossainemruz hossainemruz requested a review from a team as a code owner November 19, 2024 10:16
@hossainemruz hossainemruz force-pushed the feat/emruz/add-snapshot-duration branch from 7c5de67 to 0e44aca Compare November 19, 2024 10:28
Signed-off-by: Emruz Hossain <[email protected]>
RetainUntil *metav1.Time `json:"retainUntil,omitempty"`
// Duration specifies how long it took for the snapshot to complete
// +optional
Duration *metav1.Duration `json:"duration,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#units.

Duration for the field name is too ambiguous - how about CompletionTime, since we speak about that in the comment above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like CompletionTIme

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Then, which one should we chose?

CompletionTime *metav1.Duration `json:"completionTime,omitempty"`
CompletionTimeSeconds *int `json:"completionTimeSeconds,omitempty"`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed Duration to CompletionTime

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go for CompletionTimeSeconds if the operation is never shorter than 1s.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will sent this as string to cluster-api. So, it will be much easier to have this as metav1.Duration. It will automatically format into human-readable string.

If we use CompletionTimeSeconds, then we have to reformat it in the cluster-api side before we show to the user. Also, it will not look good on additional print column.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will automatically format into human-readable string.

You should then document what is the schema of the field, i.e. how it should be parsed if somebody need that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment showing sample format.

@hossainemruz hossainemruz requested a review from pedjak November 19, 2024 16:35
@hossainemruz hossainemruz merged commit a38c821 into main Nov 20, 2024
2 checks passed
@hossainemruz hossainemruz deleted the feat/emruz/add-snapshot-duration branch November 20, 2024 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants