Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8SSAND-1636 ⁃ Allow the Cassandra DC name to be different than the CassandraDatacenter name #362

Closed
1 task done
jsanda opened this issue Jul 7, 2022 · 0 comments · Fixed by #475
Closed
1 task done
Assignees
Labels
done Issues in the state 'done' enhancement New feature or request

Comments

@jsanda
Copy link
Contributor

jsanda commented Jul 7, 2022

Depends on

What is missing?
The DC name as stored in Cassandra is always configured to be the same as the CassandraDatacenter name. We need to be able to specify a different name for the DC as stored in Cassandra.

Why do we need it?
This is needed in k8ssandra-operator to avoid naming collisions. See k8ssandra/k8ssandra-operator#615.

This can be supported pretty easily with a small change in the GetConfigAsJSON method (see here) by allowing properties under the datacenter-info key to be overridden. I will try to include a unit test for good measure.

Environment

  • Cass Operator version:

    v1.11.0

    **Anything else we need to know?**:

Update

After discussing this offline, we want to apply the same strategy as what's been done with cluster name overrides in k8ssandra-operator:

  • The cassdc CRD will get a new DcName field which will allow name overrides that aren't compliant with Kubernetes object names
  • This name will be passed as is to cass-config-builder
  • It will be sanitized to be made compliant with kubernetes names and labels, and will be used to name and label all subresources. Selectors will be modified accordingly.

In a nutshell, a new method will be created in the cassdc api looking as follows:

...
type CassandraDatacenterSpec struct {
...
...
  DcName string `json:"dcName,omitempty"`
...
}

// SanitizedName returns a sanitized version of the name returned by CassDcName()
func (in *CassandraDatacenter) SanitizedName() string {
	return CleanupForKubernetes(in.CassDcName())
}

// CassDcName returns the Cassandra DC name override if it exists,
// otherwise the cassdc object name.
func (in *CassandraDatacenter) CassDcName() string {
	if in.Spec.Cassandra.DcName != "" {
		return in.Spec.DcName
	}
	return in.Name
}

Wherever the cassdc.Name was previously use, we'll have to use cassdc.SanitizedName() instead, unless we want to refer directly to the cassdc object.

┆Issue is synchronized with this Jira Task by Unito
┆friendlyId: K8SSAND-1636
┆priority: Medium

@jsanda jsanda added the enhancement New feature or request label Jul 7, 2022
@jsanda jsanda self-assigned this Jul 7, 2022
@sync-by-unito sync-by-unito bot changed the title Allow the Cassandra DC name to be different than the CassandraDatacenter name K8SSAND-1636 ⁃ Allow the Cassandra DC name to be different than the CassandraDatacenter name Jul 7, 2022
@adejanovski adejanovski moved this to Assess/Investigate in K8ssandra Nov 8, 2022
@adejanovski adejanovski moved this from Assess/Investigate to Ready in K8ssandra Dec 20, 2022
@adejanovski adejanovski added the ready Issues in the state 'ready' label Dec 20, 2022
@adejanovski adejanovski assigned adejanovski and unassigned jsanda Jan 5, 2023
@adejanovski adejanovski moved this from Ready to In Progress in K8ssandra Jan 5, 2023
@adejanovski adejanovski added in-progress Issues in the state 'in-progress' and removed ready Issues in the state 'ready' labels Jan 5, 2023
@adejanovski adejanovski moved this from In Progress to Ready For Review in K8ssandra Jan 16, 2023
@adejanovski adejanovski added ready-for-review Issues in the state 'ready-for-review' and removed in-progress Issues in the state 'in-progress' labels Jan 16, 2023
@adejanovski adejanovski moved this from Ready For Review to Review in K8ssandra Jan 17, 2023
@adejanovski adejanovski added review Issues in the state 'review' and removed ready-for-review Issues in the state 'ready-for-review' labels Jan 17, 2023
@adejanovski adejanovski added review Issues in the state 'review' and removed ready-for-review Issues in the state 'ready-for-review' labels Jan 17, 2023
@github-project-automation github-project-automation bot moved this from Review to Done in K8ssandra Jan 19, 2023
@adejanovski adejanovski added done Issues in the state 'done' and removed review Issues in the state 'review' labels Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done Issues in the state 'done' enhancement New feature or request
Projects
No open projects
Archived in project
2 participants