Skip to content

Commit

Permalink
add stub-domains and stub-domains-private
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed Jan 11, 2025
1 parent 590c97d commit 9ff81a7
Show file tree
Hide file tree
Showing 17 changed files with 643 additions and 367 deletions.
18 changes: 0 additions & 18 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,6 @@ suites:
systems:
- name: simple_regional_with_ipv6
backend: local
- name: "stub_domains"
transport:
root_module_directory: test/fixtures/stub_domains
verifier:
systems:
- name: stub_domains
backend: local
controls:
- gcloud
- kubectl
# Disabled due to issue #264
# (https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/264)
# - name: stub_domains_private
# transport:
# root_module_directory: test/fixtures/stub_domains_private
# systems:
# - name: stub_domains_private
# backend: local
- name: "stub_domains_upstream_nameservers"
transport:
root_module_directory: test/fixtures/stub_domains_upstream_nameservers
Expand Down
25 changes: 20 additions & 5 deletions build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,21 +200,36 @@ steps:
- verify simple-zonal-private-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestSimpleZonalPrivate --stage teardown --verbose']
- id: converge stub-domains-local
- id: apply stub-domains-local
waitFor:
- create-all
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 stub-domains-local']
args: ['/bin/bash', '-c', 'cft test run TestStubDomains --stage apply --verbose --test-dir test/integration']
- id: verify stub-domains-local
waitFor:
- converge stub-domains-local
- apply stub-domains-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 stub-domains-local']
args: ['/bin/bash', '-c', 'cft test run TestStubDomains --stage verify --verbose --test-dir test/integration']
- id: destroy stub-domains-local
waitFor:
- verify stub-domains-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 stub-domains-local']
args: ['/bin/bash', '-c', 'cft test run TestStubDomains --stage destroy --verbose --test-dir test/integration']
- id: apply stub-domains-private-local
waitFor:
- create-all
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestStubDomainsPrivate --stage apply --verbose --test-dir test/integration']
- id: verify stub-domains-private-local
waitFor:
- apply stub-domains-private-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestStubDomainsPrivate --stage verify --verbose --test-dir test/integration']
- id: destroy stub-domains-private-local
waitFor:
- verify stub-domains-private-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestStubDomainsPrivate --stage destroy --verbose --test-dir test/integration']
- id: apply upstream-nameservers-local
waitFor:
- create-all
Expand Down
8 changes: 6 additions & 2 deletions test/fixtures/stub_domains/example.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,10 @@
* limitations under the License.
*/

locals {
compute_engine_service_account = var.compute_engine_service_accounts[1]
}

module "example" {
source = "../../../examples/stub_domains"

Expand All @@ -24,6 +28,6 @@ module "example" {
subnetwork = google_compute_subnetwork.main.name
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_accounts[1]
compute_engine_service_account = local.compute_engine_service_account
}

10 changes: 9 additions & 1 deletion test/fixtures/stub_domains/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,3 +56,11 @@ output "service_account" {
description = "The service account to default running nodes as if not overridden in `node_pools`."
value = module.example.service_account
}

output "random_string" {
value = random_string.suffix.result
}

output "compute_engine_service_account" {
value = local.compute_engine_service_account
}
8 changes: 6 additions & 2 deletions test/fixtures/stub_domains_private/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,6 +14,10 @@
* limitations under the License.
*/

locals {
compute_engine_service_account = var.compute_engine_service_accounts[1]
}

resource "random_string" "suffix" {
length = 4
special = false
Expand Down Expand Up @@ -49,7 +53,7 @@ resource "google_compute_subnetwork" "main" {
module "example" {
source = "../../../examples/stub_domains_private"

compute_engine_service_account = var.compute_engine_service_accounts[1]
compute_engine_service_account = local.compute_engine_service_account
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
network = google_compute_network.main.name
Expand Down
10 changes: 9 additions & 1 deletion test/fixtures/stub_domains_private/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,3 +56,11 @@ output "service_account" {
description = "The service account to default running nodes as if not overridden in `node_pools`."
value = module.example.service_account
}

output "random_string" {
value = random_string.suffix.result
}

output "compute_engine_service_account" {
value = local.compute_engine_service_account
}
7 changes: 0 additions & 7 deletions test/integration/node_pool/testdata/TestNodePool.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@
"name": "default-pool",
"networkConfig": {
"podIpv4CidrBlock": "192.168.0.0/18",
"podIpv4RangeUtilization": 0.0624,
"podRange": "cft-gke-test-pods-RANDOM_STRING"
},
"podIpv4CidrSize": 24,
Expand Down Expand Up @@ -302,7 +301,6 @@
"name": "nap-e2-medium-1d469r1p",
"networkConfig": {
"podIpv4CidrBlock": "192.168.0.0/18",
"podIpv4RangeUtilization": 0.0624,
"podRange": "cft-gke-test-pods-RANDOM_STRING"
},
"placementPolicy": {},
Expand Down Expand Up @@ -395,7 +393,6 @@
"name": "pool-01",
"networkConfig": {
"podIpv4CidrBlock": "192.168.0.0/18",
"podIpv4RangeUtilization": 0.0624,
"podRange": "cft-gke-test-pods-RANDOM_STRING"
},
"podIpv4CidrSize": 24,
Expand Down Expand Up @@ -490,7 +487,6 @@
"name": "pool-02",
"networkConfig": {
"podIpv4CidrBlock": "192.168.0.0/18",
"podIpv4RangeUtilization": 0.0624,
"podRange": "cft-gke-test-pods-RANDOM_STRING"
},
"podIpv4CidrSize": 24,
Expand Down Expand Up @@ -583,7 +579,6 @@
"networkConfig": {
"enablePrivateNodes": false,
"podIpv4CidrBlock": "172.16.0.0/18",
"podIpv4RangeUtilization": 0.0625,
"podRange": "test"
},
"podIpv4CidrSize": 24,
Expand Down Expand Up @@ -671,7 +666,6 @@
"name": "pool-04",
"networkConfig": {
"podIpv4CidrBlock": "192.168.0.0/18",
"podIpv4RangeUtilization": 0.0624,
"podRange": "cft-gke-test-pods-RANDOM_STRING"
},
"podIpv4CidrSize": 24,
Expand Down Expand Up @@ -759,7 +753,6 @@
"name": "pool-05",
"networkConfig": {
"podIpv4CidrBlock": "192.168.0.0/18",
"podIpv4RangeUtilization": 0.0624,
"podRange": "cft-gke-test-pods-RANDOM_STRING"
},
"podIpv4CidrSize": 24,
Expand Down
52 changes: 0 additions & 52 deletions test/integration/stub_domains/controls/gcloud.rb

This file was deleted.

88 changes: 0 additions & 88 deletions test/integration/stub_domains/controls/kubectl.rb

This file was deleted.

34 changes: 0 additions & 34 deletions test/integration/stub_domains/inspec.yml

This file was deleted.

Loading

0 comments on commit 9ff81a7

Please sign in to comment.