Skip to content

Commit

Permalink
Fixing tests and modules
Browse files Browse the repository at this point in the history
  • Loading branch information
marko7460 committed Oct 10, 2020
1 parent 8a71304 commit c1ab946
Show file tree
Hide file tree
Showing 32 changed files with 198 additions and 119 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Then perform the following commands on the root folder:
| network\_policy | Enable network policy addon | bool | `"true"` | no |
| network\_policy\_provider | The network policy provider. | string | `"CALICO"` | no |
| network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | string | `""` | no |
| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | string | `"GKE_METADATA_SERVER"` | no |
| node\_pools | List of maps containing node pools | list(map(string)) | `<list>` | no |
| node\_pools\_labels | Map of maps containing node labels by node-pool name | map(map(string)) | `<map>` | no |
| node\_pools\_metadata | Map of maps containing node metadata by node-pool name | map(map(string)) | `<map>` | no |
Expand Down Expand Up @@ -167,6 +168,7 @@ Then perform the following commands on the root folder:
| endpoint | Cluster endpoint |
| horizontal\_pod\_autoscaling\_enabled | Whether horizontal pod autoscaling enabled |
| http\_load\_balancing\_enabled | Whether http load balancing enabled |
| identity\_namespace | Workload Identity namespace |
| location | Cluster location (region if regional cluster, zone if zonal cluster) |
| logging\_service | Logging service used |
| master\_authorized\_networks\_config | Networks from which access to master is permitted |
Expand All @@ -178,6 +180,7 @@ Then perform the following commands on the root folder:
| node\_pools\_names | List of node pools names |
| node\_pools\_versions | List of node pools versions |
| region | Cluster region |
| release\_channel | The release channel of this cluster |
| service\_account | The service account to default running nodes as if not overridden in `node_pools`. |
| type | Cluster type (regional / zonal) |
| zones | List of zones in which the cluster resides |
Expand Down
7 changes: 3 additions & 4 deletions autogen/main/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,16 @@ locals {

cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
node_metadata = var.node_metadata
}]

cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]

cluster_sandbox_enabled = var.sandbox_enabled ? ["gvisor"] : []

{% endif %}
cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
node_metadata = var.node_metadata
}]

cluster_output_name = google_container_cluster.primary.name
cluster_output_regional_zones = google_container_cluster.primary.node_locations
Expand Down
26 changes: 13 additions & 13 deletions autogen/main/outputs.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ output "service_account" {
description = "The service account to default running nodes as if not overridden in `node_pools`."
value = local.service_account
}

output "release_channel" {
description = "The release channel of this cluster"
value = var.release_channel
}

output "identity_namespace" {
description = "Workload Identity namespace"
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
depends_on = [
google_container_cluster.primary
]
}
{% if private_cluster %}

output "master_ipv4_cidr_block" {
Expand Down Expand Up @@ -161,17 +174,4 @@ output "vertical_pod_autoscaling_enabled" {
description = "Whether veritical pod autoscaling is enabled"
value = local.cluster_vertical_pod_autoscaling_enabled
}

output "release_channel" {
description = "The release channel of this cluster"
value = var.release_channel
}

output "identity_namespace" {
description = "Workload Identity namespace"
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
depends_on = [
google_container_cluster.primary
]
}
{% endif %}
11 changes: 5 additions & 6 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,6 @@ variable "enable_pod_security_policy" {
default = false
}

variable "node_metadata" {
description = "Specifies how node metadata is exposed to the workload running on the node"
default = "GKE_METADATA_SERVER"
type = string
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand All @@ -492,6 +486,11 @@ variable "authenticator_security_group" {
}
{% endif %}

variable "node_metadata" {
description = "Specifies how node metadata is exposed to the workload running on the node"
default = "GKE_METADATA_SERVER"
type = string
}

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."
Expand Down
2 changes: 1 addition & 1 deletion examples/private_zonal_with_networking/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ data "google_compute_subnetwork" "subnetwork" {
}

module "gke" {
source = "../../modules/beta-private-cluster/"
source = "../../modules/private-cluster/"
project_id = var.project_id
name = var.cluster_name
regional = false
Expand Down
7 changes: 6 additions & 1 deletion examples/simple_zonal_with_asm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ provider "google-beta" {
region = var.region
}

provider "google" {
version = "~> 3.42.0"
region = var.region
}

data "google_project" "project" {
project_id = var.project_id
}

module "gke" {
source = "../../modules/beta-public-cluster/"
source = "../../"
project_id = var.project_id
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
regional = false
Expand Down
2 changes: 1 addition & 1 deletion examples/workload_identity/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ provider "kubernetes" {
}

module "gke" {
source = "../../modules/beta-public-cluster/"
source = "../../"
project_id = var.project_id
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
region = var.region
Expand Down
2 changes: 1 addition & 1 deletion examples/workload_metadata_config/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ data "google_compute_subnetwork" "subnetwork" {
}

module "gke" {
source = "../../modules/beta-private-cluster/"
source = "../../modules/private-cluster/"
project_id = var.project_id
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
regional = false
Expand Down
3 changes: 3 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ locals {
provider = null
}]

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
node_metadata = var.node_metadata
}]

cluster_output_name = google_container_cluster.primary.name
cluster_output_regional_zones = google_container_cluster.primary.node_locations
Expand Down
7 changes: 3 additions & 4 deletions modules/beta-private-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ locals {

cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
node_metadata = var.node_metadata
}]

cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]

cluster_sandbox_enabled = var.sandbox_enabled ? ["gvisor"] : []

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
node_metadata = var.node_metadata
}]

