-
Notifications
You must be signed in to change notification settings - Fork 151
K8SPSMDB-1296: improve readiness probe #1917
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
base: main
Are you sure you want to change the base?
Conversation
"github.com/percona/percona-server-mongodb-operator/pkg/psmdb/mongo" | ||
) | ||
|
||
func getStatus(ctx context.Context, client mongo.Client) (ReplSetStatus, error) { |
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.
Why don't we have all the mongo client-related functions together as part of the type Client interface
? I understand that we are not committing to the interface segregation rule by doing that, but that interface is already containing everything (almost in terms of functionality).
Also the response type seems related to the generic mongo model and maybe can be moved to the mongo model file.
type ReplSetStatus struct {
...
}
This removes the need to have a utils file completely.
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 err != nil { | ||
log.Error(err, "Failed to get replset status") | ||
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.
i wonder if we should ignore all errors or only this node is not a member of replset
?
https://perconadev.atlassian.net/browse/K8SPSMDB-1296
DESCRIPTION
This PR improves readiness probe by verifying the
stateStr
field in thereplSetGetStatus
output. If it's not possible to execute the command, the readiness probe will not fail, because otherwise it wouldn't be possible to deploy a mongod statefulset. The readiness probe will fail if the value of thestateStr
is not equal toPrimary
,Secondary
orArbiter
CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
compare/*-oc.yml
)?Config/Logging/Testability