Skip to content

Commit cf5ecc0

Browse files
committed
Disallow project renaming
While this is possible in Atlas, the implementation in the operator causes a new project to be created. Other resources like AtlasDeployment then continue to track the clusters in the original project. Since that behavior is clearly wrong, let's forbid changing this field until AKO can implement renaming support for projects properly.
1 parent b109cdb commit cf5ecc0

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

api/v1/atlasproject_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func init() {
4343
type AtlasProjectSpec struct {
4444

4545
// Name is the name of the Project that is created in Atlas by the Operator if it doesn't exist yet.
46+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Name cannot be modified after project creation"
4647
Name string `json:"name"`
4748

4849
// RegionUsageRestrictions designate the project's AWS region when using Atlas for Government.

config/crd/bases/atlas.mongodb.com_atlasprojects.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,9 @@ spec:
746746
description: Name is the name of the Project that is created in Atlas
747747
by the Operator if it doesn't exist yet.
748748
type: string
749+
x-kubernetes-validations:
750+
- message: Name cannot be modified after project creation
751+
rule: self == oldSelf
749752
networkPeers:
750753
description: NetworkPeers is a list of Network Peers configured for
751754
the current Project.

0 commit comments

Comments
 (0)