Wait for clean old RSs statuses in the middle of Recreate rollouts

This commit is contained in:
Michail Kargakis
2017-04-02 17:59:30 +02:00
parent 74c23bdf68
commit 97fed0aff4
7 changed files with 103 additions and 26 deletions

View File

@@ -570,7 +570,7 @@ func rsListFromClient(c clientset.Interface) rsListFunc {
if err != nil {
return nil, err
}
ret := []*extensions.ReplicaSet{}
var ret []*extensions.ReplicaSet
for i := range rsList.Items {
ret = append(ret, &rsList.Items[i])
}
@@ -827,9 +827,12 @@ func WaitForPodsHashPopulated(c extensionslisters.ReplicaSetLister, desiredGener
}
// LabelPodsWithHash labels all pods in the given podList with the new hash label.
// The returned bool value can be used to tell if all pods are actually labeled.
func LabelPodsWithHash(podList *v1.PodList, c clientset.Interface, podLister corelisters.PodLister, namespace, name, hash string) error {
for _, pod := range podList.Items {
// Ignore inactive Pods.
if !controller.IsPodActive(&pod) {
continue
}
// Only label the pod that doesn't already have the new hash
if pod.Labels[extensions.DefaultDeploymentUniqueLabelKey] != hash {
_, err := UpdatePodWithRetries(c.Core().Pods(namespace), podLister, pod.Namespace, pod.Name,