mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
Merge pull request #45002 from zhangxiaoyu-zidif/statefulset-format-err
Automatic merge from submit-queue stateful_pod_control.go: format the code **What this PR does / why we need it**: 1.Improve the quality of the code. 2.Reduce reduandant parameters 3.add one comma **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
e2cec40641
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user