Skip to content

Commit

Permalink
feat: Allow enabling cost management for safer_cluster module (#1475)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusramberg authored Nov 23, 2022
1 parent aaeb66d commit 8507e09
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions autogen/safer-cluster/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ module "gke" {
// We suggest to define policies about which images can run on a cluster.
enable_binary_authorization = true

// Enable cost allocation support
enable_cost_allocation = var.enable_cost_allocation

// Use of PodSecurityPolicy admission controller
// https://cloud.google.com/kubernetes-engine/docs/how-to/pod-security-policies
enable_pod_security_policy = var.enable_pod_security_policy
Expand Down
6 changes: 6 additions & 0 deletions autogen/safer-cluster/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ variable "enable_resource_consumption_export" {
default = true
}

variable "enable_cost_allocation" {
type = bool
description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery"
default = false
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand Down
1 change: 1 addition & 0 deletions modules/safer-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ For simplicity, we suggest using `roles/container.admin` and
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_cost\_allocation | Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery | `bool` | `false` | no |
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | `bool` | `false` | no |
| enable\_network\_egress\_export | Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | `bool` | `false` | no |
| enable\_pod\_security\_policy | enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created. | `bool` | `false` | no |
Expand Down
3 changes: 3 additions & 0 deletions modules/safer-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ module "gke" {
// We suggest to define policies about which images can run on a cluster.
enable_binary_authorization = true

// Enable cost allocation support
enable_cost_allocation = var.enable_cost_allocation

// Use of PodSecurityPolicy admission controller
// https://cloud.google.com/kubernetes-engine/docs/how-to/pod-security-policies
enable_pod_security_policy = var.enable_pod_security_policy
Expand Down
6 changes: 6 additions & 0 deletions modules/safer-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ variable "enable_resource_consumption_export" {
default = true
}

variable "enable_cost_allocation" {
type = bool
description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery"
default = false
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand Down
1 change: 1 addition & 0 deletions modules/safer-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ For simplicity, we suggest using `roles/container.admin` and
| description | The description of the cluster | `string` | `""` | no |
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
| dns\_cache | (Beta) The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
| enable\_cost\_allocation | Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery | `bool` | `false` | no |
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | `bool` | `false` | no |
| enable\_network\_egress\_export | Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | `bool` | `false` | no |
| enable\_pod\_security\_policy | enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created. | `bool` | `false` | no |
Expand Down
3 changes: 3 additions & 0 deletions modules/safer-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ module "gke" {
// We suggest to define policies about which images can run on a cluster.
enable_binary_authorization = true

// Enable cost allocation support
enable_cost_allocation = var.enable_cost_allocation

// Use of PodSecurityPolicy admission controller
// https://cloud.google.com/kubernetes-engine/docs/how-to/pod-security-policies
enable_pod_security_policy = var.enable_pod_security_policy
Expand Down
6 changes: 6 additions & 0 deletions modules/safer-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ variable "enable_resource_consumption_export" {
default = true
}

variable "enable_cost_allocation" {
type = bool
description = "Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery"
default = false
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand Down

0 comments on commit 8507e09

Please sign in to comment.