-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Fix pull-multi-arch images for Arm #1575
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1575 +/- ##
=========================================
- Coverage 50.65% 48.9% -1.76%
=========================================
Files 83 27 -56
Lines 7290 4071 -3219
=========================================
- Hits 3693 1991 -1702
+ Misses 2901 1662 -1239
+ Partials 696 418 -278
Continue to review full report at Codecov.
|
platforms/arm.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Does this need to be exported function?
- This should return err (or just "unknown") rather than call log.Fatal()
- ParseCpuInfo → getCPUVariant?
- Please add tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely not a package export.
This should also be in a separate file, probably cpuinfo.go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Akihiro,
Does this need to be exported function?
No, I think it's enough to used this function inside this package.
This should return err (or just "unknown") rather than call log.Fatal()
Your comment is reasonable, I will refine this function to return proper "variant, err"
ParseCpuInfo → getCPUVariant?
I think it's better to rename ParseCpuInfo to getCPUInfo. Because this function
is not only used to parse Variant. We may parse other information like "features"
in the future. But I will add a new function getCPUVariant to wrap getCPUInfo.
Please add tests
Sorry, I am new to here. Did you mean something like platform_test.go?
Hi Stevvooe,
This is definitely not a package export.
This should also be in a separate file, probably cpuinfo.go.
Did you mean rename the arm.go to cpuinfo.go? Because this function has been in
a separate file already.
Thanks for your comments. I am new to golang :)
Add @Pennyzct who is working with me on arm-multi-arch image support.
platforms/arm.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this cannot be a separate type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will use an armCpuVariant string instead of this separate type.
platforms/arm.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions like this belong in database.go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will move it to database.go
platforms/arm.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this format standardized? Looking at a random box, this doesn't seem to be correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your reminder. It seems x86 and ARM has different space characters.
I will trim all leading and tailing space characters of the string.
|
Hi Stevvooe, Akihiro, Because I have public holidays in the following week. So I send the v2 updates as my understanding of your comments. If I have done something wrong please let me know. I can reply the email, but the code update would be deferred. Regards, |
platforms/database.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this function needs to be changed.
platforms/database.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't remove arm entries here.
|
@Weichen81 Is scanning |
|
在 2017年10月3日,05:30,Stephen Day <[email protected]<mailto:[email protected]>> 写道:
@stevvooe commented on this pull request.
________________________________
In platforms/database.go<#1575 (comment)>:
@@ -15,7 +25,18 @@ import (
// The OS value should be normalized before calling this function.
func isKnownOS(os string) bool {
switch os {
- case "android", "darwin", "dragonfly", "freebsd", "linux", "nacl", "netbsd", "openbsd", "plan9", "solaris", "windows", "zos":
+ case "android", "darwin", "dragonfly", "freebsd", "nacl", "netbsd", "openbsd", "plan9", "solaris", "windows", "zos":
+ return true
+ }
+ return isLinuxOS(os)
I don't think this function needs to be changed.
Ok, I would revert this change in next update.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#1575 (review)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AYDF6x5GYny5Mx62kXJMz4vJRwoNMG2Fks5soVXzgaJpZM4PobNB>.
|
|
在 2017年10月3日,05:30,Stephen Day <[email protected]<mailto:[email protected]>> 写道:
@stevvooe commented on this pull request.
________________________________
In platforms/database.go<#1575 (comment)>:
@@ -26,10 +47,10 @@ func isKnownOS(os string) bool {
// The arch value should be normalized before being passed to this function.
func isKnownArch(arch string) bool {
switch arch {
- case "386", "amd64", "amd64p32", "arm", "armbe", "arm64", "arm64be", "ppc64", "ppc64le", "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le", "ppc", "s390", "s390x", "sparc", "sparc64":
+ case "386", "amd64", "amd64p32", "ppc64", "ppc64le", "mips", "mipsle", "mips64", "mips64le", "mips64p32", "mips64p32le", "ppc", "s390", "s390x", "sparc", "sparc64":
Don't remove arm entries here.
But, If we keep multiple points for arm arch check, if we have something update, we should modify these two points.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#1575 (review)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AYDF60MvzCUQVtGTIrOo6wwjlMoYwshmks5soVYMgaJpZM4PobNB>.
|
|
在 2017年10月3日,05:46,Stephen Day <[email protected]<mailto:[email protected]>> 写道:
@Weichen81<https://github.com/weichen81> Is scanning /proc/cpuinfo the best way to detect architecture for ARM? Do you have a link to the format used so we can ensure that it works across kernel versions?
Thanks for your reminder. I hadn’t considered enough, the Linux document only defines the cpuinfo is one of the kernel data, but hasn’t restricted the data format. Some old kernel would export “CPU architecture ” as aarch64 not v8.
How do you think about using some tool like lscpu? We can use this tool to standardize the output for different kernel versions and different distributions.
Regards,
Wei Chen
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#1575 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AYDF6yMp8hUb04x1g0OvJf6dRnjF-p30ks5soVmmgaJpZM4PobNB>.
|
|
My personal opinion is that reading I think we should go forward with this, which adds no additional dependencies on host OS tooling (e.g. EDIT: Forgot to clearly state that since we are only running this parser when |
platforms/cpuinfo.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only concern here is we are parsing /proc/cpuinfo on any Linux OS as the code is right now. I would rather this be a "lazy" instantiation so it never runs unless needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this function call is useless for other architectures/OS. I would address this comment in next update.
Phil, thanks. I prefer to keep reading from /proc/cpuinfo to avoid adding additional dependency.
Yes, currently we don't need to consider the differences of arm, x86, ppc and other CPU family's |
|
@Weichen81 Could address my review items? |
|
@stevvooe Ah, of course! That's undisputed, I will address your comments too :)
|
|
@stevvooe After digging into the code, I think you're right. I should not remove the arm entries from Regards, |
|
|
@Pennyzct Correct me if I'm wrong, but, in this case, doing an "init" time initialization will have the same effect as |
|
@stevvooe you're right, it's simple and neat to include the initialization of |
|
@stevvooe @estesp @AkihiroSuda
We had tested these patches internally and they worked well. I had checked my code and continuous-integration/travis-ci/pr log. I could not understand why they trigger this building error. Regards, |
|
@Weichen81 you can ignore that error for now; there are some GC issues with snapshot removal and the parallel tests (cc: @dmcgowan) |
|
@estesp Thanks! |
|
If you rebase on master it should resolve the test issues now. Thanks! |
|
@crosbymichael I have rebased these changes, and they have passed the tests. Thank you! |
|
@Weichen81 thanks |
|
Hi, |
estesp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
ping @stevvooe ; with the removal of the compat matching and all other comments have been resolved, I'm comfortable with this now. I personally think we should get this in and then start to resolve how matching happens on variant or multi-value supporting architectures. |
platforms/cpuinfo.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bottom of a file is not a good place for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be ordered like this:
var
init
func
|
After a fix to the code here, I am okay with merging this. There is still work to be done in this area, so we may make changes, but this is limited for now. |
On ARM platforms, we have to prepare the variant for spec.platform. Currently, this action would only work on Linux/ARM system. We introduce these two helpers to check running system's OS and Arch. Change-Id: Iff14087699219413779dd6caf1bf9524db1cc19e Signed-off-by: Wei Chen <[email protected]>
In the commit "26329b2b8d7fd4e290b2b0f0163547f2d79bb817", dmcgowan/fix-pull-multi-arch, PR#1535. The containerd has enabled the pull multi-arch image support. But the platform.variant field of OCI for ARM hadn't been ready at that time, so all ARM images could not pull successfully. " docker.io/library/hello-world:latest: resolved |++++++++++++++++++++++++++++++++++++++| index-sha256:3644c0788e3d3823f9e97f757f01d2ddc6eb5458df9d801: done |++++++++++++++++++++++++++++++++++++++| elapsed: 5.1 s total: 2.7 Ki (533.0 B/s) unpacking sha256:3d3823f9e97f757f01d2ddc6eb5458df9d801... ctr: : manifest not found: not found " In this patch we'll detect the ARM variants from /proc/cpuinfo. Because Linux kernel has already detected the ABI, ISA and Features for us. We don't need to parse them from registers again. Change-Id: I479b34bf3f52df9f7a6b3c77718b7d316dbf7f69 Signed-off-by: Wei Chen <[email protected]> Signed-off-by: Penny Zheng <[email protected]>
The variant is required for platform match while pulling images for ARM platforms. Currently, the cpuVariant only would be assigned on linux/arm|arm64 platforms. Other platforms this variable would be empty. So we can use this cpuVariant to initialize the Variant field. Change-Id: Ic065be9b502f1e662445daa61a0973bf56385b37 Signed-off-by: Wei Chen <[email protected]> Signed-off-by: Penny Zheng <[email protected]>
This test case should cover the variant field now, as we have add Variant to default value of spec.platform. Change-Id: I8359007d40a4b8f6a072510fff2ba604a062afa1 Signed-off-by: Wei Chen <[email protected]> Signed-off-by: Penny Zheng <[email protected]>
Change-Id: Id9558de2e41b08c41cf7d4b458774e99e24515a0 Signed-off-by: Wei Chen <[email protected]> Signed-off-by: Penny Zheng <[email protected]>
|
@stevvooe Thanks, I have updated this PR to address your comment. |
estesp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM
Merge Weichen81/arm-multi-arch fix to fix pulling multi-arch arm images. containerd#1575
… Arm" We want to start follow stable releases of containerd, but there's one fix containerd/containerd#1575 which prevents pulling images on ARM. Switched to use custom containerd version which is v1.0.2 with Weichen81:arm-multi-arch fix.
… Arm" We want to start follow stable releases of containerd, but there's one fix containerd/containerd#1575 which prevents pulling images on ARM. Switched to use custom containerd version which is v1.0.2 with Weichen81:arm-multi-arch fix.
|
Hi, I stil get this issue on ARM, I just compiled master this morning on raspberry pi3 arm7 |
|
Hi~ @ArchiFleKs Could you give us the detailed error info and the image info ? 😊 |
|
@Pennyzct I think my issue might be related to this one : kubernetes/kubernetes#63057 My log is : |
|
I think I am having the same issue on a Rock64 board. Tried upgrading to 1.1.2 from 1.1.0 - same issue although this is my first try at learning Kubernetes the very hard way. at the end of the output: Same for the multi-arch image |
|
I have the same with v1.2.6 installed from ubuntu repository. Actually, on an amd64 it can be reproduced, that arm/v7 image pull fails: |
|
@rkojedzinszky this is fixed in our latest release, 1.2.7, so there isn't much we can do about it--hopefully Ubuntu will update to 1.2.7 soonish. |
|
Thanks @estesp . Then either I do something wrong, or some bug is still present. Even if ctr can download the image, containerd daemon cannot, emits the same error message. I do this on arm. |
Hi,
I am Wei Chen from ARM. Currently, I am working on arm-multi-arch support for containerd.
After #1535 had been merged, the containerd
has enabled the pull multi-arch image support. But the platform.variant field of OCI for ARM
hadn't been ready at that time, so all ARM images could not pull successfully.
"docker.io/library/hello-world:latest:
resolved |++++++++++++++++++++++++++++++++++++++|
index-sha256:3644c0788e3d3823f9e97f757f01d2ddc6eb5458df9d801:
done |++++++++++++++++++++++++++++++++++++++|
elapsed: 5.1 s
total: 2.7 Ki (533.0 B/s)
unpacking sha256:3d3823f9e97f757f01d2ddc6eb5458df9d801...
ctr: : manifest not found: not found"
In this PR we'll detect the ARM variants from /proc/cpuinfo. Because Linux
kernel has already detected the ABI, ISA and Features for us. We don't need to
parse them from registers again.
The PR has been tested on x86 and ARM64 servers, the ctr can pull images correctly now.
I also created an issue to discuss this problem #1576
@stevvooe @mattspencer-arm