Skip to content

Commit

Permalink
Add snapshot duration field in QdrantClusterSnapshot status (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
hossainemruz authored Nov 20, 2024
1 parent 81962f4 commit a38c821
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/v1/qdrantclustersnapshot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ type QdrantClusterSnapshotStatus struct {
// The calculated time (in UTC) this snapshot will be deleted, if so.
// +optional
RetainUntil *metav1.Time `json:"retainUntil,omitempty"`
// CompletionTime specifies how long it took for the snapshot to complete
// When serialized, it is a Duration in string format which follows "DDdHHhMMmSSs" format
// For example: "1d3h5m10s", "3h5m10s", "5m10s", "10s" etc.
// +optional
CompletionTime *metav1.Duration `json:"completionTime,omitempty"`
}

type VolumeSnapshotInfo struct {
Expand All @@ -66,6 +71,7 @@ type VolumeSnapshotInfo struct {
// +kubebuilder:printcolumn:name="clusterid",type=string,JSONPath=`.spec.cluster-id`
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.phase`
// +kubebuilder:printcolumn:name="retainUntil",type=string,JSONPath=`.status.retainUntil`
// +kubebuilder:printcolumn:name="completion-time",type=string,JSONPath=`.status.completionTime`
// +kubebuilder:printcolumn:name="age",type=date,JSONPath=`.metadata.creationTimestamp`

// QdrantClusterSnapshot is the Schema for the qdrantclustersnapshots API
Expand All @@ -77,6 +83,10 @@ type QdrantClusterSnapshot struct {
Status QdrantClusterSnapshotStatus `json:"status,omitempty"`
}

func (qcs *QdrantClusterSnapshot) IsCompleted() bool {
return qcs.Status.Phase == SnapshotSucceeded || qcs.Status.Phase == SnapshotFailed || qcs.Status.Phase == SnapshotSkipped
}

//+kubebuilder:object:root=true

// QdrantClusterSnapshotList contains a list of QdrantClusterSnapshot
Expand Down
5 changes: 5 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ spec:
- jsonPath: .status.retainUntil
name: retainUntil
type: string
- jsonPath: .status.completionTime
name: completion-time
type: string
- jsonPath: .metadata.creationTimestamp
name: age
type: date
Expand Down Expand Up @@ -83,6 +86,12 @@ spec:
type: object
status:
properties:
completionTime:
description: |-
CompletionTime specifies how long it took for the snapshot to complete
When serialized, it is a Duration in string format which follows "DDdHHhMMmSSs" format
For example: "1d3h5m10s", "3h5m10s", "5m10s", "10s" etc.
type: string
phase:
enum:
- Running
Expand Down

0 comments on commit a38c821

Please sign in to comment.