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

Prevent changes of DC name or both adding and removing a DC at the same time. K8OP-263 #1426

Merged
merged 7 commits into from
Oct 7, 2024

Conversation

Miles-Garnsey
Copy link
Member

What this PR does:

Fixes #1422

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Changes manually tested
  • Automated Tests added/updated
  • Documentation added/updated
  • CHANGELOG.md updated (not required for documentation PRs)
  • CLA Signed: DataStax CLA

@Miles-Garnsey Miles-Garnsey requested a review from a team as a code owner October 4, 2024 09:08
@Miles-Garnsey Miles-Garnsey force-pushed the feature/dcnamechangeprevention branch from a6adb65 to 956754b Compare October 4, 2024 09:55
Copy link

sonarqubecloud bot commented Oct 4, 2024

@adejanovski adejanovski changed the title Prevent changes of DC name or both adding and removing a DC at the same time. Prevent changes of DC name or both adding and removing a DC at the same time. K8OP-263 Oct 4, 2024
@adejanovski adejanovski requested a review from burmanm October 4, 2024 14:36
@adejanovski
Copy link
Contributor

@burmanm, could you do another round of review now that @Miles-Garnsey addressed your comments? Thanks!

@burmanm
Copy link
Contributor

burmanm commented Oct 4, 2024

I've approved due to time constraint, even if the reconcile process isn't really unit tested, but hopefully that is addressed next week.

@@ -172,7 +173,9 @@ func (r *K8ssandraCluster) ValidateUpdate(old runtime.Object) (admission.Warning
if err := validateUpdateNumTokens(oldCluster.Spec.Cassandra, r.Spec.Cassandra); err != nil {
return nil, err
}

if DcRemoved(oldCluster.Spec, r.Spec) && DcAdded(oldCluster.Spec, r.Spec) {
return nil, fmt.Errorf("renaming, as well as adding and removing DCs at the same time is prohibited as it can cause data loss")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] It would be nice to also include the names of the removed and added DCs.

@Miles-Garnsey Miles-Garnsey merged commit 48c69f6 into main Oct 7, 2024
61 of 62 checks passed
adejanovski pushed a commit that referenced this pull request Oct 7, 2024
…me time. K8OP-263 (#1426)

* Prevent changes of DC name or both adding and removing a DC at the same time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing a DC name should be forbidden
4 participants