From 22df8ce36713c25ba9b1a70107f4aad887dfde94 Mon Sep 17 00:00:00 2001 From: Karthik K Date: Fri, 27 Aug 2021 16:01:06 +0530 Subject: [PATCH] [#1525][Platform][2.6 backport] New Universe creation gets public IP assigned even with flag = false Summary: When creating the universe, while choosing the node and replication factor, the nodeDetailsSet is added to the configuration. The assignPublicIP field in the nodeDetailsSet takes the current value of the assignPublicIP form value. So, later even if we change the value of assignPublicIP in form, it is not getting modified inside the nodeDetailsSet. This gets passed to the platform, and the platform creates nodes corresponding to the values present in the nodeDetailsSet , causing this discrepancy. Fix: Before submitting the form, we iterate through all of the nodeDetailsSet and assign the form value of the assignPublicIP to each the nodes inside nodeDetailsSet. Test Plan: teps followed: Choose Provider toggle off the assignPublicIP configure regions, nodes and replication factor. Turn on the assignPublicIP check , if the newly created universe has the public ip. and reversed the initial state of the toggle and tested again. The universe doesn't have the public IP (Actually, we can't test this scenario in portal. We need to subnet to test. The universe simple won't come up). Reviewers: mjoshi, cpadinjareveettil, ssutar Reviewed By: cpadinjareveettil, ssutar Subscribers: jenkins-bot, ui Differential Revision: https://phabricator.dev.yugabyte.com/D12765 --- .../components/universes/UniverseForm/UniverseForm.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/managed/ui/src/components/universes/UniverseForm/UniverseForm.js b/managed/ui/src/components/universes/UniverseForm/UniverseForm.js index 2d9a0bf0f130..5bb39a13ab0f 100644 --- a/managed/ui/src/components/universes/UniverseForm/UniverseForm.js +++ b/managed/ui/src/components/universes/UniverseForm/UniverseForm.js @@ -502,6 +502,16 @@ class UniverseForm extends Component { ]; } + submitPayload.nodeDetailsSet = submitPayload.nodeDetailsSet.map(nodeDetail => { + return { + ...nodeDetail, + cloudInfo: { + ...nodeDetail.cloudInfo, + assignPublicIP: formValues["primary"].assignPublicIP + } + } + }) + submitPayload.clusters = submitPayload.clusters.filter((c) => c.userIntent !== null); // filter clusters array if configuring(adding only) Read Replica due to server side validation if (type === 'Async') {