Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add network_policy to google_container_cluster #159

Merged
merged 4 commits into from
Jun 5, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,93 +30,50 @@ platforms:
suites:
- name: "deploy_service"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/deploy_service
verifier:
name: terraform
color: false
systems:
- name: deploy_service
backend: local
lifecycle:
pre_verify:
- sleep 10
provisioner:
name: terraform
- name: "disable_client_cert"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/disable_client_cert
verifier:
name: terraform
color: false
systems:
- name: disable_client_cert
backend: local
provisioner:
name: terraform
- name: "node_pool"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/node_pool
verifier:
name: terraform
color: false
systems:
- name: node_pool
backend: local
provisioner:
name: terraform
- name: "shared_vpc"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/shared_vpc
verifier:
name: terraform
color: false
systems:
- name: shared_vpc
backend: local
provisioner:
name: terraform
- name: "simple_regional"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/simple_regional
verifier:
name: terraform
color: false
systems:
- name: simple_regional
backend: local
provisioner:
name: terraform
- name: "simple_regional_private"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/simple_regional_private
verifier:
name: terraform
color: false
systems:
- name: simple_regional_private
backend: local
provisioner:
name: terraform
- name: "simple_zonal"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/simple_zonal
verifier:
name: terraform
color: false
systems:
- name: gcloud
backend: local
Expand All @@ -126,34 +83,20 @@ suites:
backend: gcp
controls:
- gcp
provisioner:
name: terraform
- name: "simple_zonal_private"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/simple_zonal_private
verifier:
name: terraform
color: false
systems:
- name: simple_zonal_private
backend: local
provisioner:
name: terraform
- name: "stub_domains"
driver:
name: "terraform"
command_timeout: 1800
root_module_directory: test/fixtures/stub_domains
verifier:
name: terraform
color: false
systems:
- name: stub_domains
backend: local
provisioner:
name: terraform
- name: stub_domains_private
driver:
root_module_directory: test/fixtures/stub_domains_private
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| name | The name of the cluster (required) | string | n/a | yes |
| network | The VPC network to host the cluster in (required) | string | n/a | yes |
| network\_policy | Enable network policy addon | string | `"false"` | no |
| network\_policy\_provider | The network policy provider. | string | `"PROVIDER_UNSPECIFIED"` | no |
| network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | string | `""` | no |
| node\_pools | List of maps containing node pools | list | `<list>` | no |
| node\_pools\_labels | Map of maps containing node labels by node-pool name | map | `<map>` | no |
Expand Down
8 changes: 7 additions & 1 deletion autogen/cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ resource "google_container_cluster" "primary" {
region = "${var.region}"
node_locations = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]

network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"

network_policy {
enabled = "${var.network_policy}"
provider = "${var.network_policy_provider}"
}

subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"
min_master_version = "${local.kubernetes_version_regional}"

Expand Down
8 changes: 7 additions & 1 deletion autogen/cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ resource "google_container_cluster" "zonal_primary" {
zone = "${var.zones[0]}"
node_locations = ["${slice(var.zones,1,length(var.zones))}"]

network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"

network_policy {
enabled = "${var.network_policy}"
provider = "${var.network_policy_provider}"
}

subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"
min_master_version = "${local.kubernetes_version_zonal}"

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

variable "network_policy_provider" {
description = "The network policy provider."
default = "PROVIDER_UNSPECIFIED"
aaron-lane marked this conversation as resolved.
Show resolved Hide resolved
}

variable "maintenance_start_time" {
description = "Time window specified for daily maintenance operations in RFC3339 format"
default = "05:00"
Expand Down
8 changes: 7 additions & 1 deletion cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ resource "google_container_cluster" "primary" {
region = "${var.region}"
node_locations = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]

network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"

network_policy {
enabled = "${var.network_policy}"
provider = "${var.network_policy_provider}"
}

subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"
min_master_version = "${local.kubernetes_version_regional}"

Expand Down
8 changes: 7 additions & 1 deletion cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ resource "google_container_cluster" "zonal_primary" {
zone = "${var.zones[0]}"
node_locations = ["${slice(var.zones,1,length(var.zones))}"]

network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"

network_policy {
enabled = "${var.network_policy}"
provider = "${var.network_policy_provider}"
}

subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"
min_master_version = "${local.kubernetes_version_zonal}"

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 @@ -144,6 +144,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
| name | The name of the cluster (required) | string | n/a | yes |
| network | The VPC network to host the cluster in (required) | string | n/a | yes |
| network\_policy | Enable network policy addon | string | `"false"` | no |
| network\_policy\_provider | The network policy provider. | string | `"PROVIDER_UNSPECIFIED"` | no |
| network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | string | `""` | no |
| node\_pools | List of maps containing node pools | list | `<list>` | no |
| node\_pools\_labels | Map of maps containing node labels by node-pool name | map | `<map>` | no |
Expand Down
8 changes: 7 additions & 1 deletion modules/private-cluster/cluster_regional.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ resource "google_container_cluster" "primary" {
region = "${var.region}"
node_locations = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]

network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"

network_policy {
enabled = "${var.network_policy}"
provider = "${var.network_policy_provider}"
}

subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"
min_master_version = "${local.kubernetes_version_regional}"

Expand Down
8 changes: 7 additions & 1 deletion modules/private-cluster/cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ resource "google_container_cluster" "zonal_primary" {
zone = "${var.zones[0]}"
node_locations = ["${slice(var.zones,1,length(var.zones))}"]

network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"

network_policy {
enabled = "${var.network_policy}"
provider = "${var.network_policy_provider}"
}

subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"
min_master_version = "${local.kubernetes_version_zonal}"

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 @@ -106,6 +106,11 @@ variable "network_policy" {
default = false
}

variable "network_policy_provider" {
description = "The network policy provider."
default = "PROVIDER_UNSPECIFIED"
}

variable "maintenance_start_time" {
description = "Time window specified for daily maintenance operations in RFC3339 format"
default = "05:00"
Expand Down
1 change: 0 additions & 1 deletion test/ci_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ main() {
# Execute the test lifecycle
kitchen create "$SUITE"
kitchen converge "$SUITE"
kitchen converge "$SUITE"
kitchen verify "$SUITE"
}

Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ variable "network_policy" {
default = false
}

variable "network_policy_provider" {
description = "The network policy provider."
default = "PROVIDER_UNSPECIFIED"
}

variable "maintenance_start_time" {
description = "Time window specified for daily maintenance operations in RFC3339 format"
default = "05:00"
Expand Down