address review comments
parent
7f3b2c2a7b
commit
73772286eb
4
Makefile
4
Makefile
|
@ -812,10 +812,6 @@ site: site/themes/docsy/assets/vendor/bootstrap/package.js out/hugo/hugo ## Serv
|
|||
out/mkcmp:
|
||||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ cmd/performance/mkcmp/main.go
|
||||
|
||||
.PHONY: out/auto-pause # auto pause binary to be used for auto-pause addon (only linux)
|
||||
out/auto-pause: $(SOURCE_GENERATED) $(SOURCE_FILES)
|
||||
GOOS=linux GOARCH=$(GOARCH) go build -o $@ cmd/auto-pause/auto-pause.go
|
||||
|
||||
.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
|
||||
deploy/kicbase/auto-pause: $(SOURCE_GENERATED) $(SOURCE_FILES)
|
||||
GOOS=linux GOARCH=$(GOARCH) go build -o $@ cmd/auto-pause/auto-pause.go
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/style"
|
||||
)
|
||||
|
||||
var incomeCh = make(chan struct{})
|
||||
var unpauseRequests = make(chan struct{})
|
||||
var done = make(chan struct{})
|
||||
var mu sync.Mutex
|
||||
|
||||
|
@ -53,7 +53,7 @@ func main() {
|
|||
select {
|
||||
case <-time.After(interval):
|
||||
runPause()
|
||||
case <-incomeCh:
|
||||
case <-unpauseRequests:
|
||||
fmt.Printf("Got request\n")
|
||||
if runtimePaused {
|
||||
runUnpause()
|
||||
|
@ -71,7 +71,7 @@ func main() {
|
|||
|
||||
// handler echoes the Path component of the requested URL.
|
||||
func handler(w http.ResponseWriter, r *http.Request) {
|
||||
incomeCh <- struct{}{}
|
||||
unpauseRequests <- struct{}{}
|
||||
<-done
|
||||
fmt.Fprintf(w, "allow")
|
||||
}
|
||||
|
@ -83,8 +83,6 @@ func runPause() {
|
|||
return
|
||||
}
|
||||
|
||||
ids := []string{}
|
||||
|
||||
r := command.NewExecRunner(true)
|
||||
|
||||
cr, err := cruntime.New(cruntime.Config{Type: runtime, Runner: r})
|
||||
|
@ -98,9 +96,8 @@ func runPause() {
|
|||
}
|
||||
|
||||
runtimePaused = true
|
||||
ids = append(ids, uids...)
|
||||
|
||||
out.Step(style.Unpause, "Paused {{.count}} containers", out.V{"count": len(ids)})
|
||||
out.Step(style.Unpause, "Paused {{.count}} containers", out.V{"count": len(uids)})
|
||||
}
|
||||
|
||||
func runUnpause() {
|
||||
|
@ -108,8 +105,6 @@ func runUnpause() {
|
|||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
ids := []string{}
|
||||
|
||||
r := command.NewExecRunner(true)
|
||||
|
||||
cr, err := cruntime.New(cruntime.Config{Type: runtime, Runner: r})
|
||||
|
@ -121,8 +116,7 @@ func runUnpause() {
|
|||
if err != nil {
|
||||
exit.Error(reason.GuestUnpause, "Unpause", err)
|
||||
}
|
||||
ids = append(ids, uids...)
|
||||
runtimePaused = false
|
||||
|
||||
out.Step(style.Unpause, "Unpaused {{.count}} containers", out.V{"count": len(ids)})
|
||||
out.Step(style.Unpause, "Unpaused {{.count}} containers", out.V{"count": len(uids)})
|
||||
}
|
||||
|
|
|
@ -7,4 +7,4 @@ ExecStart=/usr/local/bin/auto-pause
|
|||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
|
Loading…
Reference in New Issue