Skip to content

Commit

Permalink
Merge branch 'master' into ap/migrateasmwq
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody authored Dec 21, 2024
2 parents 80530bd + 0f536b7 commit 9bd874e
Show file tree
Hide file tree
Showing 28 changed files with 1,303 additions and 1,856 deletions.
30 changes: 0 additions & 30 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,40 +78,10 @@ suites:
systems:
- name: stub_domains_upstream_nameservers
backend: local
- name: "workload_identity"
transport:
root_module_directory: test/fixtures/workload_identity
verifier:
systems:
- name: gcloud
backend: local
controls:
- gcloud
- name: gcp
backend: gcp
controls:
- gcp
- name: "workload_metadata_config"
transport:
root_module_directory: test/fixtures/workload_metadata_config
verifier:
systems:
- name: workload_metadata_config
backend: local
- name: "node_pool"
transport:
root_module_directory: test/fixtures/node_pool
verifier:
systems:
- name: node_pool
backend: local
controls:
- gcloud
- kubectl
- name: "safer_cluster_iap_bastion"
transport:
root_module_directory: test/fixtures/safer_cluster_iap_bastion
verifier:
systems:
- name: safer_cluster_iap_bastion
backend: local
2 changes: 1 addition & 1 deletion autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ resource "google_container_cluster" "primary" {
}

{% if beta_cluster %}
min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "")
min_cpu_platform = lookup(var.cluster_autoscaling, "min_cpu_platform", "")
{% endif %}

image_type = lookup(var.cluster_autoscaling, "image_type", "COS_CONTAINERD")
Expand Down
30 changes: 15 additions & 15 deletions build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,21 @@ steps:
- verify deploy-service-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestDeployService --stage destroy --verbose']
- id: converge node-pool-local
- id: apply node-pool-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 node-pool-local']
args: ['/bin/bash', '-c', 'cft test run TestNodePool --stage apply --verbose']
- id: verify node-pool-local
waitFor:
- converge node-pool-local
- apply node-pool-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 node-pool-local']
args: ['/bin/bash', '-c', 'cft test run TestNodePool --stage verify --verbose']
- id: destroy node-pool-local
waitFor:
- verify node-pool-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 node-pool-local']
args: ['/bin/bash', '-c', 'cft test run TestNodePool --stage destroy --verbose']
- id: apply sandbox-enabled-local
waitFor:
- create-all
Expand All @@ -335,36 +335,36 @@ steps:
- verify sandbox-enabled-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'cft test run TestSandboxEnabled --stage destroy --verbose']
- id: converge workload-identity-local
- id: apply workload-identity-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 workload-identity-local']
args: ['/bin/bash', '-c', 'cft test run TestWorkloadIdentity --stage apply --verbose']
- id: verify workload-identity-local
waitFor:
- converge workload-identity-local
- apply workload-identity-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 workload-identity-local']
args: ['/bin/bash', '-c', 'cft test run TestWorkloadIdentity --stage verify --verbose']
- id: destroy workload-identity-local
waitFor:
- verify workload-identity-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 workload-identity-local']
- id: converge safer-cluster-iap-bastion-local
args: ['/bin/bash', '-c', 'cft test run TestWorkloadIdentity --stage teardown --verbose']
- id: apply safer-cluster-iap-bastion-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 safer-cluster-iap-bastion-local']
args: ['/bin/bash', '-c', 'cft test run TestSaferClusterIapBastion --stage apply --verbose']
- id: verify safer-cluster-iap-bastion-local
waitFor:
- converge safer-cluster-iap-bastion-local
- apply safer-cluster-iap-bastion-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 safer-cluster-iap-bastion-local']
args: ['/bin/bash', '-c', 'cft test run TestSaferClusterIapBastion --stage verify --verbose']
- id: destroy safer-cluster-iap-bastion-local
waitFor:
- verify safer-cluster-iap-bastion-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 safer-cluster-iap-bastion-local']
args: ['/bin/bash', '-c', 'cft test run TestSaferClusterIapBastion --stage teardown --verbose']
- id: apply simple-zonal-with-asm-local
waitFor:
- create-all
Expand Down
1 change: 1 addition & 0 deletions examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module "gke" {
disable_legacy_metadata_endpoints = false
cluster_autoscaling = var.cluster_autoscaling
deletion_protection = false
service_account = "default"

node_pools = [
{
Expand Down
1 change: 1 addition & 0 deletions examples/simple_regional_cluster_autoscaling/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ module "gke" {
cluster_autoscaling = {
enabled = true
autoscaling_profile = "OPTIMIZE_UTILIZATION"
min_cpu_platform = "Intel Skylake"
min_cpu_cores = 4
max_cpu_cores = 86
min_memory_gb = 16
Expand Down
6 changes: 5 additions & 1 deletion examples/workload_identity/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2024 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 @@ -24,6 +24,10 @@ provider "kubernetes" {
host = "https://${module.gke.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(module.gke.ca_certificate)

ignore_annotations = [
"^iam.gke.io\\/.*"
]
}

module "gke" {
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ resource "google_container_cluster" "primary" {
enable_integrity_monitoring = lookup(var.cluster_autoscaling, "enable_integrity_monitoring", true)
}

min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "")
min_cpu_platform = lookup(var.cluster_autoscaling, "min_cpu_platform", "")

image_type = lookup(var.cluster_autoscaling, "image_type", "COS_CONTAINERD")
}
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-private-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ resource "google_container_cluster" "primary" {
enable_integrity_monitoring = lookup(var.cluster_autoscaling, "enable_integrity_monitoring", true)
}

min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "")
min_cpu_platform = lookup(var.cluster_autoscaling, "min_cpu_platform", "")

image_type = lookup(var.cluster_autoscaling, "image_type", "COS_CONTAINERD")
}
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ resource "google_container_cluster" "primary" {
enable_integrity_monitoring = lookup(var.cluster_autoscaling, "enable_integrity_monitoring", true)
}

min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "")
min_cpu_platform = lookup(var.cluster_autoscaling, "min_cpu_platform", "")

image_type = lookup(var.cluster_autoscaling, "image_type", "COS_CONTAINERD")
}
Expand Down
2 changes: 1 addition & 1 deletion modules/beta-public-cluster/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ resource "google_container_cluster" "primary" {
enable_integrity_monitoring = lookup(var.cluster_autoscaling, "enable_integrity_monitoring", true)
}

