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

[CLOUDGA-26365] Fix comparison of regional OptionalClusterNodeInfo #296

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ func (a *AuthApiClient) GetProjectID(projectID string) (string, error) {
return projectData[0].Info.Id, nil
}

func optionalClusterNodeInfoEquals(left ybmclient.OptionalClusterNodeInfo, right ybmclient.OptionalClusterNodeInfo) bool {
return left.MemoryMb == right.MemoryMb && left.NumCores == right.NumCores && left.DiskSizeGb == right.DiskSizeGb && left.HasDiskIops() == right.HasDiskIops() && left.GetDiskIops() == right.GetDiskIops()
}

func (a *AuthApiClient) buildClusterSpec(cmd *cobra.Command, regionInfoList []map[string]string, regionNodeConfigsMap map[string][]ybmclient.NodeConfigurationResponseItem) (*ybmclient.ClusterSpec, error) {

var trackId string
Expand Down Expand Up @@ -355,7 +359,7 @@ func (a *AuthApiClient) buildClusterSpec(cmd *cobra.Command, regionInfoList []ma
r := regionInfo.GetPlacementInfo().CloudInfo.Region
clusterRegionInfo[i].SetNodeInfo(*regionNodeInfoMap[r])
logrus.Debugf("region=%s, node-info=%v\n", r, clusterRegionInfo[i].GetNodeInfo())
if currRegionNodeInfo != nil && !geoPartitioned && *currRegionNodeInfo != clusterRegionInfo[i].GetNodeInfo() {
if currRegionNodeInfo != nil && !geoPartitioned && !optionalClusterNodeInfoEquals(*currRegionNodeInfo, clusterRegionInfo[i].GetNodeInfo()) {
// Asymmetric node configurations are only allowed for geo-partitioned clusters.
logrus.Fatalln("Synchronous cluster regions must have identical node configurations")
}
Expand Down