Skip to content

Commit 1a22cc7

Browse files
committed
[PLAT-18932]Disabling default region change via the operator
Summary: We don't support changing the default region from the UI, ensuring we have same functionality using operator as well. This restriction can be removed once we have evaluated and tested that we are supporting default region edits. Test Plan: Tested locally Reviewers: vkumar Reviewed By: vkumar Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D48154
1 parent c22f683 commit 1a22cc7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

managed/src/main/java/com/yugabyte/yw/common/operator/resources/universeCrd.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,16 @@ spec:
4343
placementInfo:
4444
description: Placement information for the universe.
4545
type: object
46+
x-kubernetes-validations:
47+
- message: defaultRegion cannot be removed once set.
48+
rule: has(self.defaultRegion) || !has(oldSelf.defaultRegion)
4649
properties:
4750
defaultRegion:
4851
type: string
4952
description: Default region for the universe.
53+
x-kubernetes-validations:
54+
- message: defaultRegion cannot be changed once set.
55+
rule: self == oldSelf
5056
regions:
5157
type: array
5258
description: Regions for the universe.

managed/src/main/java/com/yugabyte/yw/common/operator/utils/OperatorUtils.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,7 @@ public boolean checkIfPlacementInfoChanged(
416416
}
417417
JsonNode oldPlacementCloud = objectMapper.valueToTree(oldPlacementInfo.cloudList.get(0));
418418
JsonNode newPlacementCloud = objectMapper.valueToTree(ybUniverse.getSpec().getPlacementInfo());
419-
if (oldPlacementCloud
420-
.path("defaultRegion")
421-
.asText()
422-
.equals(newPlacementCloud.path("defaultRegion").asText())) {
423-
return true;
424-
}
419+
425420
Map<String, JsonNode> oldRegions = mapByCode(oldPlacementCloud.path("regionList"));
426421
Map<String, JsonNode> newRegions = mapByCode(newPlacementCloud.path("regions"));
427422

0 commit comments

Comments
 (0)