Skip to content

Commit

Permalink
* Fix #93
Browse files Browse the repository at this point in the history
Moved cluster autos scaling config to node_pool fixture to fix project networks quota
  • Loading branch information
kopachevsky committed Nov 19, 2019
1 parent 45e0063 commit d6f9969
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 310 deletions.
7 changes: 0 additions & 7 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ suites:
systems:
- name: simple_regional
backend: local
- name: "simple_regional_beta"
driver:
root_module_directory: test/fixtures/simple_regional_beta
verifier:
systems:
- name: simple_regional_beta
backend: local
- name: "simple_regional_with_networking"
driver:
root_module_directory: test/fixtures/simple_regional_with_networking
Expand Down
20 changes: 0 additions & 20 deletions build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,6 @@ steps:
- verify simple-regional-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy simple-regional-local']
- id: create simple-regional-beta-local
waitFor:
- prepare
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create simple-regional-beta-local']
- id: converge simple-regional-beta-local
waitFor:
- create simple-regional-beta-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge simple-regional-beta-local']
- id: verify simple-regional-beta-local
waitFor:
- converge simple-regional-beta-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify simple-regional-beta-local']
- id: destroy simple-regional-beta-local
waitFor:
- verify simple-regional-beta-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy simple-regional-beta-local']
- id: create simple-regional-private-local
waitFor:
- prepare
Expand Down
1 change: 1 addition & 0 deletions examples/node_pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This example illustrates how to create a cluster with multiple custom node-pool

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | object | `<map>` | no |
| cluster\_name\_suffix | A suffix to append to the default cluster name | string | `""` | no |
| compute\_engine\_service\_account | Service account to associate to the nodes in the cluster | string | n/a | yes |
| ip\_range\_pods | The secondary ip range to use for pods | string | n/a | yes |
Expand Down
3 changes: 2 additions & 1 deletion examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ provider "google-beta" {
module "gke" {
source = "../../modules/beta-public-cluster/"
project_id = var.project_id
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
name = join("", [local.cluster_type, "-cluster", var.cluster_name_suffix])
region = var.region
zones = var.zones
network = var.network
Expand All @@ -36,6 +36,7 @@ module "gke" {
create_service_account = false
remove_default_node_pool = true
disable_legacy_metadata_endpoints = false
cluster_autoscaling = var.cluster_autoscaling

node_pools = [
{
Expand Down
11 changes: 11 additions & 0 deletions examples/node_pool/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,14 @@ variable "compute_engine_service_account" {
description = "Service account to associate to the nodes in the cluster"
}

variable "cluster_autoscaling" {
type = object({
enabled = bool
resource_limits = map(number)
})
default = {
enabled = false
resource_limits = {}
}
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
}
10 changes: 10 additions & 0 deletions test/fixtures/node_pool/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,15 @@ module "example" {
ip_range_pods = google_compute_subnetwork.main.secondary_ip_range[0].range_name
ip_range_services = google_compute_subnetwork.main.secondary_ip_range[1].range_name
compute_engine_service_account = var.compute_engine_service_account

cluster_autoscaling = {
enabled = true
resource_limits = {
max_cpu_cores = 20
min_cpu_cores = 5
max_memory_gb = 30
min_memory_gb = 10
}
}
}

38 changes: 0 additions & 38 deletions test/fixtures/simple_regional_beta/example.tf

This file was deleted.

48 changes: 0 additions & 48 deletions test/fixtures/simple_regional_beta/network.tf

This file was deleted.

84 changes: 0 additions & 84 deletions test/fixtures/simple_regional_beta/outputs.tf

This file was deleted.

38 changes: 0 additions & 38 deletions test/fixtures/simple_regional_beta/variables.tf

This file was deleted.

24 changes: 24 additions & 0 deletions test/integration/node_pool/controls/gcloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,30 @@
end
end

describe "cluster-autoscaling" do
it "has the expected cluster autoscaling settings" do
expect(data['autoscaling']).to eq({
"autoprovisioningNodePoolDefaults" => {
"oauthScopes" => %w(https://www.googleapis.com/auth/logging.write https://www.googleapis.com/auth/monitoring),
"serviceAccount" => "default"
},
"enableNodeAutoprovisioning" => true,
"resourceLimits" => [
{
"maximum" => "20",
"minimum" => "5",
"resourceType" => "cpu"
},
{
"maximum" => "30",
"minimum" => "10",
"resourceType" => "memory"
}
]
})
end
end

describe "node pools" do
let(:node_pools) { data['nodePools'].reject { |p| p['name'] == "default-pool" } }

Expand Down
57 changes: 0 additions & 57 deletions test/integration/simple_regional_beta/controls/gcloud.rb

This file was deleted.

Loading

0 comments on commit d6f9969

Please sign in to comment.