mirror of https://github.com/k3s-io/k3s
Adding events API to cadvisor interface.
parent
f39908ebf4
commit
de79209970
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package cadvisor
|
||||
|
||||
import (
|
||||
"github.com/google/cadvisor/events"
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorApiV2 "github.com/google/cadvisor/info/v2"
|
||||
)
|
||||
|
@ -46,3 +47,7 @@ func (c *Fake) VersionInfo() (*cadvisorApi.VersionInfo, error) {
|
|||
func (c *Fake) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
|
||||
return cadvisorApiV2.FsInfo{}, nil
|
||||
}
|
||||
|
||||
func (c *Fake) GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error) {
|
||||
return []*cadvisorApi.Event{}, nil
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/events"
|
||||
cadvisorFs "github.com/google/cadvisor/fs"
|
||||
cadvisorHttp "github.com/google/cadvisor/http"
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
|
@ -132,3 +133,7 @@ func (self *cadvisorClient) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
|
|||
|
||||
return res[0], nil
|
||||
}
|
||||
|
||||
func (self *cadvisorClient) GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error) {
|
||||
return self.GetPastEvents(request)
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package cadvisor
|
||||
|
||||
import (
|
||||
"github.com/google/cadvisor/events"
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorApiV2 "github.com/google/cadvisor/info/v2"
|
||||
"github.com/stretchr/testify/mock"
|
||||
|
@ -55,3 +56,8 @@ func (c *Mock) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
|
|||
args := c.Called()
|
||||
return args.Get(0).(cadvisorApiV2.FsInfo), args.Error(1)
|
||||
}
|
||||
|
||||
func (c *Mock) GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error) {
|
||||
args := c.Called()
|
||||
return args.Get(0).([]*cadvisorApi.Event), args.Error(1)
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package cadvisor
|
|||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/google/cadvisor/events"
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorApiV2 "github.com/google/cadvisor/info/v2"
|
||||
)
|
||||
|
@ -55,3 +56,7 @@ func (self *cadvisorUnsupported) VersionInfo() (*cadvisorApi.VersionInfo, error)
|
|||
func (self *cadvisorUnsupported) DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error) {
|
||||
return cadvisorApiV2.FsInfo{}, unsupportedErr
|
||||
}
|
||||
|
||||
func (self *cadvisorUnsupported) GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error) {
|
||||
return cadvisorApi.Event{}, unsupportedErr
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package cadvisor
|
||||
|
||||
import (
|
||||
"github.com/google/cadvisor/events"
|
||||
cadvisorApi "github.com/google/cadvisor/info/v1"
|
||||
cadvisorApiV2 "github.com/google/cadvisor/info/v2"
|
||||
)
|
||||
|
@ -31,4 +32,7 @@ type Interface interface {
|
|||
|
||||
// Returns usage information about the filesystem holding Docker images.
|
||||
DockerImagesFsInfo() (cadvisorApiV2.FsInfo, error)
|
||||
|
||||
// Get past events that have been detected and that fit the request.
|
||||
GetPastEvents(request *events.Request) ([]*cadvisorApi.Event, error)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue