/
pvcrestore_types.go
59 lines (48 loc) · 1.96 KB
/
pvcrestore_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package v1alpha1
import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// PVCRestoreSpec defines the desired state of PVCRestore
type PVCRestoreSpec struct {
// The name of the source PVC that will be restored. The source PVC does not
// need to exist anymore, this is just for finding its data.
SourcePVC string `json:"sourcePvc,omitempty"`
// The namespace that the source PVC used to exist in. If empty, assume that
// the source namespace is the same as the namespace where this PVCRestore
// object exists.
SourceNamespace string `json:"sourceNamespace,omitempty"`
// The snapshot to restore, or empty to restore the latest snapshot.
SourceSnapshot string `json:"sourceSnapshot,omitempty"`
// The name of the new PVC where the source contents will be restored into.
// The PVC must not exist, and will be created. If empty, assume that the
// target PVC is the same name as the source PVC.
TargetPVC string `json:"targetPvc,omitempty"`
// The size of the target PVC. Must be large enough to contain the backup's
// contents.
TargetPVCSize resource.Quantity `json:"targetPvcSize,omitempty"`
}
// PVCRestoreStatus defines the observed state of PVCRestore
type PVCRestoreStatus struct {
FinishedAt *metav1.Time `json:"finishedAt,omitempty"`
Result *Result `json:"result,omitempty"`
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// PVCRestore is the Schema for the pvcrestores API
type PVCRestore struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PVCRestoreSpec `json:"spec,omitempty"`
Status PVCRestoreStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// PVCRestoreList contains a list of PVCRestore
type PVCRestoreList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PVCRestore `json:"items"`
}
func init() {
SchemeBuilder.Register(&PVCRestore{}, &PVCRestoreList{})
}