Merge pull request #7403 from vmarmol/rkt-deps

Remove DockerPrefix references in Kubelet.
This commit is contained in:
Dawn Chen 2015-04-27 19:05:43 -07:00
commit 4b79e5a3db
2 changed files with 15 additions and 3 deletions

View File

@ -17,6 +17,8 @@ limitations under the License.
package container package container
import ( import (
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/probe" "github.com/GoogleCloudPlatform/kubernetes/pkg/probe"
) )
@ -37,3 +39,14 @@ type Prober interface {
type RunContainerOptionsGenerator interface { type RunContainerOptionsGenerator interface {
GenerateRunContainerOptions(pod *api.Pod, container *api.Container, netMode, ipcMode string) (*RunContainerOptions, error) GenerateRunContainerOptions(pod *api.Pod, container *api.Container, netMode, ipcMode string) (*RunContainerOptions, error)
} }
// Trims runtime prefix from image name (e.g.: docker://busybox -> busybox).
func TrimRuntimePrefixFromImage(img string) string {
const prefixSeparator = "://"
idx := strings.Index(img, prefixSeparator)
if idx < 0 {
return img
}
return img[idx+len(prefixSeparator):]
}

View File

@ -934,8 +934,7 @@ func shouldContainerBeRestarted(container *api.Container, pod *api.Pod, podStatu
// Set dead containers to unready state. // Set dead containers to unready state.
for _, c := range resultStatus { for _, c := range resultStatus {
// TODO(yifan): Unify the format of container ID. (i.e. including docker:// as prefix). readinessManager.RemoveReadiness(kubecontainer.TrimRuntimePrefixFromImage(c.ContainerID))
readinessManager.RemoveReadiness(strings.TrimPrefix(c.ContainerID, dockertools.DockerPrefix))
} }
// Check RestartPolicy for dead container. // Check RestartPolicy for dead container.
@ -1653,7 +1652,7 @@ func (kl *Kubelet) validateContainerStatus(podStatus *api.PodStatus, containerNa
if cStatus.State.Waiting != nil { if cStatus.State.Waiting != nil {
return "", fmt.Errorf("container %q is in waiting state.", containerName) return "", fmt.Errorf("container %q is in waiting state.", containerName)
} }
return strings.Replace(cStatus.ContainerID, dockertools.DockerPrefix, "", 1), nil return kubecontainer.TrimRuntimePrefixFromImage(cStatus.ContainerID), nil
} }
// GetKubeletContainerLogs returns logs from the container // GetKubeletContainerLogs returns logs from the container