Skip to content

Commit

Permalink
Moving binary authorization from beta to GA
Browse files Browse the repository at this point in the history
  • Loading branch information
marko7460 committed Oct 13, 2020
1 parent ae17a3f commit 726932d
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 41 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Then perform the following commands on the root folder:
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | string | `"110"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | bool | `"true"` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"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\_resource\_consumption\_export | Whether to enable resource consumption metering on this cluster. When enabled, a table will be created in the resource export BigQuery dataset to store resource consumption data. The resulting table can be joined with the resource usage table or with BigQuery billing export. | bool | `"true"` | no |
| enable\_shielded\_nodes | Enable Shielded Nodes features on all nodes in this cluster | bool | `"true"` | no |
Expand Down
2 changes: 1 addition & 1 deletion autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ resource "google_container_cluster" "primary" {
default_max_pods_per_node = var.default_max_pods_per_node

enable_shielded_nodes = var.enable_shielded_nodes
{% if beta_cluster %}
enable_binary_authorization = var.enable_binary_authorization
{% if beta_cluster %}
enable_intranode_visibility = var.enable_intranode_visibility
enable_kubernetes_alpha = var.enable_kubernetes_alpha

Expand Down
10 changes: 5 additions & 5 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,6 @@ variable "cloudrun" {
default = false
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "enable_pod_security_policy" {
type = bool
description = "enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created."
Expand Down Expand Up @@ -524,6 +519,11 @@ variable "enable_shielded_nodes" {
default = true
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "add_cluster_firewall_rules" {
type = bool
description = "Create additional firewall rules"
Expand Down
3 changes: 2 additions & 1 deletion cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ resource "google_container_cluster" "primary" {

default_max_pods_per_node = var.default_max_pods_per_node

enable_shielded_nodes = var.enable_shielded_nodes
enable_shielded_nodes = var.enable_shielded_nodes
enable_binary_authorization = var.enable_binary_authorization
dynamic "master_authorized_networks_config" {
for_each = local.master_authorized_networks_config
content {
Expand Down
25 changes: 13 additions & 12 deletions examples/simple_regional/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@ provider "google" {
}

module "gke" {
source = "../../"
project_id = var.project_id
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
regional = true
region = var.region
network = var.network
subnetwork = var.subnetwork
ip_range_pods = var.ip_range_pods
ip_range_services = var.ip_range_services
create_service_account = false
service_account = var.compute_engine_service_account
skip_provisioners = var.skip_provisioners
source = "../../"
project_id = var.project_id
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
regional = true
region = var.region
network = var.network
subnetwork = var.subnetwork
ip_range_pods = var.ip_range_pods
ip_range_services = var.ip_range_services
create_service_account = false
service_account = var.compute_engine_service_account
enable_binary_authorization = var.enable_binary_authorization
skip_provisioners = var.skip_provisioners
}

data "google_client_config" "default" {
Expand Down
5 changes: 5 additions & 0 deletions examples/simple_regional/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@ variable "skip_provisioners" {
description = "Flag to skip local-exec provisioners"
default = false
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}
10 changes: 5 additions & 5 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,6 @@ variable "cloudrun" {
default = false
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "enable_pod_security_policy" {
type = bool
description = "enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created."
Expand Down Expand Up @@ -510,6 +505,11 @@ variable "enable_shielded_nodes" {
default = true
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "add_cluster_firewall_rules" {
type = bool
description = "Create additional firewall rules"
Expand Down
10 changes: 5 additions & 5 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,6 @@ variable "cloudrun" {
default = false
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "enable_pod_security_policy" {
type = bool
description = "enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created."
Expand Down Expand Up @@ -510,6 +505,11 @@ variable "enable_shielded_nodes" {
default = true
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "add_cluster_firewall_rules" {
type = bool
description = "Create additional firewall rules"
Expand Down
10 changes: 5 additions & 5 deletions modules/beta-public-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,6 @@ variable "cloudrun" {
default = false
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "enable_pod_security_policy" {
type = bool
description = "enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created."
Expand Down Expand Up @@ -479,6 +474,11 @@ variable "enable_shielded_nodes" {
default = true
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "add_cluster_firewall_rules" {
type = bool
description = "Create additional firewall rules"
Expand Down
10 changes: 5 additions & 5 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,6 @@ variable "cloudrun" {
default = false
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "enable_pod_security_policy" {
type = bool
description = "enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created."
Expand Down Expand Up @@ -479,6 +474,11 @@ variable "enable_shielded_nodes" {
default = true
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "add_cluster_firewall_rules" {
type = bool
description = "Create additional firewall rules"
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Then perform the following commands on the root folder:
| deploy\_using\_private\_endpoint | (Beta) A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | bool | `"false"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | bool | `"true"` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"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\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | bool | `"false"` | no |
| enable\_private\_nodes | (Beta) Whether nodes have internal IP addresses only | bool | `"false"` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ resource "google_container_cluster" "primary" {

default_max_pods_per_node = var.default_max_pods_per_node

enable_shielded_nodes = var.enable_shielded_nodes
enable_shielded_nodes = var.enable_shielded_nodes
enable_binary_authorization = var.enable_binary_authorization
dynamic "master_authorized_networks_config" {
for_each = local.master_authorized_networks_config
content {
Expand Down
5 changes: 5 additions & 0 deletions modules/private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ variable "enable_shielded_nodes" {
default = true
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "add_cluster_firewall_rules" {
type = bool
description = "Create additional firewall rules"
Expand Down
1 change: 1 addition & 0 deletions modules/private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Then perform the following commands on the root folder:
| deploy\_using\_private\_endpoint | (Beta) A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | bool | `"false"` | no |
| description | The description of the cluster | string | `""` | no |
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | bool | `"true"` | no |
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | string | `"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\_private\_endpoint | (Beta) Whether the master's internal IP address is used as the cluster endpoint | bool | `"false"` | no |
| enable\_private\_nodes | (Beta) Whether nodes have internal IP addresses only | bool | `"false"` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ resource "google_container_cluster" "primary" {

default_max_pods_per_node = var.default_max_pods_per_node

enable_shielded_nodes = var.enable_shielded_nodes
enable_shielded_nodes = var.enable_shielded_nodes
enable_binary_authorization = var.enable_binary_authorization
dynamic "master_authorized_networks_config" {
for_each = local.master_authorized_networks_config
content {
Expand Down
5 changes: 5 additions & 0 deletions modules/private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ variable "enable_shielded_nodes" {
default = true
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "add_cluster_firewall_rules" {
type = bool
description = "Create additional firewall rules"
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/simple_regional/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ module "example" {
ip_range_services = google_compute_subnetwork.main.secondary_ip_range[1].range_name
compute_engine_service_account = var.compute_engine_service_accounts[0]
skip_provisioners = true
enable_binary_authorization = true
}
6 changes: 6 additions & 0 deletions test/integration/simple_regional/controls/gcloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
"enabled" => true,
})
end

it "has the expected binaryAuthorization config" do
expect(data['binaryAuthorization']).to eq({
"enabled" => true,
})
end
end

describe "default node pool" do
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,11 @@ variable "enable_shielded_nodes" {
default = true
}

variable "enable_binary_authorization" {
description = "Enable BinAuthZ Admission controller"
default = false
}

variable "add_cluster_firewall_rules" {
type = bool
description = "Create additional firewall rules"
Expand Down

0 comments on commit 726932d

Please sign in to comment.