-
Notifications
You must be signed in to change notification settings - Fork 18
CLOUDP-321075: fail to reconcile mongo db search for version 1.47.0 #244
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
Changes from 3 commits
17d4a45
5ae3b26
e7699b3
5833c36
42d3d6d
c77b138
aa6c75d
d849a15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,9 @@ import ( | |
) | ||
|
||
const ( | ||
MongoDBSearchIndexFieldName = "mdbsearch-for-mongodbresourceref-index" | ||
MongoDBSearchIndexFieldName = "mdbsearch-for-mongodbresourceref-index" | ||
unsupportedSearchVersion = "1.47.0" | ||
unsupportedSearchVersionErrorFmt = "MongoDBSearch version %s is not supported" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make this error message more informative for the user? Let's mention why it's not supported, how the operator is treating it (ignoring it essentially), and perhaps that the existing workload will still work but cannot be reconfigured by the operator and they need to start from scratch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sounds like something that needs to be in the docs. |
||
) | ||
|
||
type OperatorSearchConfig struct { | ||
|
@@ -76,6 +78,10 @@ func (r *MongoDBSearchReconcileHelper) reconcile(ctx context.Context, log *zap.S | |
return workflow.Failed(err) | ||
} | ||
|
||
if err := r.ValidateSearchImageVersion(); err != nil { | ||
return workflow.Failed(err) | ||
} | ||
|
||
if err := r.ValidateSingleMongoDBSearchForSearchSource(ctx); err != nil { | ||
return workflow.Failed(err) | ||
} | ||
|
@@ -264,7 +270,32 @@ func (r *MongoDBSearchReconcileHelper) ValidateSingleMongoDBSearchForSearchSourc | |
for i, search := range searchList.Items { | ||
resourceNames[i] = search.Name | ||
} | ||
return xerrors.Errorf("Found multiple MongoDBSearch resources for search source '%s': %s", r.db.Name(), strings.Join(resourceNames, ", ")) | ||
return xerrors.Errorf( | ||
"Found multiple MongoDBSearch resources for search source '%s': %s", r.db.Name(), | ||
strings.Join(resourceNames, ", "), | ||
) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (r *MongoDBSearchReconcileHelper) ValidateSearchImageVersion() error { | ||
version := strings.TrimSpace(r.mdbSearch.Spec.Version) | ||
if version != "" { | ||
fealebenpae marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if version == unsupportedSearchVersion { | ||
return xerrors.Errorf(unsupportedSearchVersionErrorFmt, unsupportedSearchVersion) | ||
} | ||
return nil | ||
} | ||
|
||
if r.mdbSearch.Spec.StatefulSetConfiguration == nil { | ||
return nil | ||
} | ||
|
||
for _, container := range r.mdbSearch.Spec.StatefulSetConfiguration.SpecWrapper.Spec.Template.Spec.Containers { | ||
if strings.Contains(container.Image, unsupportedSearchVersion) { | ||
anandsyncs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return xerrors.Errorf(unsupportedSearchVersionErrorFmt, unsupportedSearchVersion) | ||
} | ||
} | ||
|
||
return nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a testcase for the statefulset codepath? I'd do it by doing the reconcile and then updating search.Spec.Version to "" (not sure if that will work)