Merge pull request #4459 from xiang90/kubulete

kubelet: minor cleaning up
This commit is contained in:
Nikhil Jindal 2015-02-17 10:18:47 -08:00
commit 81d0a88f1e
2 changed files with 9 additions and 9 deletions

View File

@ -72,18 +72,16 @@ func ResolvePort(portReference util.IntOrString, container *api.Container) (int,
func (h *httpActionHandler) Run(podFullName string, uid types.UID, container *api.Container, handler *api.Handler) error {
host := handler.HTTPGet.Host
if len(host) == 0 {
var status api.PodStatus
status, err := h.kubelet.GetPodStatus(podFullName, uid)
if err != nil {
glog.Errorf("unable to get pod info, event handlers may be invalid.")
glog.Errorf("Unable to get pod info, event handlers may be invalid.")
return err
}
netInfo, found := status.Info[dockertools.PodInfraContainerName]
if found {
host = netInfo.PodIP
} else {
if !found {
return fmt.Errorf("failed to find networking container: %v", status)
}
host = netInfo.PodIP
}
var port int
if handler.HTTPGet.Port.Kind == util.IntstrString && len(handler.HTTPGet.Port.StrVal) == 0 {

View File

@ -683,11 +683,13 @@ func (kl *Kubelet) runContainer(pod *api.BoundPod, container *api.Container, pod
containerLogPath := path.Join(p, dockerContainer.ID)
fs, err := os.Create(containerLogPath)
if err != nil {
// TODO: Clean up the previouly created dir? return the error?
glog.Errorf("Error on creating termination-log file %q: %v", containerLogPath, err)
} else {
defer fs.Close()
b := fmt.Sprintf("%s:%s", containerLogPath, container.TerminationMessagePath)
binds = append(binds, b)
}
defer fs.Close()
b := fmt.Sprintf("%s:%s", containerLogPath, container.TerminationMessagePath)
binds = append(binds, b)
}
}
privileged := false
@ -751,7 +753,7 @@ func (kl *Kubelet) getServiceEnvVarMap(ns string) (map[string]string, error) {
}
services, err := kl.serviceLister.List()
if err != nil {
return m, fmt.Errorf("Failed to list services when setting up env vars.")
return m, fmt.Errorf("failed to list services when setting up env vars.")
}
// project the services in namespace ns onto the master services