-
Notifications
You must be signed in to change notification settings - Fork 852
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2442 from spiffxp/setup-k8s-metrics-canary
infra/gcp/main: add k8s-project-metrics special-case
- Loading branch information
Showing
3 changed files
with
82 additions
and
21 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Prow service accounts | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
|
@@ -7,20 +8,30 @@ metadata: | |
name: prow-build-trusted | ||
namespace: test-pods | ||
--- | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
annotations: | ||
iam.gke.io/gcp-service-account: prow-deployer@k8s-infra-prow-build-trusted.iam.gserviceaccount.com | ||
name: prow-deployer | ||
namespace: test-pods | ||
--- | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
annotations: | ||
iam.gke.io/gcp-service-account: k8s-infra-gcp-auditor@kubernetes-public.iam.gserviceaccount.com | ||
name: k8s-infra-gcp-auditor | ||
iam.gke.io/gcp-service-account: k8s-metrics@k8s-infra-prow-build-trusted.iam.gserviceaccount.com | ||
name: k8s-metrics | ||
namespace: test-pods | ||
|
||
# Infrastructure management service accounts | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
annotations: | ||
iam.gke.io/gcp-service-account: gcb-builder@k8s-infra-prow-build-trusted.iam.gserviceaccount.com | ||
name: gcb-builder | ||
iam.gke.io/gcp-service-account: k8s-infra-gcp-auditor@kubernetes-public.iam.gserviceaccount.com | ||
name: k8s-infra-gcp-auditor | ||
namespace: test-pods | ||
--- | ||
kind: ServiceAccount | ||
|
@@ -38,30 +49,33 @@ metadata: | |
iam.gke.io/gcp-service-account: [email protected] | ||
name: gsuite-groups-manager | ||
namespace: test-pods | ||
|
||
# Image promotion service accounts | ||
--- | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
annotations: | ||
iam.gke.io/gcp-service-account: prow-deployer@k8s-infra-prow-build-trusted.iam.gserviceaccount.com | ||
name: prow-deployer | ||
iam.gke.io/gcp-service-account: k8s-infra-gcr-promoter@k8s-artifacts-prod.iam.gserviceaccount.com | ||
name: k8s-infra-gcr-promoter | ||
namespace: test-pods | ||
--- | ||
# Image promotion service accounts | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
annotations: | ||
iam.gke.io/gcp-service-account: k8s-infra-gcr-promoter@k8s-artifacts-prod.iam.gserviceaccount.com | ||
name: k8s-infra-gcr-promoter | ||
iam.gke.io/gcp-service-account: k8s-infra-gcr-promoter@k8s-artifacts-prod-bak.iam.gserviceaccount.com | ||
name: k8s-infra-gcr-promoter-bak | ||
namespace: test-pods | ||
|
||
# Staging service accounts | ||
--- | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
annotations: | ||
iam.gke.io/gcp-service-account: k8s-infra-gcr-promoter@k8s-artifacts-prod-bak.iam.gserviceaccount.com | ||
name: k8s-infra-gcr-promoter-bak | ||
iam.gke.io/gcp-service-account: gcb-builder@k8s-infra-prow-build-trusted.iam.gserviceaccount.com | ||
name: gcb-builder | ||
namespace: test-pods | ||
--- | ||
kind: ServiceAccount | ||
|
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 |
---|---|---|
|
@@ -396,11 +396,36 @@ function ensure_prow_special_cases { | |
return 1 | ||
fi | ||
local project="${1}" | ||
|
||
local bucket principal secret | ||
|
||
color 6 "Special case: ensuring k8s-infra-ci-robot-github-token accessible by k8s-infra-prow-build-trusted" | ||
local principal secret | ||
principal="serviceAccount:$(svc_acct_email "k8s-infra-prow-build-trusted" "kubernetes-external-secrets")" | ||
secret=$(secret_full_name "${project}" "k8s-infra-ci-robot-github-token") | ||
ensure_secret_role_binding "${secret}" "${principal}" "roles/secretmanager.secretAccessor" | ||
ensure_secret_role_binding "${secret}" "${principal}" "roles/secretmanager.secretAccessor" 2>&1 | indent | ||
|
||
color 6 "Special case: ensuring gs://k8s-metrics-canary exists for gs://k8s-metrics migration" | ||
( | ||
bucket="gs://k8s-project-metrics" | ||
owners="[email protected]" | ||
local old_service_account="[email protected]" | ||
|
||
ensure_public_gcs_bucket "${project}" "${bucket}" | ||
ensure_gcs_bucket_auto_deletion "${bucket}" "365" # match gs://k8s-metrics | ||
# GCS admins can admin all GCS buckets | ||
empower_gcs_admins "${project}" "${bucket}" | ||
# bucket owners can admin this bucket | ||
empower_group_to_admin_gcs_bucket "${owners}" "${bucket}" | ||
# TODO(spiffxp): copy pasted to flip to ensure_removed when migrated | ||
# k8s-prow-builds can write to this bucket | ||
principal="serviceAccount:${old_service_account}" | ||
ensure_gcs_role_binding "${bucket}" "${principal}" "objectAdmin" | ||
ensure_gcs_role_binding "${bucket}" "${principal}" "legacyBucketWriter" | ||
# k8s-infra-prow-build-trusted can write to this bucket | ||
principal="serviceAccount:$(svc_acc_email "k8s-infra-prow-build-trusted" "k8s-metrics")" | ||
ensure_gcs_role_binding "${bucket}" "${principal}" "objectAdmin" | ||
ensure_gcs_role_binding "${bucket}" "${principal}" "legacyBucketWriter" | ||
) 2>&1 | indent | ||
} | ||
|
||
function ensure_main_project() { | ||
|