mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-15 06:43:54 +00:00
fix kubelet image gc
Signed-off-by: lixd <xueduan.li@gmail.com>
This commit is contained in:
parent
f9f00da6bc
commit
bad0593a68
@ -100,9 +100,6 @@ type realImageGCManager struct {
|
||||
// Reference to this node.
|
||||
nodeRef *v1.ObjectReference
|
||||
|
||||
// Track initialization
|
||||
initialized bool
|
||||
|
||||
// imageCache is the cache of latest image list.
|
||||
imageCache imageCache
|
||||
|
||||
@ -176,7 +173,6 @@ func NewImageGCManager(runtime container.Runtime, statsProvider StatsProvider, r
|
||||
statsProvider: statsProvider,
|
||||
recorder: recorder,
|
||||
nodeRef: nodeRef,
|
||||
initialized: false,
|
||||
tracer: tracer,
|
||||
}
|
||||
|
||||
@ -186,16 +182,9 @@ func NewImageGCManager(runtime container.Runtime, statsProvider StatsProvider, r
|
||||
func (im *realImageGCManager) Start() {
|
||||
ctx := context.Background()
|
||||
go wait.Until(func() {
|
||||
// Initial detection make detected time "unknown" in the past.
|
||||
var ts time.Time
|
||||
if im.initialized {
|
||||
ts = time.Now()
|
||||
}
|
||||
_, err := im.detectImages(ctx, ts)
|
||||
_, err := im.detectImages(ctx, time.Now())
|
||||
if err != nil {
|
||||
klog.InfoS("Failed to monitor images", "err", err)
|
||||
} else {
|
||||
im.initialized = true
|
||||
}
|
||||
}, 5*time.Minute, wait.NeverStop)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user