|
| 1 | +/* |
| 2 | +Copyright 2021 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +// The 5k scale projects require a service account that can pull from a dedicated AR registry in the 5k project |
| 18 | +// However, the account must be created in the prow-build project to avoid boskos deleting the keys and the account on cleanup. |
| 19 | +// Service Accounts don't supports labels yet, if it did we could tell boskos to skip the account based on the labels |
| 20 | + |
| 21 | +resource "google_service_account" "scale_cache" { |
| 22 | + account_id = "scale-cache-puller" |
| 23 | + display_name = "Scale Test Cache Puller" |
| 24 | + project = module.project.project_id |
| 25 | +} |
| 26 | + |
| 27 | +resource "google_service_account_key" "scale_cache" { |
| 28 | + service_account_id = google_service_account.scale_cache.id |
| 29 | +} |
| 30 | + |
| 31 | +resource "google_secret_manager_secret" "scale_cache_key" { |
| 32 | + project = module.project.project_id |
| 33 | + secret_id = "scale-cache-puller-key" |
| 34 | + replication { |
| 35 | + auto {} |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +resource "google_secret_manager_secret_version" "scale_cache_key" { |
| 40 | + secret = google_secret_manager_secret.scale_cache_key.id |
| 41 | + secret_data = "Basic ${base64encode("_json_key_base64:${google_service_account_key.scale_cache.private_key}")}" |
| 42 | +} |
0 commit comments