Fix a bug when vm hosting master mongodb is down #80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pod mongodb-0 (master) was on node master1. After master1 was shut down, mongodb-0's STATUS was in "Unknown", whereas pod.status.phase was "Running". mongodb-0 is repetitively selected as the cluster's master and removed from cluster as it is not reachable. It inhibited other cluster members to become a master. Sidecar needs to check correct field for pod status.
----logs---
$ kubectl logs -n=maglev-system mongodb-2 -c mongo-sidecar
...
Pod has been elected as a secondary to do primary work
Addresses to add: [ 'mongodb-0.mongodb.svc.cluster.local:27017' ]
...
$ kubectl get po mongodb-0 -n=maglev-system
NAME READY STATUS RESTARTS AGE
mongodb-0 3/3 Unknown 0 20h
$ kubectl get po mongodb-0 -n=maglev-system -oyaml | grep phase
phase: Running