1
0
mirror of https://github.com/rancher/rke.git synced 2025-07-30 22:44:50 +00:00

Merge pull request #336 from galal-hussein/fix_airgap

Add registry auth for private registries as well
This commit is contained in:
Alena Prokharchyk 2018-02-08 15:08:31 -08:00 committed by GitHub
commit 6ea9ff01ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -169,17 +169,19 @@ func pullImage(ctx context.Context, dClient *client.Client, hostname string, con
regURL := ref.Domain(containerNamed)
if pr, ok := prsMap[regURL]; ok {
// We do this if we have some docker.io login information
regAuth, err := getRegistryAuth(pr)
if err != nil {
return err
}
if pr.URL == DockerRegistryURL {
regAuth, err := getRegistryAuth(pr)
if err != nil {
return err
}
pullOptions.RegistryAuth = regAuth
} else {
// We have a registry, but it's not docker.io
// this could be public or private, ImagePull() can handle it
// if we provide a PrivilegeFunc
pullOptions.PrivilegeFunc = tryRegistryAuth(pr)
pullOptions.RegistryAuth = regAuth
}
}