Skip to content

Commit

Permalink
Change schemas.go check to use CassandraDatacenter
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm committed Dec 2, 2024
1 parent 9f6e9a9 commit 50f0640
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions controllers/k8ssandra/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,27 @@ func (r *K8ssandraClusterReconciler) checkSchemas(
}
}

decommCassDcName, dcNameOverride := k8ssandra.GetDatacenterForDecommission(kc)
logger.Info("Checking if user keyspace replication needs to be updated", "decommissioning_dc", decommCassDcName, "dc_name_override", dcNameOverride)
decommCassDcName, _ := k8ssandra.GetDatacenterForDecommission(kc)

logger.Info("Checking if user keyspace replication needs to be updated", "decommissioning_dc", decommCassDcName)
decommission := false
if decommCassDcName != "" {
decommission = kc.Status.Datacenters[decommCassDcName].DecommissionProgress == api.DecommUpdatingReplication
}
status := kc.Status.Datacenters[decommCassDcName]

if decommission {
kcKey := utils.GetKey(kc)
dc, _, err = r.findDcForDeletion(ctx, kcKey, decommCassDcName, remoteClient)
if err != nil {
return result.Error(err)
}

decommDcName := decommCassDcName
if dcNameOverride != "" {
decommDcName = dcNameOverride
if dc.Spec.DatacenterName != "" {
decommCassDcName = dc.Spec.DatacenterName
}

if recResult := r.checkUserKeyspacesReplicationForDecommission(kc, decommDcName, mgmtApi, logger); recResult.Completed() {
return recResult
}
Expand Down

0 comments on commit 50f0640

Please sign in to comment.