Skip to content

Commit 6044038

Browse files
[CRDB-49216] tests/e2e/operator: Add GCP end-to-end tests with Helm v2.
1 parent cfcfa00 commit 6044038

File tree

17 files changed

+1760
-436
lines changed

17 files changed

+1760
-436
lines changed

.github/workflows/ci.yaml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
certUtility: ${{ steps.filter.outputs.certUtility }}
1515
steps:
1616
- name: Checkout sources
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
with:
1919
fetch-depth: 2
2020
ref: ${{github.event.pull_request.head.ref}}
@@ -41,12 +41,12 @@ jobs:
4141
if: (needs.detect-self-signer-change.outputs.certUtility == 'true')
4242
steps:
4343
- name: Setup Go
44-
uses: actions/setup-go@v3
44+
uses: actions/setup-go@v5
4545
with:
4646
go-version: 1.23
4747

4848
- name: Checkout sources
49-
uses: actions/checkout@v3
49+
uses: actions/checkout@v4
5050
with:
5151
ref: ${{github.event.pull_request.head.ref}}
5252
repository: ${{github.event.pull_request.head.repo.full_name}}
@@ -72,7 +72,7 @@ jobs:
7272
runs-on: ubuntu-latest
7373
steps:
7474
- name: Checkout sources
75-
uses: actions/checkout@v3
75+
uses: actions/checkout@v4
7676
with:
7777
ref: ${{github.event.pull_request.head.ref}}
7878
repository: ${{github.event.pull_request.head.repo.full_name}}
@@ -87,13 +87,13 @@ jobs:
8787
runs-on: ubuntu-latest
8888
steps:
8989
- name: Checkout sources
90-
uses: actions/checkout@v3
90+
uses: actions/checkout@v4
9191
with:
9292
ref: ${{github.event.pull_request.head.ref}}
9393
repository: ${{github.event.pull_request.head.repo.full_name}}
9494

9595
- name: Setup Go
96-
uses: actions/setup-go@v3
96+
uses: actions/setup-go@v5
9797
with:
9898
go-version: 1.23
9999

@@ -119,7 +119,7 @@ jobs:
119119
if: (needs.detect-self-signer-change.outputs.certUtility == 'true')
120120
steps:
121121
- name: Checkout
122-
uses: actions/checkout@v3
122+
uses: actions/checkout@v4
123123
with:
124124
fetch-depth: 2
125125
ref: ${{github.event.pull_request.head.ref}}
@@ -141,13 +141,13 @@ jobs:
141141
runs-on: ubuntu-latest-4-core
142142
steps:
143143
- name: Checkout sources
144-
uses: actions/checkout@v3
144+
uses: actions/checkout@v4
145145
with:
146146
ref: ${{github.event.pull_request.head.ref}}
147147
repository: ${{github.event.pull_request.head.repo.full_name}}
148148

149149
- name: Setup Go
150-
uses: actions/setup-go@v3
150+
uses: actions/setup-go@v5
151151
with:
152152
go-version: 1.23
153153

@@ -167,13 +167,13 @@ jobs:
167167
runs-on: ubuntu-latest
168168
steps:
169169
- name: Checkout sources
170-
uses: actions/checkout@v3
170+
uses: actions/checkout@v4
171171
with:
172172
ref: ${{github.event.pull_request.head.ref}}
173173
repository: ${{github.event.pull_request.head.repo.full_name}}
174174

175175
- name: Setup Go
176-
uses: actions/setup-go@v3
176+
uses: actions/setup-go@v5
177177
with:
178178
go-version: 1.23
179179

@@ -193,18 +193,21 @@ jobs:
193193
runs-on: ubuntu-latest-4-core
194194
steps:
195195
- name: Checkout sources
196-
uses: actions/checkout@v3
196+
uses: actions/checkout@v4
197197
with:
198198
ref: ${{github.event.pull_request.head.ref}}
199199
repository: ${{github.event.pull_request.head.repo.full_name}}
200200

201201
- name: Setup Go
202-
uses: actions/setup-go@v3
202+
uses: actions/setup-go@v5
203203
with:
204204
go-version: 1.23
205205

206206
- name: Run E2E Test
207-
run: make test/e2e/single-region
207+
run: |
208+
set -e
209+
make test/e2e/single-region
210+
continue-on-error: false
208211

209212
- name: Clean up Docker resources
210213
shell: bash
@@ -219,13 +222,13 @@ jobs:
219222
runs-on: ubuntu-latest-4-core
220223
steps:
221224
- name: Checkout sources
222-
uses: actions/checkout@v3
225+
uses: actions/checkout@v4
223226
with:
224227
ref: ${{github.event.pull_request.head.ref}}
225228
repository: ${{github.event.pull_request.head.repo.full_name}}
226229

