Skip to content

Commit 49b5aa6

Browse files
Beta cluster tests to cloudbuild
1 parent 4be95bc commit 49b5aa6

File tree

6 files changed

+48
-12
lines changed

6 files changed

+48
-12
lines changed

build/int.cloudbuild.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,26 @@ steps:
241241
- verify workload-metadata-config-local
242242
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
243243
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy workload-metadata-config-local']
244+
- id: create beta-cluster-local
245+
waitFor:
246+
- prepare
247+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
248+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do create beta-cluster-local']
249+
- id: converge beta-cluster-local
250+
waitFor:
251+
- create beta-cluster-local
252+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
253+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge beta-cluster-local']
254+
- id: verify beta-cluster-local
255+
waitFor:
256+
- converge beta-cluster-local
257+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
258+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify beta-cluster-local']
259+
- id: destroy beta-cluster-local
260+
waitFor:
261+
- verify beta-cluster-local
262+
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
263+
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy sandbox-enabled-local']
244264
- id: create sandbox-enabled-local
245265
waitFor:
246266
- prepare
@@ -264,6 +284,8 @@ steps:
264284
tags:
265285
- 'ci'
266286
- 'integration'
287+
options:
288+
machineType: 'N1_HIGHCPU_8'
267289
substitutions:
268290
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
269291
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.4.6'

test/fixtures/beta_cluster/main.tf

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717

1818
provider "google" {
19-
version = "~> 2.9.0"
19+
version = "~> 2.18.0"
2020
project = var.project_id
2121
region = var.region
2222
}
2323

2424
provider "google-beta" {
25-
version = "~> 2.9.0"
25+
version = "~> 2.18.0"
2626
project = var.project_id
2727
region = var.region
2828
}
@@ -56,17 +56,22 @@ module "this" {
5656
service_account = "create"
5757

5858
// Beta features
59-
istio = true
60-
database_encryption = [{
59+
istio = true
60+
61+
database_encryption = [{
6162
state = "ENCRYPTED"
6263
key_name = google_kms_crypto_key.db.self_link
6364
}]
64-
cloudrun = true
65+
66+
cloudrun = true
67+
6568
enable_binary_authorization = true
66-
pod_security_policy_config = [{
69+
70+
pod_security_policy_config = [{
6771
enabled = true
6872
}]
69-
node_metadata = "EXPOSE"
73+
74+
node_metadata = "EXPOSE"
7075
}
7176

7277
data "google_client_config" "default" {

test/fixtures/beta_cluster/terraform.tfvars

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/integration/beta_cluster/controls/gcloud.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Copyright 2018 Google LLC
1+
# Copyright 2019 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
66
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# https://www.apache.org/licenses/LICENSE-2.0
88
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,

test/integration/beta_cluster/controls/gcp.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Copyright 2018 Google LLC
1+
# Copyright 2019 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
66
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# https://www.apache.org/licenses/LICENSE-2.0
88
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,

test/setup/iam.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
locals {
1818
int_required_roles = [
19+
"roles/cloudkms.admin",
1920
"roles/cloudkms.cryptoKeyEncrypterDecrypter",
2021
"roles/compute.networkAdmin",
2122
"roles/container.clusterAdmin",
@@ -56,3 +57,12 @@ resource "google_project_iam_member" "int_test" {
5657
resource "google_service_account_key" "int_test" {
5758
service_account_id = google_service_account.int_test.id
5859
}
60+
61+
resource "google_project_iam_binding" "kubernetes_engine_kms_access" {
62+
project = module.gke-project.project_id
63+
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
64+
65+
members = [
66+
"serviceAccount:service-${module.gke-project.project_number}@container-engine-robot.iam.gserviceaccount.com",
67+
]
68+
}

0 commit comments

Comments
 (0)