Skip to content

Commit a38c821

Browse files
authored
Add snapshot duration field in QdrantClusterSnapshot status (#43)
1 parent 81962f4 commit a38c821

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

api/v1/qdrantclustersnapshot_types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ type QdrantClusterSnapshotStatus struct {
4646
// The calculated time (in UTC) this snapshot will be deleted, if so.
4747
// +optional
4848
RetainUntil *metav1.Time `json:"retainUntil,omitempty"`
49+
// CompletionTime specifies how long it took for the snapshot to complete
50+
// When serialized, it is a Duration in string format which follows "DDdHHhMMmSSs" format
51+
// For example: "1d3h5m10s", "3h5m10s", "5m10s", "10s" etc.
52+
// +optional
53+
CompletionTime *metav1.Duration `json:"completionTime,omitempty"`
4954
}
5055

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

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

86+
func (qcs *QdrantClusterSnapshot) IsCompleted() bool {
87+
return qcs.Status.Phase == SnapshotSucceeded || qcs.Status.Phase == SnapshotFailed || qcs.Status.Phase == SnapshotSkipped
88+
}
89+
8090
//+kubebuilder:object:root=true
8191

8292
// QdrantClusterSnapshotList contains a list of QdrantClusterSnapshot

api/v1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/qdrant-kubernetes-api/templates/region-crds/qdrant.io_qdrantclustersnapshots.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ spec:
2828
- jsonPath: .status.retainUntil
2929
name: retainUntil
3030
type: string
31+
- jsonPath: .status.completionTime
32+
name: completion-time
33+
type: string
3134
- jsonPath: .metadata.creationTimestamp
3235
name: age
3336
type: date
@@ -83,6 +86,12 @@ spec:
8386
type: object
8487
status:
8588
properties:
89+
completionTime:
90+
description: |-
91+
CompletionTime specifies how long it took for the snapshot to complete
92+
When serialized, it is a Duration in string format which follows "DDdHHhMMmSSs" format
93+
For example: "1d3h5m10s", "3h5m10s", "5m10s", "10s" etc.
94+
type: string
8695
phase:
8796
enum:
8897
- Running

0 commit comments

Comments
 (0)