Add image garbage collection policy to imageManager.
This commit is contained in:
@@ -18,7 +18,7 @@ package cadvisor
|
||||
|
||||
import (
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorApi2 "github.com/google/cadvisor/info/v2"
|
||||
cadvisorApiV2 "github.com/google/cadvisor/info/v2"
|
||||
)
|
||||
|
||||
// Fake cAdvisor implementation.
|
||||
@@ -39,6 +39,6 @@ func (c *Fake) MachineInfo() (*cadvisorApi.MachineInfo, error) {
|
||||
return new(cadvisorApi.MachineInfo), nil
|
||||
}
|
||||
|
||||
func (c *Fake) DockerImagesFsInfo() (cadvisorApi2.FsInfo, error) {
|
||||
return cadvisorApi2.FsInfo{}, nil
|
||||
func (c *Fake) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
|
||||
return cadvisorApiV2.FsInfo{}, nil
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ import (
|
||||
cadvisorFs "github.com/google/cadvisor/fs"
|
||||
cadvisorHttp "github.com/google/cadvisor/http"
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorApi2 "github.com/google/cadvisor/info/v2"
|
||||
cadvisorApiV2 "github.com/google/cadvisor/info/v2"
|
||||
"github.com/google/cadvisor/manager"
|
||||
"github.com/google/cadvisor/storage/memory"
|
||||
"github.com/google/cadvisor/utils/sysfs"
|
||||
@@ -113,13 +113,13 @@ func (self *cadvisorClient) MachineInfo() (*cadvisorApi.MachineInfo, error) {
|
||||
return self.GetMachineInfo()
|
||||
}
|
||||
|
||||
func (self *cadvisorClient) DockerImagesFsInfo() (cadvisorApi2.FsInfo, error) {
|
||||
func (self *cadvisorClient) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
|
||||
res, err := self.GetFsInfo(cadvisorFs.LabelDockerImages)
|
||||
if err != nil {
|
||||
return cadvisorApi2.FsInfo{}, err
|
||||
return cadvisorApiV2.FsInfo{}, err
|
||||
}
|
||||
if len(res) == 0 {
|
||||
return cadvisorApi2.FsInfo{}, fmt.Errorf("failed to find information for the filesystem containing Docker images")
|
||||
return cadvisorApiV2.FsInfo{}, fmt.Errorf("failed to find information for the filesystem containing Docker images")
|
||||
}
|
||||
// TODO(vmarmol): Handle this better when Docker has more than one image filesystem.
|
||||
if len(res) > 1 {
|
||||
|
@@ -18,7 +18,7 @@ package cadvisor
|
||||
|
||||
import (
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorApi2 "github.com/google/cadvisor/info/v2"
|
||||
cadvisorApiV2 "github.com/google/cadvisor/info/v2"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
@@ -46,7 +46,7 @@ func (c *Mock) MachineInfo() (*cadvisorApi.MachineInfo, error) {
|
||||
return args.Get(0).(*cadvisorApi.MachineInfo), args.Error(1)
|
||||
}
|
||||
|
||||
func (c *Mock) DockerImagesFsInfo() (cadvisorApi2.FsInfo, error) {
|
||||
func (c *Mock) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
|
||||
args := c.Called()
|
||||
return args.Get(0).(cadvisorApi2.FsInfo), args.Error(1)
|
||||
return args.Get(0).(cadvisorApiV2.FsInfo), args.Error(1)
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ import (
|
||||
"errors"
|
||||
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorApi2 "github.com/google/cadvisor/info/v2"
|
||||
cadvisorApiV2 "github.com/google/cadvisor/info/v2"
|
||||
)
|
||||
|
||||
type cadvisorUnsupported struct {
|
||||
@@ -48,6 +48,6 @@ func (self *cadvisorUnsupported) MachineInfo() (*cadvisorApi.MachineInfo, error)
|
||||
return nil, unsupportedErr
|
||||
}
|
||||
|
||||
func (self *cadvisorUnsupported) DockerImagesFsInfo() (cadvisorApi2.FsInfo, error) {
|
||||
return cadvisorApi2.FsInfo{}, unsupportedErr
|
||||
func (self *cadvisorUnsupported) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
|
||||
return cadvisorApiV2.FsInfo{}, unsupportedErr
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ package cadvisor
|
||||
|
||||
import (
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorApi2 "github.com/google/cadvisor/info/v2"
|
||||
cadvisorApiV2 "github.com/google/cadvisor/info/v2"
|
||||
)
|
||||
|
||||
// Interface is an abstract interface for testability. It abstracts the interface to cAdvisor.
|
||||
@@ -28,5 +28,5 @@ type Interface interface {
|
||||
MachineInfo() (*cadvisorApi.MachineInfo, error)
|
||||
|
||||
// Returns usage information about the filesystem holding Docker images.
|
||||
DockerImagesFsInfo() (cadvisorApi2.FsInfo, error)
|
||||
DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error)
|
||||
}
|
||||
|
Reference in New Issue
Block a user