diff --git a/api/v1/qdrantclustersnapshot_types.go b/api/v1/qdrantclustersnapshot_types.go index 6fc9c95..f07aafe 100644 --- a/api/v1/qdrantclustersnapshot_types.go +++ b/api/v1/qdrantclustersnapshot_types.go @@ -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 { @@ -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 @@ -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 diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 7d11b32..b6795bd 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -787,6 +787,11 @@ func (in *QdrantClusterSnapshotStatus) DeepCopyInto(out *QdrantClusterSnapshotSt in, out := &in.RetainUntil, &out.RetainUntil *out = (*in).DeepCopy() } + if in.CompletionTime != nil { + in, out := &in.CompletionTime, &out.CompletionTime + *out = new(metav1.Duration) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QdrantClusterSnapshotStatus. diff --git a/charts/qdrant-kubernetes-api/templates/region-crds/qdrant.io_qdrantclustersnapshots.yaml b/charts/qdrant-kubernetes-api/templates/region-crds/qdrant.io_qdrantclustersnapshots.yaml index 1efe08a..f7f9588 100644 --- a/charts/qdrant-kubernetes-api/templates/region-crds/qdrant.io_qdrantclustersnapshots.yaml +++ b/charts/qdrant-kubernetes-api/templates/region-crds/qdrant.io_qdrantclustersnapshots.yaml @@ -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 @@ -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