227230
- name: Setup Go
228-
uses: actions/setup-go@v3
231+
uses: actions/setup-go@v5
229232
with:
230233
go-version: 1.23
231234

@@ -244,13 +247,13 @@ jobs:
244247
runs-on: ubuntu-latest-4-core
245248
steps:
246249
- name: Checkout sources
247-
uses: actions/checkout@v3
250+
uses: actions/checkout@v4
248251
with:
249252
ref: ${{github.event.pull_request.head.ref}}
250253
repository: ${{github.event.pull_request.head.repo.full_name}}
251254

252255
- name: Setup Go
253-
uses: actions/setup-go@v3
256+
uses: actions/setup-go@v5
254257
with:
255258
go-version: 1.23
256259

@@ -269,13 +272,13 @@ jobs:
269272
runs-on: ubuntu-latest
270273
steps:
271274
- name: Checkout sources
272-
uses: actions/checkout@v3
275+
uses: actions/checkout@v4
273276
with:
274277
ref: ${{github.event.pull_request.head.ref}}
275278
repository: ${{github.event.pull_request.head.repo.full_name}}
276279

277280
- name: Setup Go
278-
uses: actions/setup-go@v3
281+
uses: actions/setup-go@v5
279282
with:
280283
go-version: 1.23
281284

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: integration-tests
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- ready_for_review
10+
push:
11+
branches:
12+
- "*"
13+
schedule:
14+
- cron: "15 6 * * *" # Run at 6:15 AM UTC to avoid peak times
15+
# Allow manual trigger on any branch
16+
workflow_dispatch:
17+
18+
jobs:
19+
integration-tests-multi-region:
20+
runs-on: ubuntu-latest-4-core
21+
permissions:
22+
contents: 'read'
23+
id-token: 'write'
24+
env:
25+
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Setup Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: 1.23
32+
- name: Authenticate to Google Cloud
33+
uses: 'google-github-actions/auth@v2'
34+
id: auth
35+
with:
36+
token_format: access_token
37+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
38+
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
39+
- name: Set up gcloud CLI
40+
uses: google-github-actions/setup-gcloud@v2
41+
- name: Install gke-gcloud-auth-plugin
42+
run: |
43+
gcloud components install gke-gcloud-auth-plugin
44+
- name: Run tests
45+
env:
46+
isNightly: true
47+
USE_GKE_GCLOUD_AUTH_PLUGIN: True
48+
run: |
49+
set -e
50+
make test/nightly-e2e/multi-region
51+
continue-on-error: false
52+
integration-tests-single-region:
53+
runs-on: ubuntu-latest-4-core
54+
permissions:
55+
contents: read
56+
id-token: write
57+
env:
58+
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
59+
steps:
60+
- uses: actions/checkout@v4
61+
- name: Setup Go
62+
uses: actions/setup-go@v5
63+
with:
64+
go-version: 1.23
65+
- name: Authenticate to Google Cloud
66+
uses: 'google-github-actions/auth@v2'
67+
id: auth
68+
with:
69+
token_format: access_token
70+
project_id: 'cockroach-helm-testing'
71+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
72+
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
73+
- name: Set up gcloud CLI
74+
uses: google-github-actions/setup-gcloud@v2
75+
- name: Install gke-gcloud-auth-plugin
76+
run: |
77+
gcloud components install gke-gcloud-auth-plugin
78+
- name: Run tests
79+
env:
80+
isNightly: true
81+
USE_GKE_GCLOUD_AUTH_PLUGIN: True
82+
run: |
83+
set -e
84+
make test/nightly-e2e/single-region
85+
continue-on-error: false

Makefile

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,11 @@ test/e2e/%: bin/cockroach bin/kubectl bin/helm build/self-signer test/cluster/up
118118
$(MAKE) test/cluster/down; \
119119
exit $${EXIT_CODE:-0}
120120

121-
test/e2e/multi-region: bin/cockroach bin/kubectl bin/helm build/self-signer test/single-cluster/up
122-
@PATH="$(PWD)/bin:${PATH}" go test -timeout 60m -v -test.run TestOperatorInMultiRegion ./tests/e2e/operator/multiRegion/... || EXIT_CODE=$$?; \
123-
$(MAKE) test/multi-cluster/down; \
124-
exit $${EXIT_CODE:-0}
121+
test/e2e/multi-region: bin/cockroach bin/kubectl bin/helm build/self-signer
122+
@PATH="$(PWD)/bin:${PATH}" go test -timeout 60m -v -test.run TestOperatorInMultiRegion ./tests/e2e/operator/multiRegion/... || (echo "Multi region tests failed with exit code $$?" && exit 1)
125123

