mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Merge pull request #111207 from lucming/code-cleanup2
Reduce indentation in daemonset controller code
This commit is contained in:
commit
5fe12aae11
@ -1104,7 +1104,10 @@ func (dsc *DaemonSetsController) updateDaemonSetStatus(ctx context.Context, ds *
|
|||||||
|
|
||||||
if shouldRun {
|
if shouldRun {
|
||||||
desiredNumberScheduled++
|
desiredNumberScheduled++
|
||||||
if scheduled {
|
if !scheduled {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
currentNumberScheduled++
|
currentNumberScheduled++
|
||||||
// Sort the daemon pods by creation time, so that the oldest is first.
|
// Sort the daemon pods by creation time, so that the oldest is first.
|
||||||
daemonPods, _ := nodeToDaemonPods[node.Name]
|
daemonPods, _ := nodeToDaemonPods[node.Name]
|
||||||
@ -1125,7 +1128,6 @@ func (dsc *DaemonSetsController) updateDaemonSetStatus(ctx context.Context, ds *
|
|||||||
if util.IsPodUpdated(pod, hash, generation) {
|
if util.IsPodUpdated(pod, hash, generation) {
|
||||||
updatedNumberScheduled++
|
updatedNumberScheduled++
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if scheduled {
|
if scheduled {
|
||||||
numberMisscheduled++
|
numberMisscheduled++
|
||||||
@ -1325,14 +1327,17 @@ func getUnscheduledPodsWithoutNode(runningNodesList []*v1.Node, nodeToDaemonPods
|
|||||||
for _, node := range runningNodesList {
|
for _, node := range runningNodesList {
|
||||||
isNodeRunning[node.Name] = true
|
isNodeRunning[node.Name] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
for n, pods := range nodeToDaemonPods {
|
for n, pods := range nodeToDaemonPods {
|
||||||
if !isNodeRunning[n] {
|
if isNodeRunning[n] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
for _, pod := range pods {
|
for _, pod := range pods {
|
||||||
if len(pod.Spec.NodeName) == 0 {
|
if len(pod.Spec.NodeName) == 0 {
|
||||||
results = append(results, pod.Name)
|
results = append(results, pod.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user