forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
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 Make all RPO config backup plans paused, so that they won't create backups. Otherwise backup deletion at end of test will fail due to the nested resources under backup plan.
- Loading branch information
Showing
4 changed files
with
468 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
58 changes: 58 additions & 0 deletions
58
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,58 @@ | ||
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" "<%= ctx[:primary_resource_id] %>" { | ||
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 { | ||
paused = true | ||
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 | ||
nanos = 100 | ||
} | ||
duration = "3600s" | ||
single_occurrence_date { | ||
year = 2024 | ||
month = 3 | ||
day = 16 | ||
} | ||
} | ||
} | ||
} | ||
backup_config { | ||
include_volume_data = true | ||
include_secrets = true | ||
all_namespaces = true | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
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,70 @@ | ||
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" "<%= ctx[:primary_resource_id] %>" { | ||
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 { | ||
paused = true | ||
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 | ||
} | ||
} |
Oops, something went wrong.