Skip to content

Commit

Permalink
Template auto-pause.service to allow injecting the correct container …
Browse files Browse the repository at this point in the history
…runtime.
  • Loading branch information
andriyDev committed Jul 1, 2021
1 parent 574cdb9 commit cec98ef
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion deploy/addons/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import "embed"
var (
// AutoPauseAssets assets for auto-pause addon
//go:embed auto-pause/*.tmpl
//go:embed auto-pause/auto-pause.service
//go:embed auto-pause/unpause.lua
AutoPauseAssets embed.FS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=Auto Pause Service

[Service]
Type=simple
ExecStart=/bin/auto-pause
ExecStart=/bin/auto-pause --container-runtime={{.ContainerRuntime}}
Restart=always

[Install]
Expand Down
5 changes: 0 additions & 5 deletions pkg/addons/addons_autopause.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ import (
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/driver"
"k8s.io/minikube/pkg/minikube/exit"
"k8s.io/minikube/pkg/minikube/kubeconfig"
"k8s.io/minikube/pkg/minikube/mustload"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/minikube/sysinit"
)

Expand All @@ -42,9 +40,6 @@ func enableOrDisableAutoPause(cc *config.ClusterConfig, name string, val string)
out.Infof("auto-pause addon is an alpha feature and still in early development. Please file issues to help us make it better.")
out.Infof("https://github.com/kubernetes/minikube/labels/co/auto-pause")

if cc.KubernetesConfig.ContainerRuntime != "docker" {
exit.Message(reason.Usage, `auto-pause currently is only supported on docker runtime. Track progress of others here: https://github.com/kubernetes/minikube/issues/10601`)
}
co := mustload.Running(cc.Name)
if enable {
if err := sysinit.New(co.CP.Runner).EnableNow("auto-pause"); err != nil {
Expand Down
4 changes: 3 additions & 1 deletion pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ var Addons = map[string]*Addon{
"0640"),
MustBinAsset(
addons.AutoPauseAssets,
"auto-pause/auto-pause.service",
"auto-pause/auto-pause.service.tmpl",
"/etc/systemd/system/",
"auto-pause.service",
"0640"),
Expand Down Expand Up @@ -788,6 +788,7 @@ func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig, netInfo Net
LoadBalancerStartIP string
LoadBalancerEndIP string
CustomIngressCert string
ContainerRuntime string
Images map[string]string
Registries map[string]string
CustomRegistries map[string]string
Expand All @@ -799,6 +800,7 @@ func GenerateTemplateData(addon *Addon, cfg config.KubernetesConfig, netInfo Net
LoadBalancerStartIP: cfg.LoadBalancerStartIP,
LoadBalancerEndIP: cfg.LoadBalancerEndIP,
CustomIngressCert: cfg.CustomIngressCert,
ContainerRuntime: cfg.ContainerRuntime,
Images: images,
Registries: addon.Registries,
CustomRegistries: customRegistries,
Expand Down

0 comments on commit cec98ef

Please sign in to comment.