From 93f28baff4c1da1cd09a668d2e19cf5f83c84da2 Mon Sep 17 00:00:00 2001 From: Helder Santana Date: Tue, 5 Mar 2024 12:04:06 -0300 Subject: [PATCH] Support yearly frequency/retention for backup policy --- config/crd/bases/atlas.mongodb.com_atlasbackuppolicies.yaml | 2 ++ pkg/api/v1/atlasbackuppolicy_types.go | 4 ++-- test/e2e/backup_config_test.go | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/crd/bases/atlas.mongodb.com_atlasbackuppolicies.yaml b/config/crd/bases/atlas.mongodb.com_atlasbackuppolicies.yaml index 9e8151a5cc..8e568e4062 100644 --- a/config/crd/bases/atlas.mongodb.com_atlasbackuppolicies.yaml +++ b/config/crd/bases/atlas.mongodb.com_atlasbackuppolicies.yaml @@ -86,6 +86,7 @@ spec: - daily - weekly - monthly + - yearly type: string retentionUnit: description: 'Scope of the backup policy item: days, weeks, @@ -94,6 +95,7 @@ spec: - days - weeks - months + - years type: string retentionValue: description: Value to associate with RetentionUnit diff --git a/pkg/api/v1/atlasbackuppolicy_types.go b/pkg/api/v1/atlasbackuppolicy_types.go index 6570140a3a..a4c7f682a1 100644 --- a/pkg/api/v1/atlasbackuppolicy_types.go +++ b/pkg/api/v1/atlasbackuppolicy_types.go @@ -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. @@ -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 diff --git a/test/e2e/backup_config_test.go b/test/e2e/backup_config_test.go index 773ed228ab..188278886b 100644 --- a/test/e2e/backup_config_test.go +++ b/test/e2e/backup_config_test.go @@ -126,6 +126,12 @@ func backupConfigFlow(data *model.TestDataProvider, bucket string) { RetentionValue: 12, RetentionUnit: "months", }, + { + FrequencyInterval: 1, + FrequencyType: "yearly", + RetentionValue: 1, + RetentionUnit: "years", + }, }, }, }