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:
|
out/mkcmp:
|
||||||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ cmd/performance/mkcmp/main.go
|
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
|
.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)
|
deploy/kicbase/auto-pause: $(SOURCE_GENERATED) $(SOURCE_FILES)
|
||||||
GOOS=linux GOARCH=$(GOARCH) go build -o $@ cmd/auto-pause/auto-pause.go
|
GOOS=linux GOARCH=$(GOARCH) go build -o $@ cmd/auto-pause/auto-pause.go
|
||||||
|
|
|
@ -32,7 +32,7 @@ import (
|
||||||
"k8s.io/minikube/pkg/minikube/style"
|
"k8s.io/minikube/pkg/minikube/style"
|
||||||
)
|
)
|
||||||
|
|
||||||
var incomeCh = make(chan struct{})
|
var unpauseRequests = make(chan struct{})
|
||||||
var done = make(chan struct{})
|
var done = make(chan struct{})
|
||||||
var mu sync.Mutex
|
var mu sync.Mutex
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ func main() {
|
||||||
select {
|
select {
|
||||||
case <-time.After(interval):
|
case <-time.After(interval):
|
||||||
runPause()
|
runPause()
|
||||||
case <-incomeCh:
|
case <-unpauseRequests:
|
||||||
fmt.Printf("Got request\n")
|
fmt.Printf("Got request\n")
|
||||||
if runtimePaused {
|
if runtimePaused {
|
||||||
runUnpause()
|
runUnpause()
|
||||||
|
@ -71,7 +71,7 @@ func main() {
|
||||||
|
|
||||||
// handler echoes the Path component of the requested URL.
|
// handler echoes the Path component of the requested URL.
|
||||||
func handler(w http.ResponseWriter, r *http.Request) {
|
func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
incomeCh <- struct{}{}
|
unpauseRequests <- struct{}{}
|
||||||
<-done
|
<-done
|
||||||
fmt.Fprintf(w, "allow")
|
fmt.Fprintf(w, "allow")
|
||||||
}
|
}
|
||||||
|
@ -83,8 +83,6 @@ func runPause() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ids := []string{}
|
|
||||||
|
|
||||||
r := command.NewExecRunner(true)
|
r := command.NewExecRunner(true)
|
||||||
|
|
||||||
cr, err := cruntime.New(cruntime.Config{Type: runtime, Runner: r})
|
cr, err := cruntime.New(cruntime.Config{Type: runtime, Runner: r})
|
||||||
|
@ -98,9 +96,8 @@ func runPause() {
|
||||||
}
|
}
|
||||||
|
|
||||||
runtimePaused = true
|
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() {
|
func runUnpause() {
|
||||||
|
@ -108,8 +105,6 @@ func runUnpause() {
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
defer mu.Unlock()
|
defer mu.Unlock()
|
||||||
|
|
||||||
ids := []string{}
|
|
||||||
|
|
||||||
r := command.NewExecRunner(true)
|
r := command.NewExecRunner(true)
|
||||||
|
|
||||||
cr, err := cruntime.New(cruntime.Config{Type: runtime, Runner: r})
|
cr, err := cruntime.New(cruntime.Config{Type: runtime, Runner: r})
|
||||||
|
@ -121,8 +116,7 @@ func runUnpause() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exit.Error(reason.GuestUnpause, "Unpause", err)
|
exit.Error(reason.GuestUnpause, "Unpause", err)
|
||||||
}
|
}
|
||||||
ids = append(ids, uids...)
|
|
||||||
runtimePaused = false
|
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)})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue