Skip to content

Commit 6ce49ef

Browse files
Nightly Integration tests for self-hosted infrastructure.
1 parent b60abd0 commit 6ce49ef

File tree

14 files changed

+1053
-439
lines changed

14 files changed

+1053
-439
lines changed

.github/workflows/integration-tests.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
jobs:
1010
integration-tests-multi-region:
1111
runs-on: ubuntu-latest-4-core
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
provider: [kind, gcp]
1216
timeout-minutes: 90
1317
permissions:
1418
contents: 'read'
@@ -35,11 +39,11 @@ jobs:
3539
gcloud components install gke-gcloud-auth-plugin
3640
- name: Run tests (multi-region)
3741
env:
38-
isNightly: true
42+
PROVIDER: ${{ matrix.provider }}
3943
USE_GKE_GCLOUD_AUTH_PLUGIN: True
4044
run: |
41-
set -e
42-
make test/nightly-e2e/multi-region | tee test_output.log || true
45+
set -euo pipefail
46+
make test/nightly-e2e/multi-region | tee test_output.log
4347
- name: Archive test results
4448
if: ${{ always() }}
4549
uses: actions/upload-artifact@v4
@@ -123,6 +127,10 @@ jobs:
123127
"${{ secrets.SLACK_WEBHOOK_URL }}"
124128
integration-tests-single-region:
125129
runs-on: ubuntu-latest-4-core
130+
strategy:
131+
fail-fast: false
132+
matrix:
133+
provider: [kind, gcp]
126134
timeout-minutes: 90
127135
permissions:
128136
contents: read
@@ -150,11 +158,11 @@ jobs:
150158
gcloud components install gke-gcloud-auth-plugin
151159
- name: Run tests (single-region)
152160
env:
153-
isNightly: true
161+
PROVIDER: ${{ matrix.provider }}
154162
USE_GKE_GCLOUD_AUTH_PLUGIN: True
155163
run: |
156-
set -e
157-
make test/nightly-e2e/single-region | tee test_output.log || true
164+
set -euo pipefail
165+
make test/nightly-e2e/single-region | tee test_output.log
158166
- name: Archive test results
159167
if: ${{ always() }}
160168
uses: actions/upload-artifact@v4

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ifeq ($(UNAME_S),Linux)
44
COCKROACH_BIN ?= https://binaries.cockroachdb.com/cockroach-v23.2.0.linux-amd64.tgz
55
HELM_BIN ?= https://get.helm.sh/helm-v3.14.0-linux-amd64.tar.gz
66
K3D_BIN ?= https://github.com/k3d-io/k3d/releases/download/v5.7.4/k3d-linux-amd64
7+
KIND_BIN ?= https://kind.sigs.k8s.io/dl/v0.29.0/kind-linux-amd64
78
KUBECTL_BIN ?= https://dl.k8s.io/release/v1.29.1/bin/linux/amd64/kubectl
89
YQ_BIN ?= https://github.com/mikefarah/yq/releases/download/v4.31.2/yq_linux_amd64
910
JQ_BIN ?= https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
@@ -14,6 +15,7 @@ ifeq ($(UNAME_S),Darwin)
1415
COCKROACH_BIN ?= https://binaries.cockroachdb.com/cockroach-v23.2.0.darwin-10.9-amd64.tgz
1516
HELM_BIN ?= https://get.helm.sh/helm-v3.14.0-darwin-amd64.tar.gz
1617
K3D_BIN ?= https://github.com/k3d-io/k3d/releases/download/v5.7.4/k3d-darwin-arm64
18+
KIND_BIN ?= https://kind.sigs.k8s.io/dl/v0.29.0/kind-darwin-arm64
1719
KUBECTL_BIN ?= https://dl.k8s.io/release/v1.29.1/bin/darwin/amd64/kubectl
1820
YQ_BIN ?= https://github.com/mikefarah/yq/releases/download/v4.31.2/yq_darwin_amd64
1921
JQ_BIN ?= https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64
@@ -135,10 +137,10 @@ test/single-cluster/up: bin/k3d
135137
test/multi-cluster/down: bin/k3d
136138
./tests/k3d/dev-multi-cluster.sh down
137139

