Skip to content

Commit

Permalink
Support yearly frequency/retention for backup policy (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
helderjs authored Mar 7, 2024
1 parent efbdc72 commit 30affd7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions config/crd/bases/atlas.mongodb.com_atlasbackuppolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ spec:
- daily
- weekly
- monthly
- yearly
type: string
retentionUnit:
description: 'Scope of the backup policy item: days, weeks,
Expand All @@ -94,6 +95,7 @@ spec:
- days
- weeks
- months
- years
type: string
retentionValue:
description: Value to associate with RetentionUnit
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/v1/atlasbackuppolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type AtlasBackupPolicySpec struct {

type AtlasBackupPolicyItem struct {
// Frequency associated with the backup policy item. One of the following values: hourly, daily, weekly or monthly. You cannot specify multiple hourly and daily backup policy items.
// +kubebuilder:validation:Enum:=hourly;daily;weekly;monthly
// +kubebuilder:validation:Enum:=hourly;daily;weekly;monthly;yearly
FrequencyType string `json:"frequencyType"`

// Desired frequency of the new backup policy item specified by FrequencyType. A value of 1 specifies the first instance of the corresponding FrequencyType.
Expand All @@ -31,7 +31,7 @@ type AtlasBackupPolicyItem struct {
FrequencyInterval int `json:"frequencyInterval"`

// Scope of the backup policy item: days, weeks, or months
// +kubebuilder:validation:Enum:=days;weeks;months
// +kubebuilder:validation:Enum:=days;weeks;months;years
RetentionUnit string `json:"retentionUnit"`

// Value to associate with RetentionUnit
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/backup_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ func backupConfigFlow(data *model.TestDataProvider, bucket string) {
RetentionValue: 12,
RetentionUnit: "months",
},
{
FrequencyInterval: 1,
FrequencyType: "yearly",
RetentionValue: 1,
RetentionUnit: "years",
},
},
},
}
Expand Down

0 comments on commit 30affd7

Please sign in to comment.