-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add APIs for Smart Scheduling feature in BackupPlan for Backup for GKE
with examples
- Loading branch information
Showing
3 changed files
with
277 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_daily_window.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
resource "google_container_cluster" "primary" { | ||
name = "<%= ctx[:vars]['cluster_name'] %>" | ||
location = "us-central1" | ||
initial_node_count = 1 | ||
workload_identity_config { | ||
workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" | ||
} | ||
addons_config { | ||
gke_backup_agent_config { | ||
enabled = true | ||
} | ||
} | ||
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" | ||
network = "<%= ctx[:vars]['network_name'] %>" | ||
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" | ||
} | ||
|
||
resource "google_gke_backup_backup_plan" "daily_single" { | ||
name = "<%= ctx[:vars]['name'] %>" | ||
cluster = google_container_cluster.primary.id | ||
location = "us-central1" | ||
retention_policy { | ||
backup_delete_lock_days = 30 | ||
backup_retain_days = 180 | ||
} | ||
backup_schedule { | ||
rpo_config { | ||
target_rpo_minutes=1440 | ||
exclusion_windows { | ||
start_time { | ||
hours = 12 | ||
} | ||
duration = "7200s" | ||
daily = true | ||
} | ||
exclusion_windows { | ||
start_time { | ||
hours = 8 | ||
minutes = 40 | ||
seconds = 1 | ||
} | ||
duration = "3600s" | ||
single_occurrence_date { | ||
year = 2024 | ||
month = 3 | ||
day = 16 | ||
} | ||
} | ||
} | ||
} | ||
backup_config { | ||
include_volume_data = true | ||
include_secrets = true | ||
all_namespaces = true | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
mmv1/templates/terraform/examples/gkebackup_backupplan_rpo_weekly_window.tf.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
resource "google_container_cluster" "primary" { | ||
name = "<%= ctx[:vars]['cluster_name'] %>" | ||
location = "us-central1" | ||
initial_node_count = 1 | ||
workload_identity_config { | ||
workload_pool = "<%= ctx[:test_env_vars]['project'] %>.svc.id.goog" | ||
} | ||
addons_config { | ||
gke_backup_agent_config { | ||
enabled = true | ||
} | ||
} | ||
deletion_protection = "<%= ctx[:vars]['deletion_protection'] %>" | ||
network = "<%= ctx[:vars]['network_name'] %>" | ||
subnetwork = "<%= ctx[:vars]['subnetwork_name'] %>" | ||
} | ||
|
||
resource "google_gke_backup_backup_plan" "weekly_single" { | ||
name = "<%= ctx[:vars]['name'] %>" | ||
cluster = google_container_cluster.primary.id | ||
location = "us-central1" | ||
retention_policy { | ||
backup_delete_lock_days = 30 | ||
backup_retain_days = 180 | ||
} | ||
backup_schedule { | ||
rpo_config { | ||
target_rpo_minutes=1440 | ||
exclusion_windows { | ||
start_time { | ||
hours = 1 | ||
minutes = 23 | ||
} | ||
duration = "1800s" | ||
days_of_week { | ||
days_of_week = ["MONDAY", "THURSDAY"] | ||
} | ||
} | ||
exclusion_windows { | ||
start_time { | ||
hours = 12 | ||
} | ||
duration = "3600s" | ||
single_occurrence_date { | ||
year = 2024 | ||
month = 3 | ||
day = 17 | ||
} | ||
} | ||
exclusion_windows { | ||
start_time { | ||
hours = 8 | ||
minutes = 40 | ||
} | ||
duration = "600s" | ||
single_occurrence_date { | ||
year = 2024 | ||
month = 3 | ||
day = 18 | ||
} | ||
} | ||
} | ||
} | ||
backup_config { | ||
include_volume_data = true | ||
include_secrets = true | ||
all_namespaces = true | ||
} | ||
} |