-
Notifications
You must be signed in to change notification settings - Fork 49
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
Extracted DB and Object Storage Error Logs to display on DSPA #487
Conversation
A new image has been built to help with testing out this PR: To use this image run the following: cd $(mktemp -d)
git clone git@github.com:opendatahub-io/data-science-pipelines-operator.git
cd data-science-pipelines-operator/
git fetch origin pull/487/head
git checkout -b pullrequest 0f483ae689090cb85936aa973847d10df6e73b2a
make deploy IMG="quay.io/opendatahub/data-science-pipelines-operator:pr-487" More instructions here on how to deploy and test a Data Science Pipelines Application. |
Change to PR detected. A new PR build was completed. |
Change to PR detected. A new PR build was completed. |
/lgtm |
controllers/database.go
Outdated
@@ -37,47 +38,49 @@ var mariadbTemplates = []string{ | |||
} | |||
|
|||
// extract to var for mocking in testing | |||
var ConnectAndQueryDatabase = func(host, port, username, password, dbname string, dbConnectionTimeout time.Duration) bool { | |||
var ConnectAndQueryDatabase = func(host, port, username, password, dbname string, dbConnectionTimeout time.Duration) (bool, string) { |
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.
if the intended purpose of message
is for error handling, why don't we just return error
s rather than string
s and let the caller of this function get the message from errror.Error()
? This is much closer to what is conventional in golang
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.
I took your suggestion and did the same, but I decided to return errors where custom messaging was provided which makes it easier to read on the Web UI.
controllers/database.go
Outdated
} | ||
|
||
decodePass, _ := b64.StdEncoding.DecodeString(params.DBConnection.Password) | ||
dbConnectionTimeout := config.GetDurationConfigWithDefault(config.DBConnectionTimeoutConfigName, config.DefaultDBConnectionTimeout) | ||
|
||
log.V(1).Info(fmt.Sprintf("Database Heath Check connection timeout: %s", dbConnectionTimeout)) | ||
|
||
dbHealthCheckPassed := ConnectAndQueryDatabase(params.DBConnection.Host, | ||
dbHealthCheckPassed, message := ConnectAndQueryDatabase(params.DBConnection.Host, |
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.
alternatively/additionally to above, we could just return an error
, and then assume success/failure below based on err != nil
, which is a standard and common check
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.
Since the function itself returns a bool
apart from the error
, I let it be and decided to assume the success/failure below based on err != nil
though.
Change to PR detected. A new PR build was completed. |
Change to PR detected. A new PR build was completed. |
Change to PR detected. A new PR build was completed. |
Change to PR detected. A new PR build was completed. |
Change to PR detected. A new PR build was completed. |
Change to PR detected. A new PR build was completed. |
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.
/lgtm
Change to PR detected. A new PR build was completed. |
controllers/database.go
Outdated
return true | ||
infoMessage := "Database health check disabled, assuming database is available and ready." | ||
log.V(1).Info(infoMessage) | ||
return true, errors.New(infoMessage) |
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.
i'm not sure we should return the infoMessage as an error rather than just log a message and return nil
. Seems a bit questionable to have a 'happy error', per se, esp since this is mostly a dev enablement feature, but interested what others think.
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.
I agree with @gmfrasca.
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.
I believe that was the case before I converted from string
to error
which makes sense to me as well.
Signed-off-by: Achyut Madhusudan <amadhusu@redhat.com>
Change to PR detected. A new PR build was completed. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: diegolovison, gmfrasca, hbelmiro The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The issue resolved by this Pull Request:
Resolves #451
Description of your changes:
Extracted DB and Object Storage Error Logs which were only visible in DSPO to display on DSPA Conditions with a brief message of any error.
Testing instructions
Checklist