mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #1356 from brendandburns/healthz
Adjust the logic, so that if the apiserver restarts, or has no pod info
This commit is contained in:
commit
12b677ad56
@ -224,7 +224,7 @@ func getInstanceIP(cloud cloudprovider.Interface, host string) string {
|
||||
}
|
||||
|
||||
func getPodStatus(pod *api.Pod, minions client.MinionInterface) (api.PodStatus, error) {
|
||||
if pod.CurrentState.Info == nil || pod.CurrentState.Host == "" {
|
||||
if pod.CurrentState.Host == "" {
|
||||
return api.PodWaiting, nil
|
||||
}
|
||||
res, err := minions.ListMinions()
|
||||
@ -242,6 +242,9 @@ func getPodStatus(pod *api.Pod, minions client.MinionInterface) (api.PodStatus,
|
||||
if !found {
|
||||
return api.PodTerminated, nil
|
||||
}
|
||||
if pod.CurrentState.Info == nil {
|
||||
return api.PodWaiting, nil
|
||||
}
|
||||
running := 0
|
||||
stopped := 0
|
||||
unknown := 0
|
||||
|
@ -377,6 +377,16 @@ func TestMakePodStatus(t *testing.T) {
|
||||
test string
|
||||
}{
|
||||
{&api.Pod{DesiredState: desiredState, CurrentState: currentState}, api.PodWaiting, "waiting"},
|
||||
{
|
||||
&api.Pod{
|
||||
DesiredState: desiredState,
|
||||
CurrentState: api.PodState{
|
||||
Host: "machine-2",
|
||||
},
|
||||
},
|
||||
api.PodTerminated,
|
||||
"no info, but bad machine",
|
||||
},
|
||||
{
|
||||
&api.Pod{
|
||||
DesiredState: desiredState,
|
||||
|
Loading…
Reference in New Issue
Block a user