Skip to content

Commit

Permalink
Fix existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prafull01 committed Jan 7, 2025
1 parent 53a9ff0 commit b1823de
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 14 deletions.
98 changes: 98 additions & 0 deletions build/templates/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,101 @@ iap:
# Create Google Cloud OAuth credentials and set client id and secret
# clientId:
# clientSecret:

# Use the CRDB Operator to manage the CRDB clusters
operator:
enabled: true
# Default values for the cluster chart.
image:
repository: cockroachdb/cockroach
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the cluster chart's appVersion.
tag: ""

nameOverride: ""
fullnameOverride: ""

# A map of CRDB cluster settings.
# See https://www.cockroachlabs.com/docs/stable/cluster-settings.html
clusterSettings: ~

# Regions controls the number of CRDB nodes that are deployed per region.
# regions: ~
# - code: us-central1
# nodes: 3

# loggingConf is the logging configuration used by cockroach.
# More details: https://www.cockroachlabs.com/docs/stable/logging-overview.html
loggingConf: ~
# sinks:
# stderr:
# channels: [health, dev]
# filter: INFO

# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as K3D. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the tilde after 'resources:'.
resources: ~
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

certificates:
# Any extra alt names that should be added to the node certs.
extraNodeAltNames: []
# - somevalue
# - somevalue.default
# - somevalue.default.svc.local
# the number of days generated certs are valid for
# validForDays: 3650

# External certificates for the CRDB cluster.
externalCertificates:
clientCaConfigMapName: my-release-cockroachdb-ca-secret-crt
nodeCaConfigMapName: my-release-cockroachdb-ca-secret-crt
httpSecretName: my-release-cockroachdb-client-secret
nodeClientSecretName: my-release-cockroachdb-client-secret
nodeSecretName: my-release-cockroachdb-node-secret
rootSqlClientSecretName: my-release-cockroachdb-client-secret

# RBAC settings for CRDB nodes
rbac:
# By default the service account will be the resource name. It will
# be created during the installation along with a namespaced role and
# a cluster role with the policy rules below.
#
# Uncomment the line below to use a custom SA. If a custom SA is used,
# no roles or bindings will be created.
# serviceAccountName: my-custom-sa

# Rules for the namespaced role bound to the service account.
#
# E.g.
# permissions:
# - apiGroup: [""]
# resources: ["secrets"]
# verbs: ["create", "get"]
rules: []

# Rules for the cluster role bound to the service account.
clusterRules:
# Get nodes allows the locality container to work as expected. It pulls the
# failure-domain.beta.kubernetes.io/zone label to determine node locality.
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get"]
serviceAccountName: ~

regions:
- code: us-east-1
nodes: 3
cloudProvider: k3d
namespace: default

extras:
# Add a container with dnsutils (nslookup, dig, ping, etc.) installed.
dnsutils: false
6 changes: 3 additions & 3 deletions cockroachdb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ operator:
clusterSettings: ~

# Regions controls the number of CRDB nodes that are deployed per region.
#regions: ~
# regions: ~
# - code: us-central1
# nodes: 3

Expand Down Expand Up @@ -764,7 +764,7 @@ operator:
# validForDays: 3650

# External certificates for the CRDB cluster.
externalCertificates:
externalCertificates:
clientCaConfigMapName: my-release-cockroachdb-ca-secret-crt
nodeCaConfigMapName: my-release-cockroachdb-ca-secret-crt
httpSecretName: my-release-cockroachdb-client-secret
Expand Down Expand Up @@ -799,7 +799,7 @@ operator:
resources: ["nodes"]
verbs: ["get"]
serviceAccountName: ~