138-
test/nightly-e2e/single-region: bin/cockroach bin/kubectl bin/helm build/self-signer
140+
test/nightly-e2e/single-region: bin/cockroach bin/kubectl bin/helm build/self-signer bin/kind
139141
@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)
140142

141-
test/nightly-e2e/multi-region: bin/cockroach bin/kubectl bin/helm build/self-signer
143+
test/nightly-e2e/multi-region: bin/cockroach bin/kubectl bin/helm build/self-signer bin/kind
142144
@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)
143145

144146

@@ -176,6 +178,11 @@ bin/k3d: ## install k3d
176178
@curl -Lo bin/k3d $(K3D_BIN)
177179
@chmod +x bin/k3d
178180

181+
bin/kind: ## install kind
182+
@mkdir -p bin
183+
@curl -Lo bin/kind $(KIND_BIN)
184+
@chmod +x bin/kind
185+
179186
bin/kubectl: ## install kubectl
180187
@mkdir -p bin
181188
@curl -Lo bin/kubectl $(KUBECTL_BIN)

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ rules:
254254
- admissionregistration.k8s.io
255255
resources:
256256
- validatingwebhookconfigurations
257+
- mutatingwebhookconfigurations
257258
verbs:
258259
- create
259260
- apiGroups:
@@ -265,6 +266,15 @@ rules:
265266
verbs:
266267
- get
267268
- patch
269+
- apiGroups:
270+
- admissionregistration.k8s.io
271+
resources:
272+
- mutatingwebhookconfigurations
273+
resourceNames:
274+
- cockroach-mutating-webhook-config
275+
verbs:
276+
- get
277+
- patch
268278
# The "create" verb cannot be qualified with resourceNames, so grant the
269279
# unqualified permission so that the operator can create new CRDs. But only
270280
# allow the operator to get and patch its own CRDs.

cockroachdb-parent/charts/operator/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
# image captures the container image settings for Operator pods.
55
image:
66
# registry is the container registry where the image is stored.
7-
registry: "us-docker.pkg.dev/releases-prod/self-hosted"
7+
registry: "us-docker.pkg.dev/cockroach-cloud-images/development"
88
# repository defines the image repository.
9-
repository: "cockroachdb-operator@sha256"
9+
repository: "cockroach-operator@sha256"
1010
# pullPolicy specifies the image pull policy.
1111
pullPolicy: IfNotPresent
1212
# tag is the image tag.
13-
tag: "6f62639e9fee99d99b0387a9dccda84daa1a489b592b008f2f354ec57eae09ac"
13+
tag: "72844b85354fd55b9a487abbd6e253b7d5081f65513c3813fde0ceb7d3ee2f70"
1414
# certificate defines the certificate settings for the Operator.
1515
certificate:
1616
# validForDays specifies the number of days the certificate is valid for.

tests/e2e/migrate/helm_chart_to_cockroach_enterprise_operator_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (h *HelmChartToOperator) TestDefaultMigration(t *testing.T) {
112112
k8s.RunKubectl(t, kubectlOptions, "delete", "priorityclass", "crdb-critical")
113113
}()
114114

