-
Notifications
You must be signed in to change notification settings - Fork 149
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
K8SPSMDB-1249: Fix smart update for pods that are not member of replset #1781
base: main
Are you sure you want to change the base?
Conversation
membersLive := 0 | ||
for _, member := range rsMembers { | ||
switch member.State { | ||
case mongo.MemberStatePrimary, mongo.MemberStateSecondary, mongo.MemberStateArbiter: |
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.
minor: Here we can also include the default case with a continue action.
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.
is there any practical difference?
podName, ok := tags["podName"] | ||
if !ok { | ||
continue | ||
} |
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.
We can write this in a more compact way if we want given that podName
is not used further, like this:
if podName, ok := tags["podName"]; ok {
rsMembers[podName] = api.ReplsetMemberStatus{
Name: member.Name,
State: member.State,
StateStr: member.StateStr,
}
}
it is also more consistent with the style we are using in the same function.
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.
commit: c958127 |
CHANGE DESCRIPTION
Problem:
Operator can not finish smart update if update is triggered before replset is initialized.
Steps to reproduce:
cluster1-cfg-0
and creates users there. As of now, replset has only one member:cluster1-cfg-0
.cluster1-cfg-2
.cluster1-cfg-2
is not added to replset yet.Solution:
Maintain a map of members in cluster status and check if pod is a member of replset using this map. If pod is not a member, operator doesn't need to check if pod is primary and just update it.
CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
compare/*-oc.yml
)?Config/Logging/Testability