Skip to content

Commit

Permalink
feat: Add support for setting var.istio_auth (#462)
Browse files Browse the repository at this point in the history
* add istio mtls support

* docs

* fix test

* keep istio config flat

* lint

* fix examples

* fix examples
  • Loading branch information
bharathkkb committed Mar 30, 2020
1 parent f48eb32 commit fff4272
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 4 deletions.
1 change: 1 addition & 0 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ resource "google_container_cluster" "primary" {

istio_config {
disabled = ! var.istio
auth = var.istio_auth
}

dynamic "cloudrun_config" {
Expand Down
6 changes: 6 additions & 0 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,12 @@ variable "istio" {
default = false
}

variable "istio_auth" {
type = string
description = "(Beta) The authentication type between services in Istio."
default = "AUTH_MUTUAL_TLS"
}

variable "database_encryption" {
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
type = list(object({ state = string, key_name = string }))
Expand Down
4 changes: 3 additions & 1 deletion autogen/safer-cluster/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ module "gke" {
master_ipv4_cidr_block = var.master_ipv4_cidr_block

// Istio is recommended for pod-to-pod communications.
istio = var.istio
istio = var.istio
istio_auth = var.istio_auth

cloudrun = var.cloudrun

default_max_pods_per_node = var.default_max_pods_per_node
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 @@ -231,6 +231,12 @@ variable "istio" {
default = false
}

variable "istio_auth" {
type = string
description = "(Beta) The authentication type between services in Istio."
default = "AUTH_MUTUAL_TLS"
}

variable "default_max_pods_per_node" {
description = "The maximum number of pods to schedule per node"
default = 110
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ Then perform the following commands on the root folder:
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | string | n/a | yes |
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! | bool | `"false"` | no |
| istio | (Beta) Enable Istio addon | string | `"false"` | no |
| istio\_auth | (Beta) The authentication type between services in Istio. | string | `"AUTH_MUTUAL_TLS"` | no |
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | string | `"latest"` | no |
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | string | `"logging.googleapis.com/kubernetes"` | no |
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | string | `""` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ resource "google_container_cluster" "primary" {

istio_config {
disabled = ! var.istio
auth = var.istio_auth
}

dynamic "cloudrun_config" {
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ variable "istio" {
default = false
}

variable "istio_auth" {
type = string
description = "(Beta) The authentication type between services in Istio."
default = "AUTH_MUTUAL_TLS"
}

variable "database_encryption" {
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
type = list(object({ state = string, key_name = string }))
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Then perform the following commands on the root folder:
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | string | n/a | yes |
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! | bool | `"false"` | no |
| istio | (Beta) Enable Istio addon | string | `"false"` | no |
| istio\_auth | (Beta) The authentication type between services in Istio. | string | `"AUTH_MUTUAL_TLS"` | no |
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | string | `"latest"` | no |
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | string | `"logging.googleapis.com/kubernetes"` | no |
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | string | `""` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ resource "google_container_cluster" "primary" {

istio_config {
disabled = ! var.istio
auth = var.istio_auth
}

dynamic "cloudrun_config" {
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ variable "istio" {
default = false
}

variable "istio_auth" {
type = string
description = "(Beta) The authentication type between services in Istio."
default = "AUTH_MUTUAL_TLS"
}

variable "database_encryption" {
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
type = list(object({ state = string, key_name = string }))
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Then perform the following commands on the root folder:
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | string | n/a | yes |
| issue\_client\_certificate | Issues a client certificate to authenticate to the cluster endpoint. To maximize the security of your cluster, leave this option disabled. Client certificates don't automatically rotate and aren't easily revocable. WARNING: changing this after cluster creation is destructive! | bool | `"false"` | no |
| istio | (Beta) Enable Istio addon | string | `"false"` | no |
| istio\_auth | (Beta) The authentication type between services in Istio. | string | `"AUTH_MUTUAL_TLS"` | no |
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. | string | `"latest"` | no |
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | string | `"logging.googleapis.com/kubernetes"` | no |
| maintenance\_end\_time | Time window specified for recurring maintenance operations in RFC3339 format | string | `""` | no |
Expand Down
1 change: 1 addition & 0 deletions modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ resource "google_container_cluster" "primary" {

istio_config {
disabled = ! var.istio
auth = var.istio_auth
}

dynamic "cloudrun_config" {
Expand Down
6 changes: 6 additions & 0 deletions modules/beta-public-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,12 @@ variable "istio" {
default = false
}

variable "istio_auth" {
type = string
description = "(Beta) The authentication type between services in Istio."
default = "AUTH_MUTUAL_TLS"
}

variable "database_encryption" {
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
type = list(object({ state = string, key_name = string }))
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 @@ -218,6 +218,7 @@ For simplicity, we suggest using `roles/container.admin` and
| ip\_range\_pods | The _name_ of the secondary subnet ip range to use for pods | string | n/a | yes |
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | string | n/a | yes |
| istio | (Beta) Enable Istio addon | string | `"false"` | no |
| istio\_auth | (Beta) The authentication type between services in Istio. | string | `"AUTH_MUTUAL_TLS"` | no |
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. The module enforces certain minimum versions to ensure that specific features are available. | string | `"latest"` | no |
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | string | `"logging.googleapis.com/kubernetes"` | no |
| maintenance\_start\_time | Time window specified for daily maintenance operations in RFC3339 format | string | `"05:00"` | no |
Expand Down
4 changes: 3 additions & 1 deletion modules/safer-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ module "gke" {
master_ipv4_cidr_block = var.master_ipv4_cidr_block

// Istio is recommended for pod-to-pod communications.
istio = var.istio
istio = var.istio
istio_auth = var.istio_auth

cloudrun = var.cloudrun

default_max_pods_per_node = var.default_max_pods_per_node
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 @@ -231,6 +231,12 @@ variable "istio" {
default = false
}

variable "istio_auth" {
type = string
description = "(Beta) The authentication type between services in Istio."
default = "AUTH_MUTUAL_TLS"
}

variable "default_max_pods_per_node" {
description = "The maximum number of pods to schedule per node"
default = 110
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 @@ -218,6 +218,7 @@ For simplicity, we suggest using `roles/container.admin` and
| ip\_range\_pods | The _name_ of the secondary subnet ip range to use for pods | string | n/a | yes |
| ip\_range\_services | The _name_ of the secondary subnet range to use for services | string | n/a | yes |
| istio | (Beta) Enable Istio addon | string | `"false"` | no |
| istio\_auth | (Beta) The authentication type between services in Istio. | string | `"AUTH_MUTUAL_TLS"` | no |
| kubernetes\_version | The Kubernetes version of the masters. If set to 'latest' it will pull latest available version in the selected region. The module enforces certain minimum versions to ensure that specific features are available. | string | `"latest"` | no |
| logging\_service | The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none | string | `"logging.googleapis.com/kubernetes"` | no |
| maintenance\_start\_time | Time window specified for daily maintenance operations in RFC3339 format | string | `"05:00"` | no |
Expand Down
4 changes: 3 additions & 1 deletion modules/safer-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ module "gke" {
master_ipv4_cidr_block = var.master_ipv4_cidr_block

// Istio is recommended for pod-to-pod communications.
istio = var.istio
istio = var.istio
istio_auth = var.istio_auth

cloudrun = var.cloudrun

default_max_pods_per_node = var.default_max_pods_per_node
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 @@ -231,6 +231,12 @@ variable "istio" {
default = false
}

variable "istio_auth" {
type = string
description = "(Beta) The authentication type between services in Istio."
default = "AUTH_MUTUAL_TLS"
}

variable "default_max_pods_per_node" {
description = "The maximum number of pods to schedule per node"
default = 110
Expand Down
2 changes: 1 addition & 1 deletion test/integration/beta_cluster/controls/gcloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"disabled" => true,
},
"networkPolicyConfig" => {},
"istioConfig" => {},
"istioConfig" => {"auth"=>"AUTH_MUTUAL_TLS"},
"cloudRunConfig" => {},
})
end
Expand Down

0 comments on commit fff4272

Please sign in to comment.