Skip to content

Commit

Permalink
fix: skip validation of num_tokens when upgrading from 3.x to 4.x
Browse files Browse the repository at this point in the history
Signed-off-by: Karol Szwaj <[email protected]>
  • Loading branch information
cnvergence committed Nov 21, 2023
1 parent be45e84 commit a9ff56b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/cassandra/datacenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cassandra

import (
"fmt"
"strings"

"github.com/Masterminds/semver/v3"
"github.com/k8ssandra/cass-operator/apis/cassandra/v1beta1"
Expand Down Expand Up @@ -507,6 +508,11 @@ func ValidateConfig(desiredDc, actualDc *cassdcapi.CassandraDatacenter) error {
return err
}

// Skip validation if upgrading from 3.x to 4.x, num_tokens defaults were changed
if strings.HasPrefix(actualDc.Spec.ServerVersion, "3.") && strings.HasPrefix(desiredDc.Spec.ServerVersion, "4.") {
return nil
}

Check warning on line 514 in pkg/cassandra/datacenter.go

View check run for this annotation

Codecov / codecov/patch

pkg/cassandra/datacenter.go#L512-L514

Added lines #L512 - L514 were not covered by tests

actualCassYaml, foundActualYaml := actualConfig["cassandra-yaml"].(map[string]interface{})
desiredCassYaml, foundDesiredYaml := desiredConfig["cassandra-yaml"].(map[string]interface{})

Expand Down

0 comments on commit a9ff56b

Please sign in to comment.