Skip to content

Commit cd12bfb

Browse files
Add LogRetention API to archiver
Signed-off-by: Anisur Rahman <[email protected]>
1 parent eb03deb commit cd12bfb

10 files changed

+78
-25
lines changed

apis/archiver/v1alpha1/mariadbarchiver_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type MariaDBArchiverSpec struct {
5252
// Pause defines if the backup process should be paused or not
5353
// +optional
5454
Pause bool `json:"pause,omitempty"`
55-
// RetentionPolicy refers to a RetentionPolicy CR which defines how to cleanup the old Snapshots
55+
// RetentionPolicy field is the RetentionPolicy of the backupConfiguration's backend
5656
// +optional
5757
RetentionPolicy *kmapi.ObjectReference `json:"retentionPolicy"`
5858
// FullBackup defines the session configuration for the full backup

apis/archiver/v1alpha1/mysqlarchiver_types.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ type MySQLArchiverSpec struct {
5252
// Pause defines if the backup process should be paused or not
5353
// +optional
5454
Pause bool `json:"pause,omitempty"`
55-
// RetentionPolicy field is the RetentionPolicy of the backupConfiguration's backend
56-
// +optional
57-
RetentionPolicy *kmapi.ObjectReference `json:"retentionPolicy"`
5855
// FullBackup defines the sessionConfig of the fullBackup
5956
// This options will eventually go to the full-backup job's yaml
6057
// +optional

apis/archiver/v1alpha1/openapi_generated.go

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

apis/archiver/v1alpha1/types.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ type LogBackupOptions struct {
7878
// +optional
7979
ConfigSecret *GenericSecretReference `json:"configSecret,omitempty"`
8080

81+
// RetentionPeriod is the retention policy to be used for Logs (i.e. '60d') means how long logs will be retained before being pruned.
82+
// The retention policy is expressed in the form of `XXu` where `XX` is a positive integer and `u` is in `[dwm]` - days, weeks, months.
83+
// +kubebuilder:validation:Pattern=^[1-9][0-9]*[dwm]$
84+
// +optional
85+
RetentionPeriod string `json:"retentionPeriod,omitempty"`
86+
// time.RFC3339 We need to parse the time to RFC3339 format
87+
8188
// SuccessfulLogHistoryLimit defines the number of successful Logs backup status that the incremental snapshot will retain
8289
// The default value is 5.
8390
// +kubebuilder:default=5
@@ -89,8 +96,28 @@ type LogBackupOptions struct {
8996
// +kubebuilder:default=5
9097
// +optional
9198
FailedLogHistoryLimit int32 `json:"failedLogHistoryLimit,omitempty"`
99+
100+
// LogRetentionHistoryLimit defines the number of retention status the incremental snapshot will retain for debugging purposes.
101+
// The default value is 5.
102+
// +kubebuilder:default=5
103+
// +optional
104+
LogRetentionHistoryLimit int32 `json:"logRetentionHistoryLimit,omitempty"`
92105
}
93106

107+
//func ParsePolicy(policy string) (string, error) {
108+
// unitName := map[string]string{
109+
// "d": "DAYS",
110+
// "w": "WEEKS",
111+
// "m": "MONTHS",
112+
// }
113+
// matches := regexPolicy.FindStringSubmatch(policy)
114+
// if len(matches) < 3 {
115+
// return "", fmt.Errorf("not a valid policy")
116+
// }
117+
//
118+
// return fmt.Sprintf("RECOVERY WINDOW OF %v %v", matches[1], unitName[matches[2]]), nil
119+
//}
120+
94121
type Task struct {
95122
Params *runtime.RawExtension `json:"params"`
96123
}

apis/archiver/v1alpha1/zz_generated.deepcopy.go

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

crds/archiver.kubedb.com_mariadbarchivers.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6025,6 +6025,13 @@ spec:
60256025
default: 5
60266026
format: int32
60276027
type: integer
6028+
logRetentionHistoryLimit:
6029+
default: 5
6030+
format: int32
6031+
type: integer
6032+
retentionPeriod:
6033+
pattern: ^[1-9][0-9]*[dwm]$
6034+
type: string
60286035
runtimeSettings:
60296036
properties:
60306037
container:

crds/archiver.kubedb.com_mongodbarchivers.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6025,6 +6025,13 @@ spec:
60256025
default: 5
60266026
format: int32
60276027
type: integer
6028+
logRetentionHistoryLimit:
6029+
default: 5
6030+
format: int32
6031+
type: integer
6032+
retentionPeriod:
6033+
pattern: ^[1-9][0-9]*[dwm]$
6034+
type: string
60286035
runtimeSettings:
60296036
properties:
60306037
container:

crds/archiver.kubedb.com_mssqlserverarchivers.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6025,6 +6025,13 @@ spec:
60256025
default: 5
60266026
format: int32
60276027
type: integer
6028+
logRetentionHistoryLimit:
6029+
default: 5
6030+
format: int32
6031+
type: integer
6032+
retentionPeriod:
6033+
pattern: ^[1-9][0-9]*[dwm]$
6034+
type: string
60286035
runtimeSettings:
60296036
properties:
60306037
container:

crds/archiver.kubedb.com_mysqlarchivers.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6025,6 +6025,13 @@ spec:
60256025
default: 5
60266026
format: int32
60276027
type: integer
6028+
logRetentionHistoryLimit:
6029+
default: 5
6030+
format: int32
6031+
type: integer
6032+
retentionPeriod:
6033+
pattern: ^[1-9][0-9]*[dwm]$
6034+
type: string
60286035
runtimeSettings:
60296036
properties:
60306037
container:
@@ -13040,15 +13047,6 @@ spec:
1304013047
type: object
1304113048
pause:
1304213049
type: boolean
13043-
retentionPolicy:
13044-
properties:
13045-
name:
13046-
type: string
13047-
namespace:
13048-
type: string
13049-
required:
13050-
- name
13051-
type: object
1305213050
required:
1305313051
- databases
1305413052
type: object

crds/archiver.kubedb.com_postgresarchivers.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6025,6 +6025,13 @@ spec:
60256025
default: 5
60266026
format: int32
60276027
type: integer
6028+
logRetentionHistoryLimit:
6029+
default: 5
6030+
format: int32
6031+
type: integer
6032+
retentionPeriod:
6033+
pattern: ^[1-9][0-9]*[dwm]$
6034+
type: string
60286035
runtimeSettings:
60296036
properties:
60306037
container:

0 commit comments

Comments
 (0)