cluster_output_name = google_container_cluster.primary.name
cluster_output_regional_zones = google_container_cluster.primary.node_locations
Expand Down
26 changes: 13 additions & 13 deletions modules/beta-private-cluster-update-variant/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ output "service_account" {
value = local.service_account
}

output "release_channel" {
description = "The release channel of this cluster"
value = var.release_channel
}

output "identity_namespace" {
description = "Workload Identity namespace"
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
depends_on = [
google_container_cluster.primary
]
}

output "master_ipv4_cidr_block" {
description = "The IP range in CIDR notation used for the hosted master network"
value = var.master_ipv4_cidr_block
Expand Down Expand Up @@ -158,16 +171,3 @@ output "vertical_pod_autoscaling_enabled" {
description = "Whether veritical pod autoscaling is enabled"
value = local.cluster_vertical_pod_autoscaling_enabled
}

output "release_channel" {
description = "The release channel of this cluster"
value = var.release_channel
}

output "identity_namespace" {
description = "Workload Identity namespace"
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
depends_on = [
google_container_cluster.primary
]
}
11 changes: 5 additions & 6 deletions modules/beta-private-cluster-update-variant/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,6 @@ variable "enable_pod_security_policy" {
default = false
}

variable "node_metadata" {
description = "Specifies how node metadata is exposed to the workload running on the node"
default = "GKE_METADATA_SERVER"
type = string
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand All @@ -482,6 +476,11 @@ variable "authenticator_security_group" {
default = null
}

variable "node_metadata" {
description = "Specifies how node metadata is exposed to the workload running on the node"
default = "GKE_METADATA_SERVER"
type = string
}

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."
Expand Down
7 changes: 3 additions & 4 deletions modules/beta-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ locals {

cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
node_metadata = var.node_metadata
}]

cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]

cluster_sandbox_enabled = var.sandbox_enabled ? ["gvisor"] : []

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
node_metadata = var.node_metadata
}]

cluster_output_name = google_container_cluster.primary.name
cluster_output_regional_zones = google_container_cluster.primary.node_locations
Expand Down
26 changes: 13 additions & 13 deletions modules/beta-private-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ output "service_account" {
value = local.service_account
}

output "release_channel" {
description = "The release channel of this cluster"
value = var.release_channel
}

output "identity_namespace" {
description = "Workload Identity namespace"
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
depends_on = [
google_container_cluster.primary
]
}

output "master_ipv4_cidr_block" {
description = "The IP range in CIDR notation used for the hosted master network"
value = var.master_ipv4_cidr_block
Expand Down Expand Up @@ -158,16 +171,3 @@ output "vertical_pod_autoscaling_enabled" {
description = "Whether veritical pod autoscaling is enabled"
value = local.cluster_vertical_pod_autoscaling_enabled
}

output "release_channel" {
description = "The release channel of this cluster"
value = var.release_channel
}

output "identity_namespace" {
description = "Workload Identity namespace"
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
depends_on = [
google_container_cluster.primary
]
}
11 changes: 5 additions & 6 deletions modules/beta-private-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,6 @@ variable "enable_pod_security_policy" {
default = false
}

variable "node_metadata" {
description = "Specifies how node metadata is exposed to the workload running on the node"
default = "GKE_METADATA_SERVER"
type = string
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand All @@ -482,6 +476,11 @@ variable "authenticator_security_group" {
default = null
}

variable "node_metadata" {
description = "Specifies how node metadata is exposed to the workload running on the node"
default = "GKE_METADATA_SERVER"
type = string
}

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."
Expand Down
7 changes: 3 additions & 4 deletions modules/beta-public-cluster-update-variant/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,15 @@ locals {

cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
node_metadata = var.node_metadata
}]

cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]

cluster_sandbox_enabled = var.sandbox_enabled ? ["gvisor"] : []

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
node_metadata = var.node_metadata
}]

cluster_output_name = google_container_cluster.primary.name
cluster_output_regional_zones = google_container_cluster.primary.node_locations
Expand Down
26 changes: 13 additions & 13 deletions modules/beta-public-cluster-update-variant/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ output "service_account" {
value = local.service_account
}

output "release_channel" {
description = "The release channel of this cluster"
value = var.release_channel
}

output "identity_namespace" {
description = "Workload Identity namespace"
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
depends_on = [
google_container_cluster.primary
]
}

output "istio_enabled" {
description = "Whether Istio is enabled"
value = local.cluster_istio_enabled
Expand Down Expand Up @@ -148,16 +161,3 @@ output "vertical_pod_autoscaling_enabled" {
description = "Whether veritical pod autoscaling is enabled"
value = local.cluster_vertical_pod_autoscaling_enabled
}

output "release_channel" {
description = "The release channel of this cluster"
value = var.release_channel
}

output "identity_namespace" {
description = "Workload Identity namespace"
value = length(local.cluster_workload_identity_config) > 0 ? local.cluster_workload_identity_config[0].identity_namespace : null
depends_on = [
google_container_cluster.primary
]
}
Loading

0 comments on commit c1ab946

Please sign in to comment.