115-
operator.InstallCockroachDBEnterpriseOperator(t, kubectlOptions)
115+
operator.InstallCockroachDBEnterpriseOperator(t, kubectlOptions, nil)
116116
defer func() {
117117
t.Log("Uninstall the cockroachdb enterprise operator")
118118
operator.UninstallCockroachDBEnterpriseOperator(t, kubectlOptions)
@@ -221,7 +221,7 @@ func (h *HelmChartToOperator) TestCertManagerMigration(t *testing.T) {
221221
k8s.RunKubectl(t, kubectlOptions, "delete", "priorityclass", "crdb-critical")
222222
}()
223223

224-
operator.InstallCockroachDBEnterpriseOperator(t, kubectlOptions)
224+
operator.InstallCockroachDBEnterpriseOperator(t, kubectlOptions, nil)
225225
defer func() {
226226
t.Log("Uninstall the cockroachdb enterprise operator")
227227
operator.UninstallCockroachDBEnterpriseOperator(t, kubectlOptions)
@@ -308,7 +308,7 @@ func (h *HelmChartToOperator) TestPCRPrimaryMigration(t *testing.T) {
308308
k8s.RunKubectl(t, kubectlOptions, "delete", "priorityclass", "crdb-critical")
309309
}()
310310

311-
operator.InstallCockroachDBEnterpriseOperator(t, kubectlOptions)
311+
operator.InstallCockroachDBEnterpriseOperator(t, kubectlOptions, nil)
312312
defer func() {
313313
t.Log("Uninstall the cockroachdb enterprise operator")
314314
operator.UninstallCockroachDBEnterpriseOperator(t, kubectlOptions)

tests/e2e/migrate/public_operator_to_cockroach_enterprise_operator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (o *PublicOperatorToCockroachEnterpriseOperator) TestDefaultMigration(t *te
127127
k8s.KubectlApply(t, kubectlOptions, filepath.Join(manifestsDirPath, "rbac.yaml"))
128128

129129
t.Log("Install the cockroachdb enterprise operator")
130-
operator.InstallCockroachDBEnterpriseOperator(t, kubectlOptions)
130+
operator.InstallCockroachDBEnterpriseOperator(t, kubectlOptions, nil)
131131
defer func() {
132132
t.Log("Uninstall the cockroachdb enterprise operator")
133133
operator.UninstallCockroachDBEnterpriseOperator(t, kubectlOptions)

tests/e2e/operator/infra/common.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@ import (
1818

1919
// Provider types.
2020
const (
21-
ProviderK3D = "k3d"
22-
ProviderGCP = "gcp"
21+
ProviderK3D = "k3d"
22+
ProviderKind = "kind"
23+
ProviderGCP = "gcp"
2324
)
2425

2526
// Common constants.
2627
const (
27-
defaultRetries = 30
28-
defaultRetryInterval = 10 * time.Second
28+
defaultRetries = 30
29+
defaultRetryInterval = 10 * time.Second
30+
// Load balancer specific retry settings (extended for AWS)
31+
loadBalancerRetries = 60 // 10 minutes total
32+
loadBalancerInterval = 10 * time.Second
2933
coreDNSDeploymentName = "coredns"
3034
coreDNSServiceName = "crl-core-dns"
3135
coreDNSNamespace = "kube-system"
@@ -46,8 +50,9 @@ const (
4650

4751
// RegionCodes maps provider types to their region codes
4852
var RegionCodes = map[string][]string{
49-
ProviderK3D: {"us-east1", "us-east2"},
50-
ProviderGCP: {"us-central1", "us-east1"},
53+
ProviderK3D: {"us-east1", "us-east2"},
54+
ProviderKind: {"us-east1", "us-east2"},
55+
ProviderGCP: {"us-central1", "us-east1"},
5156
}
5257

5358
// LoadBalancerAnnotations contains provider-specific service annotations.
@@ -57,7 +62,8 @@ var LoadBalancerAnnotations = map[string]map[string]string{
5762
"networking.gke.io/load-balancer-type": "Internal",
5863
"cloud.google.com/load-balancer-type": "Internal",
5964
},
60-
ProviderK3D: {},
65+
ProviderK3D: {},
66+
ProviderKind: {},
6167
}
6268

6369
// NetworkConfigs defines standard network configurations for each provider and region.
@@ -237,7 +243,7 @@ func finalizeCoreDNSDeployment(t *testing.T, kubectlOpts *k8s.KubectlOptions) er
237243
func WaitForCoreDNSServiceIPs(t *testing.T, kubectlOpts *k8s.KubectlOptions) ([]string, error) {
238244
var ips []string
239245

240-
_, err := retry.DoWithRetryE(t, "waiting for CoreDNS service IPs", defaultRetries, defaultRetryInterval,
246+
_, err := retry.DoWithRetryE(t, "waiting for CoreDNS service IPs", loadBalancerRetries, loadBalancerInterval,
241247
func() (string, error) {
242248
svc, err := k8s.GetServiceE(t, kubectlOpts, coreDNSServiceName)
243249
if err != nil {

0 commit comments

Comments
 (0)