forked from libopenstorage/stork
/
migrationschedule.go
62 lines (51 loc) · 2.16 KB
/
migrationschedule.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
package v1alpha1
import (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
// MigrationScheduleResourceName is name for "migrationschedule" resource
MigrationScheduleResourceName = "migrationschedule"
// MigrationScheduleResourcePlural is plural for "migrationschedule" resource
MigrationScheduleResourcePlural = "migrationschedules"
)
// MigrationScheduleSpec is the spec used to schedule migrations
type MigrationScheduleSpec struct {
Template MigrationTemplateSpec `json:"template"`
SchedulePolicyName string `json:"schedulePolicyName"`
Suspend *bool `json:"suspend"`
AutoSuspend bool `json:"autoSuspend"`
}
// MigrationTemplateSpec describes the data a Migration should have when created
// from a template
type MigrationTemplateSpec struct {
Spec MigrationSpec `json:"spec"`
}
// MigrationScheduleStatus is the status of a migration schedule
type MigrationScheduleStatus struct {
Items map[SchedulePolicyType][]*ScheduledMigrationStatus `json:"items"`
ApplicationActivated bool `json:"applicationActivated"`
}
// ScheduledMigrationStatus keeps track of the migration that was triggered by a
// scheduled policy
type ScheduledMigrationStatus struct {
Name string `json:"name"`
CreationTimestamp meta.Time `json:"creationTimestamp"`
FinishTimestamp meta.Time `json:"finishTimestamp"`
Status MigrationStatusType `json:"status"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// MigrationSchedule represents a scheduled migration object
type MigrationSchedule struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"`
Spec MigrationScheduleSpec `json:"spec"`
Status MigrationScheduleStatus `json:"status"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// MigrationScheduleList is a list of MigrationSchedules
type MigrationScheduleList struct {
meta.TypeMeta `json:",inline"`
meta.ListMeta `json:"metadata,omitempty"`
Items []MigrationSchedule `json:"items"`
}