Skip to content

Commit

Permalink
fix: omit replace with mirrors if registry not equal docker.io (#124)
Browse files Browse the repository at this point in the history
* fix: omit replace with mirrors if registry not equal docker.io

* fix: remove connection check for custom mirror
  • Loading branch information
hysyeah authored Jan 7, 2025
1 parent 913c2bb commit 116b76b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/images/puller.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (is *imageService) PullImage(ctx context.Context, ref appv1alpha1.Ref, opts
}
ref.Name = originNamed.String()
// replaced image ref
replacedRef, plainHTTP := utils.ReplacedImageRef(mirrorsEndpoint, originNamed.String(), true)
replacedRef, plainHTTP := utils.ReplacedImageRef(mirrorsEndpoint, originNamed.String(), false)
config := newFetchConfig(plainHTTP)

ongoing := newJobs(replacedRef, originNamed.String())
Expand Down
4 changes: 3 additions & 1 deletion pkg/utils/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ func ReplacedImageRef(mirrorsEndpoint []string, oldImageRef string, checkConnect

parts := strings.Split(oldImageRef, "/")
klog.Infof("parts: %s", parts)
parts[0] = url.Host
if parts[0] == "docker.io" {
parts[0] = url.Host
}
klog.Infof("parts2: %s", parts)
return strings.Join(parts, "/"), plainHTTP
}
Expand Down

0 comments on commit 116b76b

Please sign in to comment.