You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CLOUDP-249012: Fix project retrieval when project prefixes overlap (#3720)
# Summary
This patch fixes an error when the project look-up throws an error when
an in-exact project name match was found, as illustrated in the modified
E2E test:
- Previously, if trying to create `projectA` and `projectABC` already
exists, the project lookup would raise an error because the API would
return `projectABC` and when looping over the response, no exact match
for `projectA` would be found and instead of returning an empty project
to be created, the operator would raise an error and `projectA` would
fail to be created.
## Documentation changes
* [x] Add an entry to [release notes](.../RELEASE_NOTES.md).
* [ ] When needed, make sure you create a new [DOCSP
ticket](https://jira.mongodb.org/projects/DOCSP) that documents your
change.
## Changes to CRDs
* [ ] Add `slaskawi`(Sebastian) and `@giohan` (George) as reviewers.
* [ ] Make sure any changes are reflected on `/public/samples`
directory.
Copy file name to clipboardExpand all lines: RELEASE_NOTES.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,8 +36,12 @@
36
36
to any other value than 1.
37
37
***MongoDB**, **AppDB**, **MongoDBMulti**: make sure to use external domains in the connectionString created if configured.
38
38
39
-
***MongoDB**: remove panic when configuring shorter horizon config compared to number of members. Instead return a
40
-
descriptive error.
39
+
***MongoDB**: Removed panic response when configuring shorter horizon config compared to number of members. The operator now signals a
40
+
descriptive error in the status of the **MongoDB** resource.
41
+
42
+
***MongoDB**: Fixed a bug where creating a resource in a new project named as a prefix of another project would fail, preventing the `MongoDB` resource to be created.
returnnil, xerrors.Errorf("found more than one project with name %s in organization %s (%s): %v", projectName, organization.ID, organization.Name, strings.Join(projectsList, ", "))
179
-
}
175
+
iflen(projectsFound) ==1 {
176
+
// If there is just one project returned, and it matches the name, return it.
// This should not happen, but older versions of OM supported the same name for a project in an org. We cannot proceed here so we return an error.
183
+
returnnil, xerrors.Errorf("found more than one project with name %s in organization %s (%s): %v", projectName, organization.ID, organization.Name, strings.Join(projectsList, ", "))
180
184
}
181
185
182
-
returnnil, xerrors.Errorf("could not find project %s in organization %s", projectName, organization.ID)
186
+
// If there is no error from the API and no match in the response, return an empty project and no error.
0 commit comments