Make HttpGetter a shared Kubelet type.

This commit is contained in:
Victor Marmol 2015-04-29 17:50:59 -07:00
parent dd976a27fb
commit 4db5127073
3 changed files with 10 additions and 7 deletions

View File

@ -25,18 +25,19 @@ import (
kubecontainer "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container" kubecontainer "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/container"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/prober" "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/prober"
kubeletTypes "github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/types"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" "github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/golang/glog" "github.com/golang/glog"
) )
type handlerRunner struct { type handlerRunner struct {
httpGetter httpGetter httpGetter kubeletTypes.HttpGetter
commandRunner prober.ContainerCommandRunner commandRunner prober.ContainerCommandRunner
containerManager *dockertools.DockerManager containerManager *dockertools.DockerManager
} }
// TODO(yifan): Merge commandRunner and containerManager once containerManager implements the ContainerCommandRunner interface. // TODO(yifan): Merge commandRunner and containerManager once containerManager implements the ContainerCommandRunner interface.
func newHandlerRunner(httpGetter httpGetter, commandRunner prober.ContainerCommandRunner, containerManager *dockertools.DockerManager) kubecontainer.HandlerRunner { func newHandlerRunner(httpGetter kubeletTypes.HttpGetter, commandRunner prober.ContainerCommandRunner, containerManager *dockertools.DockerManager) kubecontainer.HandlerRunner {
return &handlerRunner{ return &handlerRunner{
httpGetter: httpGetter, httpGetter: httpGetter,
commandRunner: commandRunner, commandRunner: commandRunner,

View File

@ -291,10 +291,6 @@ func NewMainKubelet(
return klet, nil return klet, nil
} }
type httpGetter interface {
Get(url string) (*http.Response, error)
}
type serviceLister interface { type serviceLister interface {
List() (api.ServiceList, error) List() (api.ServiceList, error)
} }
@ -326,7 +322,7 @@ type Kubelet struct {
// Optional, defaults to simple Docker implementation // Optional, defaults to simple Docker implementation
runner prober.ContainerCommandRunner runner prober.ContainerCommandRunner
// Optional, client for http requests, defaults to empty client // Optional, client for http requests, defaults to empty client
httpClient httpGetter httpClient kubeletTypes.HttpGetter
// cAdvisor used for container information. // cAdvisor used for container information.
cadvisor cadvisor.Interface cadvisor cadvisor.Interface

View File

@ -16,5 +16,11 @@ limitations under the License.
package types package types
import "net/http"
// DockerID is an ID of docker container. It is a type to make it clear when we're working with docker container Ids // DockerID is an ID of docker container. It is a type to make it clear when we're working with docker container Ids
type DockerID string type DockerID string
type HttpGetter interface {
Get(url string) (*http.Response, error)
}