Skip to content

Commit 7377228

Browse files
committed
address review comments
1 parent 7f3b2c2 commit 7377228

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

Diff for: Makefile

-4
Original file line numberDiff line numberDiff line change
@@ -812,10 +812,6 @@ site: site/themes/docsy/assets/vendor/bootstrap/package.js out/hugo/hugo ## Serv
812812
out/mkcmp:
813813
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ cmd/performance/mkcmp/main.go
814814

815-
.PHONY: out/auto-pause # auto pause binary to be used for auto-pause addon (only linux)
816-
out/auto-pause: $(SOURCE_GENERATED) $(SOURCE_FILES)
817-
GOOS=linux GOARCH=$(GOARCH) go build -o $@ cmd/auto-pause/auto-pause.go
818-
819815
.PHONY: deploy/kicbase/auto-pause # auto pause binary to be used for kic image work arround for not passing the whole repo as docker context
820816
deploy/kicbase/auto-pause: $(SOURCE_GENERATED) $(SOURCE_FILES)
821817
GOOS=linux GOARCH=$(GOARCH) go build -o $@ cmd/auto-pause/auto-pause.go

Diff for: cmd/auto-pause/auto-pause.go

+5-11
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
"k8s.io/minikube/pkg/minikube/style"
3333
)
3434

35-
var incomeCh = make(chan struct{})
35+
var unpauseRequests = make(chan struct{})
3636
var done = make(chan struct{})
3737
var mu sync.Mutex
3838

@@ -53,7 +53,7 @@ func main() {
5353
select {
5454
case <-time.After(interval):
5555
runPause()
56-
case <-incomeCh:
56+
case <-unpauseRequests:
5757
fmt.Printf("Got request\n")
5858
if runtimePaused {
5959
runUnpause()
@@ -71,7 +71,7 @@ func main() {
7171

7272
// handler echoes the Path component of the requested URL.
7373
func handler(w http.ResponseWriter, r *http.Request) {
74-
incomeCh <- struct{}{}
74+
unpauseRequests <- struct{}{}
7575
<-done
7676
fmt.Fprintf(w, "allow")
7777
}
@@ -83,8 +83,6 @@ func runPause() {
8383
return
8484
}
8585

86-
ids := []string{}
87-
8886
r := command.NewExecRunner(true)
8987

9088
cr, err := cruntime.New(cruntime.Config{Type: runtime, Runner: r})
@@ -98,18 +96,15 @@ func runPause() {
9896
}
9997

10098
runtimePaused = true
101-
ids = append(ids, uids...)
10299

103-
out.Step(style.Unpause, "Paused {{.count}} containers", out.V{"count": len(ids)})
100+
out.Step(style.Unpause, "Paused {{.count}} containers", out.V{"count": len(uids)})
104101
}
105102

106103
func runUnpause() {
107104
fmt.Println("unpausing...")
108105
mu.Lock()
109106
defer mu.Unlock()
110107

111-
ids := []string{}
112-
113108
r := command.NewExecRunner(true)
114109

115110
cr, err := cruntime.New(cruntime.Config{Type: runtime, Runner: r})
@@ -121,8 +116,7 @@ func runUnpause() {
121116
if err != nil {
122117
exit.Error(reason.GuestUnpause, "Unpause", err)
123118
}
124-
ids = append(ids, uids...)
125119
runtimePaused = false
126120

127-
out.Step(style.Unpause, "Unpaused {{.count}} containers", out.V{"count": len(ids)})
121+
out.Step(style.Unpause, "Unpaused {{.count}} containers", out.V{"count": len(uids)})
128122
}

Diff for: deploy/addons/auto-pause/auto-pause.service

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ ExecStart=/usr/local/bin/auto-pause
77
Restart=always
88

99
[Install]
10-
WantedBy=multi-user.target
10+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)