Move util.UID to pkg/types

This commit is contained in:
Tim Hockin
2015-01-14 15:22:21 -08:00
parent 2bee4ac572
commit 1be3de895c
26 changed files with 161 additions and 112 deletions

View File

@@ -34,7 +34,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/healthz"
"github.com/GoogleCloudPlatform/kubernetes/pkg/httplog"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
"github.com/golang/glog"
"github.com/google/cadvisor/info"
)
@@ -62,13 +62,13 @@ func ListenAndServeKubeletServer(host HostInterface, address net.IP, port uint,
// HostInterface contains all the kubelet methods required by the server.
// For testablitiy.
type HostInterface interface {
GetContainerInfo(podFullName string, uid util.UID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetContainerInfo(podFullName string, uid types.UID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetRootInfo(req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetMachineInfo() (*info.MachineInfo, error)
GetBoundPods() ([]api.BoundPod, error)
GetPodByName(namespace, name string) (*api.BoundPod, bool)
GetPodInfo(name string, uid util.UID) (api.PodInfo, error)
RunInContainer(name string, uid util.UID, container string, cmd []string) ([]byte, error)
GetPodInfo(name string, uid types.UID) (api.PodInfo, error)
RunInContainer(name string, uid types.UID, container string, cmd []string) ([]byte, error)
GetKubeletContainerLogs(podFullName, containerName, tail string, follow bool, stdout, stderr io.Writer) error
ServeLogs(w http.ResponseWriter, req *http.Request)
}
@@ -204,7 +204,7 @@ func (s *Server) handlePodInfo(w http.ResponseWriter, req *http.Request, version
return
}
podID := u.Query().Get("podID")
podUID := util.UID(u.Query().Get("UUID"))
podUID := types.UID(u.Query().Get("UUID"))
podNamespace := u.Query().Get("podNamespace")
if len(podID) == 0 {
w.WriteHeader(http.StatusBadRequest)
@@ -272,7 +272,7 @@ func (s *Server) handleRun(w http.ResponseWriter, req *http.Request) {
}
parts := strings.Split(u.Path, "/")
var podNamespace, podID, container string
var uid util.UID
var uid types.UID
if len(parts) == 5 {
podNamespace = parts[2]
podID = parts[3]
@@ -280,7 +280,7 @@ func (s *Server) handleRun(w http.ResponseWriter, req *http.Request) {
} else if len(parts) == 6 {
podNamespace = parts[2]
podID = parts[3]
uid = util.UID(parts[4])
uid = types.UID(parts[4])
container = parts[5]
} else {
http.Error(w, "Unexpected path for command running", http.StatusBadRequest)
@@ -348,7 +348,7 @@ func (s *Server) serveStats(w http.ResponseWriter, req *http.Request) {
http.Error(w, "Pod does not exist", http.StatusNotFound)
return
}
stats, err = s.host.GetContainerInfo(GetPodFullName(pod), util.UID(components[3]), components[4], &query)
stats, err = s.host.GetContainerInfo(GetPodFullName(pod), types.UID(components[3]), components[4], &query)
default:
http.Error(w, "unknown resource.", http.StatusNotFound)
return