Skip to content

Commit a14772d

Browse files
committed
fix: fix resume bug not uncordoning
1 parent ea41935 commit a14772d

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

k8s/kubesnooze.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ rules:
1919
verbs: ["get", "list", "watch"]
2020
- apiGroups: [""]
2121
resources: ["nodes"]
22-
verbs: ["get", "patch"]
22+
verbs: ["get", "patch", "list", "watch"]
2323
- apiGroups: [""]
2424
resources: ["pods"]
2525
verbs: ["get", "list", "watch"]

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,15 @@ func (r *DeploymentReconciler) startTimer() {
9494
r.timerStarted = true
9595
go func() {
9696
<-r.timer.C
97+
r.timerStarted = false
9798
drainNode(context.Background(), r.Client)
9899
sleepServer()
100+
// sleepServer blocks until the machine wakes from suspend.
101+
// The container resumes here rather than restarting, so we must
102+
// uncordon the node explicitly instead of relying on the startup path.
103+
if err := uncordonNode(context.Background(), r.Client); err != nil {
104+
log.FromContext(context.Background()).Error(err, "failed to uncordon node after wake")
105+
}
99106
}()
100107
}
101108

0 commit comments

Comments
 (0)