Merge pull request #9710 from mesosphere/public-get-phase

export kubelet.GetPhase
This commit is contained in:
Abhi Shah
2015-06-12 13:46:35 -07:00
2 changed files with 8 additions and 6 deletions

View File

@@ -1991,8 +1991,10 @@ func (kl *Kubelet) tryUpdateNodeStatus() error {
return err
}
// getPhase returns the phase of a pod given its container info.
func getPhase(spec *api.PodSpec, info []api.ContainerStatus) api.PodPhase {
// GetPhase returns the phase of a pod given its container info.
// This func is exported to simplify integration with 3rd party kubelet
// integrations like kubernetes-mesos.
func GetPhase(spec *api.PodSpec, info []api.ContainerStatus) api.PodPhase {
running := 0
waiting := 0
stopped := 0
@@ -2111,7 +2113,7 @@ func (kl *Kubelet) generatePodStatus(pod *api.Pod) (api.PodStatus, error) {
}
// Assume info is ready to process
podStatus.Phase = getPhase(spec, podStatus.ContainerStatuses)
podStatus.Phase = GetPhase(spec, podStatus.ContainerStatuses)
for _, c := range spec.Containers {
for i, st := range podStatus.ContainerStatuses {
if st.Name == c.Name {