mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
Replace rkt --grace-period and --expire-prepared with gcPolicy.MinAge
This commit is contained in:
parent
43a654ed7b
commit
fb04edea3a
@ -346,7 +346,6 @@ func NewMainKubelet(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
klet.containerRuntime = rktRuntime
|
klet.containerRuntime = rktRuntime
|
||||||
klet.containerGC = rktRuntime
|
|
||||||
klet.imageManager = rkt.NewImageManager(rktRuntime)
|
klet.imageManager = rkt.NewImageManager(rktRuntime)
|
||||||
|
|
||||||
// No Docker daemon to put in a container.
|
// No Docker daemon to put in a container.
|
||||||
|
@ -68,14 +68,6 @@ const (
|
|||||||
authDir = "auth.d"
|
authDir = "auth.d"
|
||||||
dockerAuthTemplate = `{"rktKind":"dockerAuth","rktVersion":"v1","registries":[%q],"credentials":{"user":%q,"password":%q}}`
|
dockerAuthTemplate = `{"rktKind":"dockerAuth","rktVersion":"v1","registries":[%q],"credentials":{"user":%q,"password":%q}}`
|
||||||
|
|
||||||
// TODO(yifan): Merge with ContainerGCPolicy, i.e., derive
|
|
||||||
// the grace period from MinAge in ContainerGCPolicy.
|
|
||||||
//
|
|
||||||
// Duration to wait before discarding inactive pods from garbage
|
|
||||||
defaultGracePeriod = "1m"
|
|
||||||
// Duration to wait before expiring prepared pods.
|
|
||||||
defaultExpirePrepared = "1m"
|
|
||||||
|
|
||||||
defaultImageTag = "latest"
|
defaultImageTag = "latest"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1083,11 +1075,11 @@ func (r *Runtime) GetContainerLogs(pod *api.Pod, containerID kubecontainer.Conta
|
|||||||
// GarbageCollect collects the pods/containers.
|
// GarbageCollect collects the pods/containers.
|
||||||
// TODO(yifan): Enforce the gc policy, also, it would be better if we can
|
// TODO(yifan): Enforce the gc policy, also, it would be better if we can
|
||||||
// just GC kubernetes pods.
|
// just GC kubernetes pods.
|
||||||
func (r *runtime) GarbageCollect(gcPolicy kubecontainer.ContainerGCPolicy) error {
|
func (r *Runtime) GarbageCollect(gcPolicy kubecontainer.ContainerGCPolicy) error {
|
||||||
if err := exec.Command("systemctl", "reset-failed").Run(); err != nil {
|
if err := exec.Command("systemctl", "reset-failed").Run(); err != nil {
|
||||||
glog.Errorf("rkt: Failed to reset failed systemd services: %v", err)
|
glog.Errorf("rkt: Failed to reset failed systemd services: %v", err)
|
||||||
}
|
}
|
||||||
if _, err := r.runCommand("gc", "--grace-period="+defaultGracePeriod, "--expire-prepared="+defaultExpirePrepared); err != nil {
|
if _, err := r.runCommand("gc", "--grace-period="+gcPolicy.MinAge.String(), "--expire-prepared="+gcPolicy.MinAge.String()); err != nil {
|
||||||
glog.Errorf("rkt: Failed to gc: %v", err)
|
glog.Errorf("rkt: Failed to gc: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user