126-
test/e2e/single-region: bin/cockroach bin/kubectl bin/helm build/self-signer test/single-cluster/up
127-
@PATH="$(PWD)/bin:${PATH}" go test -timeout 60m -v -test.run TestOperatorInSingleRegion ./tests/e2e/operator/singleRegion/... || EXIT_CODE=$$?; \
128-
$(MAKE) test/multi-cluster/down; \
129-
exit $${EXIT_CODE:-0}
124+
test/e2e/single-region: bin/cockroach bin/kubectl bin/helm build/self-signer
125+
@PATH="$(PWD)/bin:${PATH}" go test -timeout 60m -v -test.run TestOperatorInSingleRegion ./tests/e2e/operator/singleRegion/... || (echo "Single region tests failed with exit code $$?" && exit 1)
130126

131127
test/e2e/migrate: bin/cockroach bin/kubectl bin/helm bin/migration-helper build/self-signer test/cluster/up/3
132128
@PATH="$(PWD)/bin:${PATH}" go test -timeout 30m -v ./tests/e2e/migrate/... || EXIT_CODE=$$?; \
@@ -137,7 +133,14 @@ test/single-cluster/up: bin/k3d
137133
./tests/k3d/dev-multi-cluster.sh up --name "$(K3D_CLUSTER)" --nodes $(MULTI_REGION_NODE_SIZE) --clusters 1
138134

139135
test/multi-cluster/down: bin/k3d
140-
./tests/k3d/dev-multi-cluster.sh down --name "$(K3D_CLUSTER)" --nodes $(MULTI_REGION_NODE_SIZE) --clusters $(REGIONS)
136+
./tests/k3d/dev-multi-cluster.sh down
137+
138+
test/nightly-e2e/single-region: bin/cockroach bin/kubectl bin/helm build/self-signer
139+
@PATH="$(PWD)/bin:${PATH}" go test -timeout 60m -v -test.run TestOperatorInSingleRegion ./tests/e2e/operator/singleRegion/... || (echo "Single region tests failed with exit code $$?" && exit 1)
140+
141+
test/nightly-e2e/multi-region: bin/cockroach bin/kubectl bin/helm build/self-signer
142+
@PATH="$(PWD)/bin:${PATH}" go test -timeout 60m -v -test.run TestOperatorInMultiRegion ./tests/e2e/operator/multiRegion/... || (echo "Multi region tests failed with exit code $$?" && exit 1)
143+
141144

142145
test/lint: bin/helm ## lint the helm chart
143146
@build/lint.sh && \
@@ -148,8 +151,8 @@ test/lint: bin/helm ## lint the helm chart
148151
test/template: bin/cockroach bin/helm ## Run template tests
149152
@PATH="$(PWD)/bin:${PATH}" go test -v ./tests/template/...
150153

151-
test/units: bin/cockroach ## Run unit tests in ./pkg/... and ./build/...
152-
@PATH="$(PWD)/bin:${PATH}" go test -v ./pkg/... ./build/...
154+
test/units: bin/cockroach ## Run unit tests in ./pkg/...
155+
@PATH="$(PWD)/bin:${PATH}" go test -v ./pkg/...
153156

154157
##@ Binaries
155158
bin: bin/cockroach bin/helm bin/k3d bin/kubectl bin/yq ## install all binaries
@@ -170,7 +173,7 @@ bin/helm: ## install helm
170173

171174
bin/k3d: ## install k3d
172175
@mkdir -p bin
173-
@curl -Lo bin/k3d $(K3D_BIN)
176+
@curl -Lo bin/k3d $(K3D_BIN)
174177
@chmod +x bin/k3d
175178

176179
bin/kubectl: ## install kubectl
@@ -207,10 +210,4 @@ build-and-push-operator-image:
207210

