Skip to content

Commit

Permalink
Merge pull request kubernetes#22245 from nikhiljindal/deploymentTimeo…
Browse files Browse the repository at this point in the history
…utErrors

Improving deployment e2e failure error messages
  • Loading branch information
bgrant0607 committed Mar 2, 2016
2 parents 6deb261 + 0dae82f commit 4b213ed
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/util/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ func addHashKeyToRSAndPods(deployment *extensions.Deployment, c clientset.Interf
// 2. Update all pods managed by the rs to have the new hash label, so they will be correctly adopted.
selector, err := unversioned.LabelSelectorAsSelector(updatedRS.Spec.Selector)
if err != nil {
return nil, err
return nil, fmt.Errorf("error in converting selector to label selector for replica set %s: %s", updatedRS.Name, err)
}
options := api.ListOptions{LabelSelector: selector}
podList, err := getPodList(namespace, options)
if err != nil {
return nil, err
return nil, fmt.Errorf("error in getting pod list for namespace %s and list options %+v: %s", namespace, options, err)
}
if err = labelPodsWithHash(podList, c, namespace, hash); err != nil {
return nil, err
return nil, fmt.Errorf("error in adding template hash label %s to pods %+v: %s", hash, podList, err)
}
glog.V(4).Infof("Labeled rs %s's pods with hash %s.", rs.Name, hash)

Expand Down Expand Up @@ -251,7 +251,7 @@ func labelPodsWithHash(podList *api.PodList, c clientset.Interface, namespace, h
if _, err := updatePodWithRetries(c.Core().Pods(namespace), &pod, func(podToUpdate *api.Pod) {
podToUpdate.Labels = labelsutil.AddLabel(podToUpdate.Labels, extensions.DefaultDeploymentUniqueLabelKey, hash)
}); err != nil {
return err
return fmt.Errorf("error in adding template hash label %s to pod %+v: %s", hash, pod, err)
}
glog.V(4).Infof("Labeled pod %s with hash %s.", pod.Name, hash)
}
Expand Down Expand Up @@ -304,6 +304,9 @@ func updatePodWithRetries(podClient unversionedcore.PodInterface, pod *api.Pod,
// Update could have failed due to conflict error. Try again.
return false, nil
})
if err == wait.ErrWaitTimeout {
return nil, fmt.Errorf("timed out trying to update pod: %+v", oldPod)
}
return pod, err
}

Expand Down

0 comments on commit 4b213ed

Please sign in to comment.