Remove more docker references in kubelet

This change also renames TrimRuntimePrefixFromImage to TrimRuntimePrefix to
better reflect that the usage is not limited to images (e.g. ID).
This commit is contained in:
Yu-Ju Hong
2015-04-30 12:15:23 -07:00
parent 11be6811b3
commit 2f7b951140
4 changed files with 25 additions and 40 deletions

View File

@@ -34,13 +34,13 @@ type RunContainerOptionsGenerator interface {
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 {
// Trims runtime prefix from ID or image name (e.g.: docker://busybox -> busybox).
func TrimRuntimePrefix(fullString string) string {
const prefixSeparator = "://"
idx := strings.Index(img, prefixSeparator)
idx := strings.Index(fullString, prefixSeparator)
if idx < 0 {
return img
return fullString
}
return img[idx+len(prefixSeparator):]
return fullString[idx+len(prefixSeparator):]
}