stateful_pod_control.go: format the code

This commit is contained in:
zhangxiaoyu-zidif 2017-04-28 18:16:19 +08:00
parent acca01bcc2
commit 026638af51

View File

@ -112,18 +112,17 @@ func (spc *realStatefulPodControl) UpdateStatefulPod(set *apps.StatefulSet, pod
return err
}
}
// if the Pod is not dirty do nothing
// if the Pod is not dirty, do nothing
if consistent {
return nil
}
attemptedUpdate = true
// commit the update, retrying on conflicts
_, err := spc.client.Core().Pods(set.Namespace).Update(pod)
if err == nil {
_, updateErr := spc.client.Core().Pods(set.Namespace).Update(pod)
if updateErr == nil {
return nil
}
updateErr := err
if updated, err := spc.podLister.Pods(set.Namespace).Get(pod.Name); err == nil {
// make a copy so we don't mutate the shared cache
@ -154,13 +153,11 @@ func (spc *realStatefulPodControl) UpdateStatefulSetStatus(set *apps.StatefulSet
return retry.RetryOnConflict(retry.DefaultBackoff, func() error {
set.Status.Replicas = replicas
set.Status.ObservedGeneration = &generation
_, err := spc.client.Apps().StatefulSets(set.Namespace).UpdateStatus(set)
if err == nil {
_, updateErr := spc.client.Apps().StatefulSets(set.Namespace).UpdateStatus(set)
if updateErr == nil {
return nil
}
updateErr := err
if updated, err := spc.setLister.StatefulSets(set.Namespace).Get(set.Name); err == nil {
// make a copy so we don't mutate the shared cache
if copy, err := scheme.Scheme.DeepCopy(updated); err == nil {