regions:
- code: us-east-1
nodes: 3
Expand Down
11 changes: 10 additions & 1 deletion tests/e2e/install/cockroachdb_helm_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func TestCockroachDbHelmInstall(t *testing.T) {
options := &helm.Options{
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
SetValues: patchHelmValues(map[string]string{
"operator.enabled": "false",
"conf.cluster-name": "test",
"init.provisioning.enabled": "true",
"init.provisioning.databases[0].name": testDBName,
Expand Down Expand Up @@ -146,6 +147,7 @@ func TestCockroachDbHelmInstallWithCAProvided(t *testing.T) {
options := &helm.Options{
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
SetValues: patchHelmValues(map[string]string{
"operator.enabled": "false",
"tls.certs.selfSigner.caProvided": "true",
"tls.certs.selfSigner.caSecret": customCASecret,
}),
Expand Down Expand Up @@ -273,6 +275,7 @@ func TestCockroachDbHelmMigration(t *testing.T) {
options := &helm.Options{
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
SetValues: patchHelmValues(map[string]string{
"operator.enabled": "false",
"tls.certs.provided": "true",
"tls.certs.selfSigner.enabled": "false",
"tls.certs.clientRootSecret": crdbCluster.ClientSecret,
Expand Down Expand Up @@ -306,6 +309,7 @@ func TestCockroachDbHelmMigration(t *testing.T) {
options = &helm.Options{
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
SetValues: patchHelmValues(map[string]string{
"operator.enabled": "false",
"statefulset.updateStrategy.type": "OnDelete",
}),
ExtraArgs: map[string][]string{
Expand Down Expand Up @@ -363,7 +367,8 @@ func TestCockroachDbWithInsecureMode(t *testing.T) {
options := &helm.Options{
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
SetValues: patchHelmValues(map[string]string{
"tls.enabled": "false",
"operator.enabled": "false",
"tls.enabled": "false",
}),
}

Expand Down Expand Up @@ -453,6 +458,7 @@ spec:
options := &helm.Options{
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
SetValues: patchHelmValues(map[string]string{
"operator.enabled": "false",
"tls.enabled": "true",
"tls.certs.selfSigner.enabled": "false",
"tls.certs.certManager": "true",
Expand Down Expand Up @@ -485,6 +491,7 @@ func TestWALFailoverSideDiskExistingCluster(t *testing.T) {
testWALFailoverExistingCluster(
t,
patchHelmValues(map[string]string{
"operator.enabled": "false",
"conf.wal-failover.value": "path=cockroach-failover",
"conf.wal-failover.persistentVolume.enabled": "true",
"conf.wal-failover.persistentVolume.size": "1Gi",
Expand All @@ -496,6 +503,7 @@ func TestWALFailoverAmongStoresExistingCluster(t *testing.T) {
testWALFailoverExistingCluster(
t,
patchHelmValues(map[string]string{
"operator.enabled": "false",
"conf.wal-failover.value": "among-stores",
"conf.store.count": "2",
}),
Expand Down Expand Up @@ -530,6 +538,7 @@ func testWALFailoverExistingCluster(t *testing.T, additionalValues map[string]st

// Configure options for the initial deployment.
initialValues := patchHelmValues(map[string]string{
"operator.enabled": "false",
"conf.cluster-name": "test",
"conf.store.enabled": "true",
"statefulset.replicas": strconv.Itoa(numReplicas),
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/rotate/cockroachdb_rotate_certs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func TestCockroachDbRotateCertificates(t *testing.T) {

// Setup the args. For this test, we will set the following input values:
helmValues := map[string]string{
"operator.enabled": "false",
"tls.selfSigner.image.tag": tagOutput,
"storage.persistentVolume.size": "1Gi",
"tls.certs.selfSigner.minimumCertDuration": "24h",
Expand Down
6 changes: 4 additions & 2 deletions tests/k3d/dev-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
region="us-east-1"
zones=3

K3D_PATH="../../bin/k3d"

if [ $# -eq 0 ]
then
echo "No arguments supplied: "
Expand Down Expand Up @@ -58,7 +60,7 @@ set_node_labels() {
case $COMMAND in
up)
node_labels=$(set_node_labels ${nodes} ${region} ${zones})
k3d cluster create ${name} \
$(K3D_PATH) cluster create ${name} \
--network ${network_name} \
--registry-config "$SCRIPT_DIR/registries.yaml" \
--image rancher/k3s:v${version}-k3s1 \
Expand All @@ -67,7 +69,7 @@ case $COMMAND in
${node_labels}
;;
down)
k3d cluster delete ${name}
$(K3D_PATH) cluster delete ${name}
;;
*)
echo "Unknown command: $COMMAND"
Expand Down
Loading

0 comments on commit b1823de

Please sign in to comment.