forked from kubernetes/k8s.io
-
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 a defined budget to `k8s-infra-ii-sandbox` but also use the project to experiment GCP budgets. Ref: kubernetes#1375 Signed-off-by: Arnaud Meukam <[email protected]>
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
infra/gcp/clusters/projects/k8s-infra-ii-sandbox/budget.tf
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,41 @@ | ||
/* | ||
This file contains | ||
- defined budget for this project | ||
- notification channel when threshold is reached | ||
*/ | ||
|
||
resource "google_billing_budget" "budget" { | ||
billing_account = data.google_billing_account.account.id | ||
display_name = "Billing Budget for ${google_project.project.id}" | ||
|
||
budget_filter { | ||
projects = ["projects/${google_project.project.number}"] | ||
} | ||
|
||
amount { | ||
specified_amount { | ||
units = "1000" | ||
} | ||
} | ||
|
||
threshold_rules { | ||
threshold_percent = 0.9 // Threshold of 90% of the budget set | ||
} | ||
|
||
all_updates_rule { | ||
monitoring_notification_channels = [ | ||
google_monitoring_notification_channel.wg_k8s_infra_leads.id, | ||
] | ||
disable_default_iam_recipients = true | ||
} | ||
} | ||
|
||
resource "google_monitoring_notification_channel" "wg_k8s_infra_leads" { | ||
display_name = "Example Notification Channel" | ||
type = "email" | ||
|
||
labels = { | ||
email_address = "[email protected]" | ||
} | ||
} |