208211
build-and-push-bundle-image:
209212
docker buildx build --platform=linux/amd64,linux/arm64 \
210-
-t $(QUAY_DOCKER_REGISTRY)/$(QUAY_PROJECT)/$(BUNDLE_IMAGE):$(VERSION) --push -f build/docker-image/olm-catalog/bundle.Dockerfile ./
211-
212-
bump/%:
213-
@bazel build //build
214-
$$(bazel info bazel-bin)/build/build_/build bump $*
215-
@helm dependency update ./cockroachdb-parent
216-
@rm -rf ./cockroachdb-parent/charts/*.tgz
213+
-t $(QUAY_DOCKER_REGISTRY)/$(QUAY_PROJECT)/$(BUNDLE_IMAGE):$(VERSION) --push -f build/docker-image/olm-catalog/bundle.Dockerfile ./

build/templates/cockroachdb-parent/charts/operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ image:
99
# pullPolicy specifies the image pull policy.
1010
pullPolicy: IfNotPresent
1111
# tag is the image tag.
12-
tag: "668d5c50057f561332ac8a2c7f89cce3c92ee939fdd899b811149e6ce1c63a6f"
12+
tag: "33ac29511fb9a73eafbefd319a1d2c804cd3c6679b1605dd1d4f1861e3e17f3d"
1313
# certificate defines the certificate settings for the Operator.
1414
certificate:
1515
# validForDays specifies the number of days the certificate is valid for.

cockroachdb-parent/charts/operator/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ image:
1010
# pullPolicy specifies the image pull policy.
1111
pullPolicy: IfNotPresent
1212
# tag is the image tag.
13-
tag: "668d5c50057f561332ac8a2c7f89cce3c92ee939fdd899b811149e6ce1c63a6f"
13+
tag: "33ac29511fb9a73eafbefd319a1d2c804cd3c6679b1605dd1d4f1861e3e17f3d"
1414
# certificate defines the certificate settings for the Operator.
1515
certificate:
1616
# validForDays specifies the number of days the certificate is valid for.

go.mod

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ require (
1717
github.com/sirupsen/logrus v1.9.0
1818
github.com/spf13/cobra v1.7.0
1919
github.com/stretchr/testify v1.8.4
20+
google.golang.org/api v0.126.0
2021
google.golang.org/protobuf v1.36.3
2122
gopkg.in/yaml.v3 v3.0.1
2223
k8s.io/api v0.30.2
@@ -28,6 +29,8 @@ require (
2829
)
2930

3031
require (
32+
cloud.google.com/go/compute v1.23.0 // indirect
33+
cloud.google.com/go/compute/metadata v0.2.3 // indirect
3134
emperror.dev/errors v0.8.0 // indirect
3235
github.com/aws/aws-sdk-go v1.44.122 // indirect
3336
github.com/banzaicloud/k8s-objectmatcher v1.8.0 // indirect
@@ -56,7 +59,10 @@ require (
5659
github.com/google/gnostic-models v0.6.8 // indirect
5760
github.com/google/go-cmp v0.6.0 // indirect
5861
github.com/google/gofuzz v1.2.0 // indirect
62+
github.com/google/s2a-go v0.1.4 // indirect
5963
github.com/google/uuid v1.3.0 // indirect
64+
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
65+
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
6066
github.com/gorilla/websocket v1.5.0 // indirect
6167
github.com/gosimple/slug v1.9.0 // indirect
6268
github.com/gruntwork-io/go-commons v0.8.0 // indirect
@@ -97,6 +103,7 @@ require (
97103
github.com/russross/blackfriday/v2 v2.1.0 // indirect
98104
github.com/spf13/pflag v1.0.5 // indirect
99105
github.com/urfave/cli v1.22.2 // indirect
106+
go.opencensus.io v0.24.0 // indirect
100107
go.uber.org/multierr v1.11.0 // indirect
101108
go.uber.org/zap v1.26.0 // indirect
102109
golang.org/x/crypto v0.36.0 // indirect
@@ -109,6 +116,8 @@ require (
109116
golang.org/x/time v0.3.0 // indirect
110117
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
111118
google.golang.org/appengine v1.6.7 // indirect
119+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
120+
google.golang.org/grpc v1.58.3 // indirect
112121
gopkg.in/inf.v0 v0.9.1 // indirect
113122
gopkg.in/yaml.v2 v2.4.0 // indirect
114123
k8s.io/klog/v2 v2.120.1 // indirect
@@ -124,8 +133,6 @@ replace (
124133
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.30.2
125134
k8s.io/apimachinery => k8s.io/apimachinery v0.30.2
126135
k8s.io/client-go => k8s.io/client-go v0.30.2
127-
k8s.io/component-base => k8s.io/component-base v0.30.2
128-
k8s.io/klog => k8s.io/klog v1.0.0
129136
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340
130137
k8s.io/utils => k8s.io/utils v0.0.0-20230726121419-3b25d923346b
131138
)

0 commit comments

Comments
 (0)