Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: Always use podman pull+cp #2751

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions pkg/daemon/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,6 @@ func podmanCopy(imgURL, osImageContentDir string) (err error) {
// Note that since we do this in the MCD container, cluster proxy configuration must also be injected
// into the container. See the MCD daemonset.
func ExtractOSImage(imgURL string) (osImageContentDir string, err error) {
var registryConfig []string
if _, err := os.Stat(kubeletAuthFile); err == nil {
registryConfig = append(registryConfig, "--registry-config", kubeletAuthFile)
}
if err = os.MkdirAll(osImageContentBaseDir, 0755); err != nil {
err = fmt.Errorf("error creating directory %s: %v", osImageContentBaseDir, err)
return
Expand All @@ -301,24 +297,13 @@ func ExtractOSImage(imgURL string) (osImageContentDir string, err error) {
return
}

if err = os.MkdirAll(osImageContentDir, 0755); err != nil {
err = fmt.Errorf("error creating directory %s: %v", osImageContentDir, err)
// In 4.8 we were running `oc image extract` but that doesn't work yet
// in disconnected, so right now in order to avoid two ways to do it
// with potentially different bugs, let's always use podman.
// xref https://bugzilla.redhat.com/show_bug.cgi?id=2000195
if err = podmanCopy(imgURL, osImageContentDir); err != nil {
return
}

// Extract the image
args := []string{"image", "extract", "--path", "/:" + osImageContentDir}
args = append(args, registryConfig...)
args = append(args, imgURL)
if _, err = pivotutils.RunExtBackground(cmdRetriesCount, "oc", args...); err != nil {
// Workaround fixes for the environment where oc image extract fails.
// See https://bugzilla.redhat.com/show_bug.cgi?id=1862979
glog.Infof("Falling back to using podman cp to fetch OS image content")
if err = podmanCopy(imgURL, osImageContentDir); err != nil {
return
}
}

return
}

Expand Down