func isDefaultRegistryMatch(image string) bool {
	parts := strings.SplitN(image, "/", 2)
	if len(parts[0]) == 0 {
		return false
	}
	if len(parts) == 1 {
		return true
	}
	if parts[0] == "docker.io" || parts[0] == "index.docker.io" {
		return true
	}
	return !strings.ContainsAny(parts[0], ".:")
}
isDefaultRegistryMatch determines whether the given image will
pull from the default registry (DockerHub) based on the
characteristics of its name.
package credentialprovider
import (
	"encoding/json"
	"net"
	"net/url"
	"path/filepath"
	"sort"
	"strings"
	docker "github.com/fsouza/go-dockerclient"
	"github.com/golang/glog"
	"k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/util/sets"
)
type DockerKeyring interface {
	Lookup(image string) ([]docker.AuthConfiguration, bool)
}
type BasicDockerKeyring struct {
	index []string
	creds map[string][]docker.AuthConfiguration
}
type lazyDockerKeyring struct {
	Providers []DockerConfigProvider
}
func (dk *BasicDockerKeyring) Add(cfg DockerConfig) {
	if dk.index == nil {
		dk.index = make([]string, 0)
		dk.creds = make(map[string][]docker.AuthConfiguration)
	}
	for loc, ident := range cfg {
		creds := docker.AuthConfiguration{
			Username: ident.Username,
			Password: ident.Password,
			Email:    ident.Email,
		}
		value := loc
		if !strings.HasPrefix(value, "https://") && !strings.HasPrefix(value, "http://") {
			value = "https://" + value
		}
		parsed, err := url.Parse(value)
		if err != nil {
			glog.Errorf("Entry %q in dockercfg invalid (%v), ignoring", loc, err)
			continue
		}
		effectivePath := parsed.Path
		if strings.HasPrefix(effectivePath, "/v2/") || strings.HasPrefix(effectivePath, "/v1/") {
			effectivePath = effectivePath[3:]
		}
		var key string
		if (len(effectivePath) > 0) && (effectivePath != "/") {
			key = parsed.Host + effectivePath
		} else {
			key = parsed.Host
		}
		dk.creds[key] = append(dk.creds[key], creds)
		dk.index = append(dk.index, key)
	}
	eliminateDupes := sets.NewString(dk.index...)
	dk.index = eliminateDupes.List()
	sort.Sort(sort.Reverse(sort.StringSlice(dk.index)))
}
const (
	defaultRegistryHost = "index.docker.io"
	defaultRegistryKey  = defaultRegistryHost + "/v1/"
)