Skip to content

Commit b734b30

Browse files
shreyaskm623NishanthNalluri
authored andcommitted
fix the golden files
1 parent 59c8362 commit b734b30

File tree

4 files changed

+28
-146
lines changed

4 files changed

+28
-146
lines changed

pkg/migrate/testdata/helm/allInput/values.yaml.golden

Lines changed: 19 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ cockroachdb:
8686
requests:
8787
cpu: "1"
8888
memory: 2Gi
89+
initContainers:
90+
- command:
91+
- /bin/sh
92+
- -c
93+
- echo "Custom init container setup"; sleep 2
94+
image: alpine:latest
95+
imagePullPolicy: IfNotPresent
96+
name: custom-init
97+
resources:
98+
requests:
99+
cpu: 100m
100+
memory: 64Mi
89101
nodeSelector:
90102
cloud.google.com/gke-nodepool: default-pool
91103
priorityClassName: crdb-critical
@@ -103,6 +115,13 @@ cockroachdb:
103115
maxSkew: 1
104116
topologyKey: topology.kubernetes.io/zone
105117
whenUnsatisfiable: ScheduleAnyway
118+
volumes:
119+
- configMap:
120+
items:
121+
- key: config.yaml
122+
path: custom-config.yaml
123+
name: custom-config-map
124+
name: custom-config
106125
regions:
107126
- cloudProvider: gcp
108127
code: us-central1
@@ -164,133 +183,6 @@ cockroachdb:
164183
maxSkew: 1
165184
topologyKey: topology.kubernetes.io/zone
166185
whenUnsatisfiable: ScheduleAnyway
167-
dataStore:
168-
volumeClaimTemplate:
169-
metadata:
170-
name: datadir
171-
spec:
172-
accessModes:
173-
- ReadWriteOnce
174-
resources:
175-
requests:
176-
storage: 100Gi
177-
volumeMode: Filesystem
178-
image:
179-
name: cockroachdb/cockroach:v25.1.5
180-
localityLabels:
181-
- country
182-
- region
183-
loggingConfigMapName: cockroachdb-log-config
184-
podLabels:
185-
app.kubernetes.io/component: cockroachdb
186-
app.kubernetes.io/instance: cockroachdb
187-
app.kubernetes.io/name: cockroachdb
188-
podTemplate:
189-
metadata:
190-
annotations:
191-
crdb: is-cool
192-
labels:
193-
app.kubernetes.io/component: cockroachdb
194-
app.kubernetes.io/instance: cockroachdb
195-
app.kubernetes.io/name: cockroachdb
196-
spec:
197-
affinity:
198-
podAntiAffinity:
199-
preferredDuringSchedulingIgnoredDuringExecution:
200-
- podAffinityTerm:
201-
labelSelector:
202-
matchLabels:
203-
app.kubernetes.io/component: cockroachdb
204-
app.kubernetes.io/instance: cockroachdb
205-
app.kubernetes.io/name: cockroachdb
206-
topologyKey: kubernetes.io/hostname
207-
weight: 100
208-
containers:
209-
- env:
210-
- name: STATEFULSET_NAME
211-
value: cockroachdb
212-
- name: STATEFULSET_FQDN
213-
value: cockroachdb.default.svc.cluster.local
214-
- name: COCKROACH_CHANNEL
215-
value: kubernetes-helm
216-
- name: GODEBUG
217-
value: disablethp=1
218-
- name: HOST_IP
219-
valueFrom:
220-
fieldRef:
221-
apiVersion: v1
222-
fieldPath: status.hostIP
223-
- name: GODEBUG
224-
value: disablethp=1
225-
image: cockroachdb/cockroach:v25.1.5
226-
name: cockroachdb
227-
resources:
228-
limits:
229-
cpu: "2"
230-
memory: 4Gi
231-
requests:
232-
cpu: "1"
233-
memory: 2Gi
234-
initContainers:
235-
- command:
236-
- /bin/sh
237-
- -c
238-
- echo "Custom init container setup"; sleep 2
239-
image: alpine:latest
240-
imagePullPolicy: IfNotPresent
241-
name: custom-init
242-
resources:
243-
requests:
244-
cpu: 100m
245-
memory: 64Mi
246-
nodeSelector:
247-
cloud.google.com/gke-nodepool: default-pool
248-
priorityClassName: crdb-critical
249-
terminationGracePeriodSeconds: 300
250-
tolerations:
251-
- effect: NoSchedule
252-
key: non-crdb
253-
operator: Exists
254-
topologySpreadConstraints:
255-
- labelSelector:
256-
matchLabels:
257-
app.kubernetes.io/component: cockroachdb
258-
app.kubernetes.io/instance: cockroachdb
259-
app.kubernetes.io/name: cockroachdb
260-
maxSkew: 1
261-
topologyKey: topology.kubernetes.io/zone
262-
whenUnsatisfiable: ScheduleAnyway
263-
volumes:
264-
- configMap:
265-
items:
266-
- key: config.yaml
267-
path: custom-config.yaml
268-
name: custom-config-map
269-
name: custom-config
270-
regions:
271-
- cloudProvider: gcp
272-
code: us-central1
273-
domain: ""
274-
namespace: default
275-
nodes: 3
276-
service:
277-
ports:
278-
grpc:
279-
port: 26258
280-
http:
281-
port: 8080
282-
sql:
283-
port: 26257
284-
startFlags:
285-
omit: null
286-
upsert:
287-
- --join=${STATEFULSET_NAME}-0.${STATEFULSET_FQDN}:26257,${STATEFULSET_NAME}-1.${STATEFULSET_FQDN}:26257,${STATEFULSET_NAME}-2.${STATEFULSET_FQDN}:26257
288-
- --advertise-host=$(hostname).${STATEFULSET_FQDN}
289-
- --certs-dir=/cockroach/cockroach-certs/
290-
- --cache=25%
291-
- --max-sql-memory=25%
292-
virtualCluster:
293-
mode: primary
294186
tls:
295187
enabled: true
296188
externalCertificates:

tests/e2e/migrate/public_operator_to_cockroach_enterprise_operator_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ func (o *PublicOperatorToCockroachEnterpriseOperator) TestDefaultMigration(t *te
173173
// Verify priority class migration
174174
verifyOperatorMigration(t, kubectlOptions, o.CustomResourceBuilder.Cr())
175175

176+
// Wait for ingress controller to sync the updated ingress configuration
177+
// after Helm install modified the ingress resources
178+
t.Log("Waiting for ingress controller to sync after migration")
179+
time.Sleep(20 * time.Second)
180+
176181
testutil.TestIngressRoutingDirect(t, "ui.local.com")
177182
}
178183

tests/e2e/operator/region.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ func (r *Region) CleanupResources(t *testing.T) {
440440
"delete": {
441441
"--wait",
442442
"--debug",
443-
"--no-hooks",
444443
},
445444
}
446445
helmOptions := &helm.Options{
@@ -560,6 +559,7 @@ func UninstallCockroachDBEnterpriseOperator(t *testing.T, kubectlOptions *k8s.Ku
560559
helm.Delete(t, operatorOpts, operatorReleaseName, true)
561560
k8s.RunKubectl(t, kubectlOptions, "delete", "service", "cockroach-webhook-service")
562561
k8s.RunKubectl(t, kubectlOptions, "delete", "validatingwebhookconfiguration", "cockroach-webhook-config")
562+
k8s.RunKubectl(t, kubectlOptions, "delete", "mutatingwebhookconfiguration", "cockroach-mutating-webhook-config")
563563
k8s.DeleteNamespace(t, kubectlOptions, kubectlOptions.Namespace)
564564
}
565565

tests/testutil/migration/operator.go

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ package migration
22

33
import (
44
"context"
5-
"fmt"
65
"testing"
76
"time"
87

98
"github.com/cockroachdb/helm-charts/tests/testutil"
109
"github.com/gruntwork-io/terratest/modules/k8s"
11-
"github.com/gruntwork-io/terratest/modules/retry"
1210
"github.com/stretchr/testify/require"
1311
apierrors "k8s.io/apimachinery/pkg/api/errors"
1412
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -36,26 +34,13 @@ func (o *PublicOperator) InstallOperator(t *testing.T) {
3634
t.Logf("Installing cockroach-operator")
3735
k8s.KubectlApply(t, kubectlOptions, "https://raw.githubusercontent.com/cockroachdb/cockroach-operator/master/install/operator.yaml")
3836

37+
t.Log("Waiting for cockroach-operator to be ready")
3938
// Sleep for 10 seconds to check for the deployment to be ready
4039
time.Sleep(10 * time.Second)
4140
waitForOperatorToBeReady(t)
4241

43-
t.Log("Waiting for cockroach-operator to be ready")
44-
45-
// Wait for webhook service to be available in the target namespace
46-
// The operator creates this service dynamically, so we need to wait for it
47-
t.Log("Waiting for cockroach-webhook-service to be ready in namespace:", o.Namespace)
48-
webhookKubectlOptions := k8s.NewKubectlOptions("", "", o.Namespace)
49-
50-
// Use retry logic to wait for the webhook service to be created
51-
retry.DoWithRetry(t, "wait-for-webhook-service", 60, 5*time.Second, func() (string, error) {
52-
_, err := k8s.GetServiceE(t, webhookKubectlOptions, "cockroach-webhook-service")
53-
if err != nil {
54-
return "", fmt.Errorf("waiting for cockroach-webhook-service to be created: %v", err)
55-
}
56-
return "cockroach-webhook-service is ready", nil
57-
})
58-
42+
k8s.WaitUntilServiceAvailable(t, kubectlOptions, "cockroach-operator-webhook-service", 10, 10*time.Second)
43+
5944
t.Log("Installing crdbcluster custom resource")
6045
if _, err := k8s.GetNamespaceE(t, k8s.NewKubectlOptions("", "", o.Namespace), o.Namespace); err != nil && apierrors.IsNotFound(err) {
6146
k8s.CreateNamespace(t, k8s.NewKubectlOptions("", "", o.Namespace), o.Namespace)

0 commit comments

Comments
 (0)