-
Notifications
You must be signed in to change notification settings - Fork 859
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 prow build clusters #830
Merged
+1,290
−162
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
94c618a
move k8s-infra-gke modules out of cluster dir
spiffxp d6f85c4
switch terraform required version to ~> 0.12.20
spiffxp 59c074f
Support is_prod_cluster in k8s-infra-gke-cluster
spiffxp 3de2295
add image_type to nodepool module
spiffxp c112e9a
Initial spike for k8s-infra-prow-build
spiffxp 96d1693
add k8s resources intended for prow-build
spiffxp e3a3be6
change boskos pool name to k8s-infra-gce-project
spiffxp f9cdbcd
add k8s-infra-prow-build-trusted
spiffxp c1b8f4e
add k8s resources intended for prow-build-trusted
spiffxp 8606717
setup a gcb-builder svcacct for prow-build-trusted
spiffxp acb0f31
create k8s-infra-e2e-projects and add to boskos
spiffxp 179a7dc
Add READMEs for prow-build and prow-build-trusted
spiffxp 17ffbd5
enable stackdriver in prow-build projects
spiffxp 672d113
Migrate prow-build nodepool to ubuntu-containerd
spiffxp 9d9483e
remove prow-build-test cluster
spiffxp 3c2e795
refactor: make a projects dir
spiffxp b834ccd
refactor: drop k8s-infra prefix from modules
spiffxp e8ea80d
drop TODOs about access
spiffxp 0d83cf8
add scary comments for ugly hack
spiffxp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
infra/gcp/clusters/k8s-infra-prow-build-trusted/prow-build-trusted/00-provider.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
This file defines: | ||
- Required Terraform version | ||
- Required provider versions | ||
- Storage backend details | ||
*/ | ||
|
||
terraform { | ||
required_version = "~> 0.12.20" | ||
|
||
backend "gcs" { | ||
bucket = "k8s-infra-clusters-terraform" | ||
prefix = "k8s-infra-prow-build-trusted/prow-build-trusted" // $project_name/$cluster_name | ||
} | ||
|
||
required_providers { | ||
google = "~> 3.19.0" | ||
google-beta = "~> 3.19.0" | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
infra/gcp/clusters/k8s-infra-prow-build-trusted/prow-build-trusted/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/** | ||
* Copyright 2020 The Kubernetes Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
This file defines: | ||
- Google Project k8s-infra-prow-build-trusted to host the cluster | ||
- GCP Service Account for prow-build-trusted | ||
- GKE cluster configuration for prow-build-trusted | ||
- GKE nodepool configuration for prow-build-trusted | ||
*/ | ||
|
||
locals { | ||
project_id = "k8s-infra-prow-build-trusted" | ||
cluster_name = "prow-build-trusted" // The name of the cluster defined in this file | ||
cluster_ksa_name = "prow-build-trusted" // MUST match the name of the KSA intended to use the prow_build_cluster_sa serviceaccount | ||
cluster_location = "us-central1" // The GCP location (region or zone) where the cluster should be created | ||
bigquery_location = "US" // The bigquery specific location where the dataset should be created | ||
pod_namespace = "test-pods" // MUST match whatever prow is configured to use when it schedules to this cluster | ||
} | ||
|
||
// TODO: I think more people than me should have owner/edit access to this project | ||
spiffxp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
module "project" { | ||
source = "../../modules/k8s-infra-gke-project" | ||
project_id = local.project_id | ||
project_name = local.project_id | ||
} | ||
|
||
// Create GCP SA for pods | ||
resource "google_service_account" "prow_build_cluster_sa" { | ||
project = local.project_id | ||
account_id = local.cluster_name | ||
display_name = "Used by pods in '${local.cluster_name}' GKE cluster" | ||
} | ||
// Allow pods using the build cluster KSA to use the GCP SA via workload identity | ||
data "google_iam_policy" "prow_build_cluster_sa_workload_identity" { | ||
binding { | ||
role = "roles/iam.workloadIdentityUser" | ||
|
||
members = [ | ||
"serviceAccount:${local.project_id}.svc.id.goog[${local.pod_namespace}/${local.cluster_ksa_name}]", | ||
] | ||
} | ||
} | ||
// Authoritative iam-policy: replaces any existing policy attached to this service_account | ||
resource "google_service_account_iam_policy" "prow_build_cluster_sa_iam" { | ||
service_account_id = google_service_account.prow_build_cluster_sa.name | ||
policy_data = data.google_iam_policy.prow_build_cluster_sa_workload_identity.policy_data | ||
} | ||
|
||
module "prow_build_cluster" { | ||
source = "../../modules/k8s-infra-gke-cluster" | ||
project_name = local.project_id | ||
cluster_name = local.cluster_name | ||
cluster_location = local.cluster_location | ||
bigquery_location = local.bigquery_location | ||
is_prod_cluster = "true" | ||
} | ||
|
||
module "prow_build_nodepool" { | ||
source = "../../modules/k8s-infra-gke-nodepool" | ||
project_name = local.project_id | ||
cluster_name = module.prow_build_cluster.cluster.name | ||
location = module.prow_build_cluster.cluster.location | ||
name = "trusted-pool1" | ||
min_count = 1 | ||
max_count = 3 | ||
machine_type = "n1-standard-8" | ||
disk_size_gb = 200 | ||
disk_type = "pd-standard" | ||
service_account = module.prow_build_cluster.cluster_node_sa.email | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I pick on names? I like symmetry, so I'd expect to see
k8s-infra-prow-build
+k8s-infra-prow-trusted
or
k8s-infra-prow-untrusted
+k8s-infra-prow-trusted
or
k8s-infra-prow-build-untrusted
+k8s-infra-prow-build-trusted
Is there a reason not to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well. I like all of these suggestions better than what I chose. I prefer the first since the names are shortest.
The reason not to would be that renaming the project id at this point is going to involve creating a new project/cluster/nodepool combo along with the requisite coordination with prow.k8s.io oncall. The blocker at the moment is our projects being capped at billing quota.
I can file an issue to redo the trusted cluster as
k8s-infra-prow-trusted/prow-trusted
and use it as an opportunity to have someone shadow, or someone else go through this while I watch.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you think the rename is worth it I'll open a ticket, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair.