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

containerd: properly pull images with containerd specific tools #8245

Merged

Conversation

cristicalin
Copy link
Contributor

@cristicalin cristicalin commented Nov 29, 2021

What type of PR is this?

/kind bug

What this PR does / why we need it:
This PR ensures we are pulling, exporting and importing the images for the target platform where we are dealing with multi-platform images such as nginx upstream image. This PR fixes issues observed in CI like: https://gitlab.com/kargo-ci/kubernetes-sigs-kubespray/-/jobs/1826926575#L3504
Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:
This might require rebasing some active PRs after the merge to fix broken CI runs.

Does this PR introduce a user-facing change?:

[containerd] Ensure pulling, exporting and importing images for the target platform when dealing with multi-platform images to avoid partial import issues

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 29, 2021
@floryut floryut added kind/container-managers Containers section in the release note and removed kind/bug Categorizes issue or PR as related to a bug. labels Nov 29, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cristicalin, floryut

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 29, 2021
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 29, 2021
@cristicalin cristicalin changed the title containerd: ensure we manipulate images for the proper platform containerd: properly pull images with containerd specific tools Nov 29, 2021
Copy link
Contributor

@oomichi oomichi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this.

/lgtm

@@ -29,7 +29,7 @@

- name: Set image save/load command for containerd
set_fact:
image_save_command: "{{ containerd_bin_dir }}/ctr -n k8s.io image export {{ image_path_final }} {{ image_reponame }}"
image_save_command: "{{ containerd_bin_dir }}/ctr -n k8s.io image export --platform linux/{{ image_arch }} {{ image_path_final }} {{ image_reponame }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering we would need to support Windows and this additional option could block it.
But Kubespray README.md clearly says Linux distributions are supported.
So it is fine to pass this option.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At that point we would need to switch to --all-platforms instead if we wanted to support multi-platform or move to something like an iterative approach to downloading images where we iterate through all supported platforms and arch'es.

For now kubespray is Linux only so it should get the job done. I'm more concerned about the situation where we would want to support heterogeneous clusters with x86 and arm nodes. But our code needs further refinement for that as well.

- name: prep_download | Set image pull/info command for containerd on localhost
set_fact:
image_info_command_on_localhost: "{{ bin_dir }}/ctr -n k8s.io images ls | awk '/application/ {print $1}' | grep -v ^sha | tr '\n' ','"
image_pull_command_on_localhost: "{{ bin_dir }}/ctr -n k8s.io images pull --platform linux/{{ image_arch }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image_info_command_on_localhost and image_pull_command_on_localhost are the same as image_info_command and image_pull_command.
We could define

image_info_command_on_localhost: "{{ image_info_command }}"
image_pull_command_on_localhost" "{{ image_pull_command }}"

but Kubespray already contained such duplicated definitions for crio.
It is fine to go with current change at this time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The download_on_localhost seems to be broken currently for anything but docker so this would need further attention in a subsequent PR(s).

@oomichi
Copy link
Contributor

oomichi commented Nov 29, 2021

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 29, 2021
@floryut
Copy link
Member

floryut commented Nov 30, 2021

/retest

@k8s-ci-robot k8s-ci-robot merged commit 3431ed9 into kubernetes-sigs:master Nov 30, 2021
@floryut floryut mentioned this pull request Dec 21, 2021
LuckySB pushed a commit to southbridgeio/kubespray that referenced this pull request Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/container-managers Containers section in the release note lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants