-
Notifications
You must be signed in to change notification settings - Fork 74
/
localvolumereplicasnapshotrestore_types.go
84 lines (66 loc) · 3.77 KB
/
localvolumereplicasnapshotrestore_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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// LocalVolumeReplicaSnapshotRestoreSpec defines the desired state of LocalVolumeReplicaSnapshotRestore
type LocalVolumeReplicaSnapshotRestoreSpec struct {
// NodeName is the name of the node that snapshot will be restored at
// +kubebuilder:validation:Required
NodeName string `json:"nodeName"`
// TargetVolume is the name of the volume to restore to
// +kubebuilder:validation:Required
TargetVolume string `json:"targetVolume"`
// TargetVolume is the name of the target volume will place at
// +kubebuilder:validation:Required
TargetPoolName string `json:"targetPoolName"`
// SourceVolumeSnapshot represents which snapshot is used for volume to restore from
// +kubebuilder:validation:Required
SourceVolumeSnapshot string `json:"sourceVolumeSnapshot"`
// SourceVolumeReplicaSnapshot represents which replica snapshot is used for volume to restore from
// +kubebuilder:validation:Required
SourceVolumeReplicaSnapshot string `json:"sourceVolumeReplicaSnapshot"`
// RestoreType is the type about how to restore the volume, e.g. rollback, create. By default create.
// +kubebuilder:default:=create
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum:=rollback;create
RestoreType RestoreType `json:"restoreType"`
// +kubebuilder:validation:Required
VolumeSnapshotRestore string `json:"volumeSnapshotRestore"`
// Abort can be used to abort the restore operation and clean up sub resources created by the restore operation automatically
// +kubebuilder:default:=false
Abort bool `json:"abort,omitempty"`
}
// LocalVolumeReplicaSnapshotRestoreStatus defines the observed state of LocalVolumeReplicaSnapshotRestore
type LocalVolumeReplicaSnapshotRestoreStatus struct {
// State is the phase of restore volume snapshot, e.g. submitted, started, completed, abort, ...
State State `json:"state,omitempty"`
// Message error message to describe some states
Message string `json:"message,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// LocalVolumeReplicaSnapshotRestore is the Schema for the localvolumereplicasnapshotrestores API
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=localvolumereplicasnapshotrestores,scope=Cluster,shortName=lvrsrestore;lvrsnaprestore
// +kubebuilder:printcolumn:name="nodeName",type=string,JSONPath=`.spec.nodeName`,description="Node to restore"
// +kubebuilder:printcolumn:name="targetvolume",type=string,JSONPath=`.spec.targetVolume`,description="Target for the restore"
// +kubebuilder:printcolumn:name="sourcesnapshot",type=string,JSONPath=`.spec.sourceVolumeSnapshot`,description="Source snapshot for the restore"
// +kubebuilder:printcolumn:name="state",type=string,JSONPath=`.status.state`,description="State of the restore"
// +kubebuilder:printcolumn:name="age",type=date,JSONPath=`.metadata.creationTimestamp`
type LocalVolumeReplicaSnapshotRestore struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec LocalVolumeReplicaSnapshotRestoreSpec `json:"spec,omitempty"`
Status LocalVolumeReplicaSnapshotRestoreStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// LocalVolumeReplicaSnapshotRestoreList contains a list of LocalVolumeReplicaSnapshotRestore
type LocalVolumeReplicaSnapshotRestoreList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []LocalVolumeReplicaSnapshotRestore `json:"items"`
}
func init() {
SchemeBuilder.Register(&LocalVolumeReplicaSnapshotRestore{}, &LocalVolumeReplicaSnapshotRestoreList{})
}