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

Fix non-amd64 arch config for debian images #1839

Merged
merged 1 commit into from
Jan 13, 2021

Conversation

sozercan
Copy link
Contributor

@sozercan sozercan commented Jan 12, 2021

What type of PR is this?

/kind bug

What this PR does / why we need it:

Non-AMD64 debian images are not marked correct arch in image config. Looks like they are just build as amd64 images with manifest list pointing to different architectures.

To verify:

$ docker buildx imagetools inspect  k8s.gcr.io/build-image/debian-iptables:buster-v1.3.0 
Name:      k8s.gcr.io/build-image/debian-iptables:buster-v1.3.0
...
  Name:      k8s.gcr.io/build-image/debian-iptables:buster-v1.3.0@sha256:3d7ede6013b0516f1ec3852590895d4a7b6ec8f5e15bebc1a55237bba4538da2
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/arm64
...

$ docker pull k8s.gcr.io/build-image/debian-iptables:buster-v1.3.0@sha256:3d7ede6013b0516f1ec3852590895d4a7b6ec8f5e15bebc1a55237bba4538da2
k8s.gcr.io/build-image/debian-iptables@sha256:3d7ede6013b0516f1ec3852590895d4a7b6ec8f5e15bebc1a55237bba4538da2: Pulling from build-image/debian-iptables
Digest: sha256:3d7ede6013b0516f1ec3852590895d4a7b6ec8f5e15bebc1a55237bba4538da2
Status: Downloaded newer image for k8s.gcr.io/build-image/debian-iptables@sha256:3d7ede6013b0516f1ec3852590895d4a7b6ec8f5e15bebc1a55237bba4538da2
k8s.gcr.io/build-image/debian-iptables:buster-v1.3.0@sha256:3d7ede6013b0516f1ec3852590895d4a7b6ec8f5e15bebc1a55237bba4538da2

$ docker inspect -f '{{json .Architecture}}' k8s.gcr.io/build-image/debian-iptables:buster-v1.3.0@sha256:3d7ede6013b0516f1ec3852590895d4a7b6ec8f5e15bebc1a55237bba4538da2
"amd64"

This causes an issue with building Kubernetes with Docker v20.10.
image with reference k8s.gcr.io/build-image/debian-iptables:buster-v1.3.0 was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64
docker/for-linux#1170

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Mark debian images with their corresponding architectures

cc @justaugustus

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Jan 12, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @sozercan!

It looks like this is your first PR to kubernetes/release 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/release has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @sozercan. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. sig/release Categorizes an issue or PR as relevant to SIG Release. labels Jan 12, 2021
Copy link
Contributor

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jan 12, 2021
@@ -92,10 +92,15 @@ else
endif
mv $(TEMP_DIR)/$(CONFIG)/Dockerfile.build.tmp $(TEMP_DIR)/$(CONFIG)/Dockerfile.build

docker build --pull -t $(BUILD_IMAGE) -f $(TEMP_DIR)/$(CONFIG)/Dockerfile.build $(TEMP_DIR)/$(CONFIG)
docker buildx build \
Copy link
Contributor

Choose a reason for hiding this comment

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

We may run into issues here with pulling the base image when using buildkit and gcr mirror (see kubernetes/kubernetes#97982 for more info)

@saschagrunert
Copy link
Member

saschagrunert commented Jan 13, 2021

Hey @sozercan, thank you for the contribution of this fix! 🙏

So, I don't think that we need to use buildkit here. We could stick to a FROM --platform=linux/<ARCH> approach within the Dockerfile's.

Going one step back, it also looks like that the base image for debian-iptables aka debian-base has exactly the same issue, which may be the reason that the created manifest just points to one architecture (amd64).

> podman inspect k8s.gcr.io/build-image/debian-base-arm64:buster-v1.2.0 | jq .[].Architecture
"amd64"

I think we should start fixing the debian-base image before 🙃

Edit: We're building the debian-base images from scratch, which means that the mentioned FROM --platform ... will always fallback to the host platform. In this case I only see a fix in introducing buildkit for this image, otherwise we would not get the right architecture into the manifest. 🤷

Referencing discussion: https://kubernetes.slack.com/archives/CJH2GBF7Y/p1610548545313800

@dims
Copy link
Member

dims commented Jan 13, 2021

@hasheddan @saschagrunert do we want to bump priority on review for this one?

@saschagrunert
Copy link
Member

@hasheddan @saschagrunert do we want to bump priority on review for this one?

@sozercan did you had a chance to verify that your changes work even with a "wrong" debian-base? If so then we could conclude on using buildkit for both images and merge this one.

@sozercan
Copy link
Contributor Author

sozercan commented Jan 13, 2021

@saschagrunert yes, if it's built with --platform (or built on matching host) it'll add correct arch, even if base image arch doesn't match.

$ ARCH=arm64 make build
cp -r ./buster /tmp/tmp.n7NZDnwBht/
cd /tmp/tmp.n7NZDnwBht/buster && sed -i "s|BASEIMAGE|k8s.gcr.io/build-image/debian-base-arm64:buster-v1.2.0|g" Dockerfile
...
 => => writing image sha256:e5e283e4c90d9ec8dbf7b62520392511e1ae4f0e6d783cfb93aa026f21cb0656

$ docker inspect -f '{{json .Architecture}}' e5e283e4c90d9ec8dbf7b62520392511e1ae4f0e6d783cfb93aa026f21cb0656
"arm64"

@justaugustus
Copy link
Member

/lgtm
/approve
/priority critical-urgent

I'll work on image updates in a follow-up.

@k8s-ci-robot k8s-ci-robot added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed needs-priority labels Jan 13, 2021
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 13, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justaugustus, sozercan

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 Jan 13, 2021
@k8s-ci-robot k8s-ci-robot merged commit 1fd673e into kubernetes:master Jan 13, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Jan 13, 2021
@sozercan sozercan deleted the fix-arch branch January 13, 2021 20:21
justaugustus added a commit to justaugustus/release that referenced this pull request Jan 15, 2021
This reverts commit 1fd673e, reversing
changes made to ce6512e.
k8s-ci-robot added a commit that referenced this pull request Jan 15, 2021
Revert "Merge pull request #1839 from sozercan/fix-arch"
wespanther pushed a commit to wespanther/release that referenced this pull request Mar 15, 2021
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/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. 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.

6 participants