min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "")
min_cpu_platform = lookup(var.cluster_autoscaling, "min_cpu_platform", "")

image_type = lookup(var.cluster_autoscaling, "image_type", "COS_CONTAINERD")
}
Expand Down
6 changes: 5 additions & 1 deletion test/fixtures/node_pool/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
* limitations under the License.
*/

locals {
compute_engine_service_account = var.compute_engine_service_accounts[0]
}

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

Expand All @@ -25,7 +29,7 @@ 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[0]
compute_engine_service_account = local.compute_engine_service_account

cluster_autoscaling = {
enabled = true
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/node_pool/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,11 @@ output "service_account" {
output "registry_project_ids" {
value = var.registry_project_ids
}

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

output "compute_engine_service_account" {
value = local.compute_engine_service_account
}
106 changes: 65 additions & 41 deletions test/integration/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,94 @@ go 1.22.7
toolchain go1.23.4

require (
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.17.0
github.com/gruntwork-io/terratest v0.47.2
github.com/hashicorp/terraform-json v0.23.0
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.17.3
github.com/gruntwork-io/terratest v0.48.1
github.com/hashicorp/terraform-json v0.24.0
github.com/stretchr/testify v1.10.0
github.com/tidwall/gjson v1.18.0
golang.org/x/sync v0.10.0
)

require (
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.2 // indirect
cloud.google.com/go/storage v1.33.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/alexflint/go-filemutex v1.3.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aws/aws-sdk-go v1.45.5 // indirect
github.com/aws/aws-sdk-go-v2 v1.32.5 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 // indirect
github.com/aws/aws-sdk-go-v2/config v1.28.5 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.46 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.41 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.24 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.24 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.24 // indirect
github.com/aws/aws-sdk-go-v2/service/acm v1.30.6 // indirect
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.51.0 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.44.0 // indirect
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.37.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ec2 v1.193.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ecr v1.36.6 // indirect
github.com/aws/aws-sdk-go-v2/service/ecs v1.52.0 // indirect
github.com/aws/aws-sdk-go-v2/service/iam v1.38.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.5 // indirect
github.com/aws/aws-sdk-go-v2/service/kms v1.37.6 // indirect
github.com/aws/aws-sdk-go-v2/service/lambda v1.69.0 // indirect
github.com/aws/aws-sdk-go-v2/service/rds v1.91.0 // indirect
github.com/aws/aws-sdk-go-v2/service/route53 v1.46.2 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.69.0 // indirect
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sns v1.33.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sqs v1.37.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.6 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.33.1 // indirect
github.com/aws/smithy-go v1.22.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/boombuler/barcode v1.0.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/go-errors/errors v1.5.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/gruntwork-io/go-commons v0.17.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter v1.7.6 // indirect
github.com/hashicorp/go-getter/v2 v2.2.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f // indirect
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
github.com/hashicorp/terraform-config-inspect v0.0.0-20241107133921-3adb156ecfe2 // indirect
github.com/hashicorp/hcl/v2 v2.22.0 // indirect
github.com/hashicorp/terraform-config-inspect v0.0.0-20241129133400-c404f8227ea6 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.1 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/copier v0.4.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-shellwords v1.0.12 // indirect
github.com/mattn/go-zglob v0.0.4 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.2-0.20210821155943-2d9075ca8770 // indirect
Expand All @@ -71,34 +105,24 @@ require (
github.com/pquerna/otp v1.4.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
github.com/tmccombs/hcl2json v0.6.0 // indirect
github.com/tmccombs/hcl2json v0.6.4 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/urfave/cli/v2 v2.25.7 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/zclconf/go-cty v1.15.0 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
github.com/zclconf/go-cty v1.15.1 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.138.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
google.golang.org/grpc v1.58.3 // indirect
google.golang.org/protobuf v1.33.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.24.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.8.0 // indirect
golang.org/x/tools v0.22.0 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 9bd874e

Please sign in to comment.