Skip to content

Commit 0c850a8

Browse files
authored
Add R2 secrets for release and prerelease jobs (#5924)
* build and publish secrets * prerelease secret permissions * Add correct permissions to gcp SA * touchup * fix secrets * lint * add prerelease testing to registry.istio.io * Use s3:// urls for private envoy pulls * lint * cleanup
1 parent fbebada commit 0c850a8

23 files changed

Lines changed: 687 additions & 125 deletions

File tree

‎Makefile.core.mk‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ gen-check: gen check-clean-repo
3030
generate-config:
3131
@rm -fr prow/cluster/jobs/istio*/*/*.gen.yaml
3232
@(cd tools/prowgen/cmd/prowgen; go run main.go --input-dir=$(repo_root)/prow/config/jobs --output-dir=$(repo_root)/prow/cluster/jobs write)
33-
@go run tools/prowtrans/cmd/prowtrans/main.go --configs=./prow/config/istio-private_jobs --input=./prow/config/jobs
34-
@go run tools/prowtrans/cmd/prowtrans/main.go --configs=./prow/config/experimental --input=./prow/config/jobs
33+
@go run tools/prowtrans/cmd/prowtrans/main.go --requirement-presets=./prow/config/jobs/.base.yaml --configs=./prow/config/istio-private_jobs --input=./prow/config/jobs
34+
@go run tools/prowtrans/cmd/prowtrans/main.go --requirement-presets=./prow/config/jobs/.base.yaml --configs=./prow/config/experimental --input=./prow/config/jobs
3535

3636
diff-config:
3737
@(cd tools/prowgen/cmd/prowgen; GOARCH=$(GOARCH) GOOS=$(GOOS) go run main.go --input-dir=$(repo_root)/prow/config/jobs --output-dir=$(repo_root)/prow/cluster/jobs diff)

‎common/config/license-lint.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ allowlisted_modules:
6464
# MIT: https://github.com/ghodss/yaml/blob/master/LICENSE
6565
- github.com/ghodss/yaml
6666

67+
# Apache 2.0: this is a sibling module within this repo (see top-level go.mod
68+
# `replace istio.io/test-infra/tools/prowgen => ./tools/prowgen`). The license
69+
# linter cannot detect a license for unpublished local modules.
70+
- istio.io/test-infra/tools/prowgen
71+
6772
# BSD: https://github.com/gogo/protobuf/blob/master/LICENSE
6873
- github.com/gogo/protobuf
6974

‎go.mod‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ require (
99
github.com/google/go-containerregistry v0.20.2
1010
github.com/spf13/pflag v1.0.5
1111
golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e
12+
istio.io/test-infra/tools/prowgen v0.0.0-00010101000000-000000000000
1213
k8s.io/api v0.32.0
1314
k8s.io/apimachinery v0.32.0
1415
k8s.io/test-infra v0.0.0-20240509142418-dcb0d8161491
1516
sigs.k8s.io/prow v0.0.0-20241210202001-9b059e106dd9
1617
sigs.k8s.io/yaml v1.4.0
1718
)
1819

20+
replace istio.io/test-infra/tools/prowgen => ./tools/prowgen
21+
1922
require (
2023
bitbucket.org/creachadair/stringset v0.0.11 // indirect
2124
cel.dev/expr v0.19.1 // indirect
@@ -104,6 +107,7 @@ require (
104107
github.com/hashicorp/go-multierror v1.1.1 // indirect
105108
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
106109
github.com/hashicorp/golang-lru v1.0.2 // indirect
110+
github.com/imdario/mergo v0.3.13 // indirect
107111
github.com/jmespath/go-jmespath v0.4.0 // indirect
108112
github.com/josharian/intern v1.0.0 // indirect
109113
github.com/json-iterator/go v1.1.12 // indirect
@@ -170,7 +174,7 @@ require (
170174
k8s.io/klog/v2 v2.130.1 // indirect
171175
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect
172176
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
173-
knative.dev/pkg v0.0.0-20241128013618-f3ab5605e542 // indirect
177+
knative.dev/pkg v0.0.0-20240416145024-0f34a8815650 // indirect
174178
sigs.k8s.io/controller-runtime v0.19.3 // indirect
175179
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
176180
sigs.k8s.io/structured-merge-diff/v4 v4.5.0 // indirect

‎go.sum‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,8 @@ github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47
12201220
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
12211221
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
12221222
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
1223+
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
1224+
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
12231225
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
12241226
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
12251227
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
@@ -2295,6 +2297,7 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
22952297
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
22962298
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
22972299
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2300+
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
22982301
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
22992302
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
23002303
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
@@ -2333,8 +2336,8 @@ k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt
23332336
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
23342337
k8s.io/utils v0.0.0-20241210054802-24370beab758 h1:sdbE21q2nlQtFh65saZY+rRM6x6aJJI8IUa1AmH/qa0=
23352338
k8s.io/utils v0.0.0-20241210054802-24370beab758/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
2336-
knative.dev/pkg v0.0.0-20241128013618-f3ab5605e542 h1:x5cEwa34aOgQDnSTEE+UtRk5lND0cvb8KbVBUShwNuI=
2337-
knative.dev/pkg v0.0.0-20241128013618-f3ab5605e542/go.mod h1:C2dxK66GlycMOS0SKqv0SMAnWkxsYbG4hkH32Xg1qD0=
2339+
knative.dev/pkg v0.0.0-20240416145024-0f34a8815650 h1:m2ahFUO0L2VrgGDYdyOUFdE6xBd3pLXAJozLJwqLRQM=
2340+
knative.dev/pkg v0.0.0-20240416145024-0f34a8815650/go.mod h1:soFw5ss08G4PU3JiFDKqiZRd2U7xoqcfNpJP1coIXkY=
23382341
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
23392342
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
23402343
modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=

‎infra/cf/cncf-istio/main.tf‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ locals {
1414
istio_registry_mappings = {
1515
release = "gcr.io/istio-release"
1616
testing = "gcr.io/istio-testing"
17+
prerelease-testing = "gcr.io/istio-prerelease-testing"
1718
}
1819
}

‎infra/gcp/istio-prow-build/iam.tf‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ module "prowjob_release_account" {
2525
# So we give this prow job access.
2626
# We could scope this down a bit with 2 accounts, but all of these are super high privilege anyways so it is simpler to keep them together.
2727
{ name = "github_istio-testing_pusher" },
28+
# R2 credentials for publishing release artifacts to Cloudflare R2 buckets.
29+
{ name = "cf_r2_istio-prerelease_credentials", project = "istio-testing" },
30+
{ name = "cf_r2_istio-release_credentials", project = "istio-testing" },
2831
]
2932
gcs_acls = [
3033
{ bucket = "istio-prerelease", role = "OWNER" },

‎infra/gcp/istio-prow-private/iam.tf‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ module "prowjob_private_account" {
1313
{ bucket = google_storage_bucket.istio_build_private.name, role = "roles/storage.objectAdmin" },
1414
{ bucket = google_storage_bucket.istio_prerelease_private.name, role = "roles/storage.objectAdmin" },
1515
]
16+
secrets = [
17+
{ name = "cf_r2_istio-prerelease-private_credentials", project = "istio-testing" },
18+
{ name = "cf_r2_istio-build-private_credentials", project = "istio-testing" },
19+
]
1620
prowjob = true
1721
prowjob_bucket = "istio-prow-private"
1822
}

‎infra/gcp/istio-testing/iam.tf‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ resource "google_secret_manager_secret_iam_member" "prowjob_default_cf_r2_istio_
7373
member = "serviceAccount:${google_service_account.istio_prow_test_job_default.email}"
7474
}
7575

76+
# Allow the default prowjob SA to read the generic public-buckets read-only R2
77+
# credentials.
78+
resource "google_secret_manager_secret_iam_member" "prowjob_default_cf_r2_public_buckets_ro" {
79+
project = "istio-testing"
80+
secret_id = "cf_r2_public_buckets_ro_credentials"
81+
role = "roles/secretmanager.secretAccessor"
82+
member = "serviceAccount:${google_service_account.istio_prow_test_job_default.email}"
83+
}
84+
7685

7786
## Prow Infra Service Accounts ##
7887
# Used for WI for external secrets deployment
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright (c) 2013 Dario Castañé. All rights reserved.
2+
Copyright (c) 2012 The Go Authors. All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are
6+
met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
* Redistributions in binary form must reproduce the above
11+
copyright notice, this list of conditions and the following disclaimer
12+
in the documentation and/or other materials provided with the
13+
distribution.
14+
* Neither the name of Google Inc. nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NO LICENSE FOUND

0 commit comments

Comments
 (0)