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

Always set relevant variables for cross compiling #94403

Merged
merged 2 commits into from Oct 23, 2020

Conversation

bnrjee
Copy link
Contributor

@bnrjee bnrjee commented Sep 1, 2020

What type of PR is this?
/kind feature

What this PR does / why we need it:

  1. Right now, there seems to be no way to override the platform specific cc flags that kubernetes sets. We should be able to override those values.
    For example, bottlerocket sets customized CC flags for different platforms using this patch. We should be able to override the default values in kubernetes using environment variables or build time flags and build kubernetes with customized gcc variants that bottlerocket uses.
  2. We want to be able to build kubernetes on host platforms other than amd64. For example, we may want to build amd64 targets on arm platforms. For that to happen, we need to remove the condition that checks if the build platform is amd64. If no platform is specified, we can use default values.

Which issue(s) this PR fixes:
Fixes #94291

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Release note:

Allow cross compilation of kubernetes on different platforms.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 1, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @bnrjee!

It looks like this is your first PR to kubernetes/kubernetes 🎉. 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/kubernetes 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 @bnrjee. 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 the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 1, 2020
@micahhausler
Copy link
Member

/sig release

@k8s-ci-robot k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 1, 2020
@bnrjee
Copy link
Contributor Author

bnrjee commented Sep 1, 2020

/assign @spiffxp

@hwdef
Copy link
Member

hwdef commented Sep 2, 2020

/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. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 2, 2020
@bnrjee bnrjee force-pushed the myfeature branch 2 times, most recently from 1274ed8 to 44f61f2 Compare September 3, 2020 20:02
@bnrjee
Copy link
Contributor Author

bnrjee commented Sep 8, 2020

Hi @juanvallejo, @SataQiu,
Would it be possible to add this to milestone v1.20?

@spiffxp
Copy link
Member

spiffxp commented Sep 9, 2020

/assign @BenTheElder
This LGTM but I'd like a second pair of eyes for the /approve
/milestone v1.20
/lgtm

@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Sep 9, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 9, 2020
@bnrjee
Copy link
Contributor Author

bnrjee commented Sep 16, 2020

Hi @BenTheElder,
Would it be possible for you to take a look at this?

Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

This change does not seem to gel with the motivation comment in the PR body.

If the motivation is being able to override the CC flags, we should just support overriding them instead of altering how they're set to begin with.
I don't think the switch from checking the host platform to checking if KUBE_BUILD_PLATFORMS is set makes sense.

hack/lib/golang.sh Outdated Show resolved Hide resolved
hack/lib/golang.sh Outdated Show resolved Hide resolved
@BenTheElder
Copy link
Member

/cc @mkumatag @dims

@bnrjee
Copy link
Contributor Author

bnrjee commented Sep 22, 2020

This change does not seem to gel with the motivation comment in the PR body.

If the motivation is being able to override the CC flags, we should just support overriding them instead of altering how they're set to begin with.
I don't think the switch from checking the host platform to checking if KUBE_BUILD_PLATFORMS is set makes sense.
Hi @BenTheElder
Sorry about the confusion. I have edited the motivation statement in PR body. We want to override the cc values. We also want to be able to build kubernetes on platforms other than amd64.

@bnrjee
Copy link
Contributor Author

bnrjee commented Sep 28, 2020

Hi @BenTheElder,
I have updated the motivation statement. Would it be possible for you to take another look at these code changes?

Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

please remove the check for support from the upstream code once it's actually supported to cross build from another platform
the upstream kube-cross / kube build image is only amd64 currently, when that is fixed we can possibly support building from another host.

hack/lib/golang.sh Outdated Show resolved Hide resolved
hack/lib/golang.sh Outdated Show resolved Hide resolved
@BenTheElder
Copy link
Member

cc @kubernetes/release-engineering @kubernetes/sig-release
cc @dims <-- recently led some discussions around architecture support

hack/lib/golang.sh Outdated Show resolved Hide resolved
@dims
Copy link
Member

dims commented Oct 16, 2020

i'll wait for @BenTheElder to be happy :)

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 20, 2020
@bnrjee
Copy link
Contributor Author

bnrjee commented Oct 21, 2020

/test pull-kubernetes-node-e2e

@dims
Copy link
Member

dims commented Oct 22, 2020

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 22, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bnrjee, dims

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 Oct 22, 2020
@k8s-ci-robot k8s-ci-robot merged commit ad97d93 into kubernetes:master Oct 23, 2020
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/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. 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. sig/release Categorizes an issue or PR as relevant to SIG Release. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support customized gcc and cross compilation of kubernetes on platforms other than amd64
7 participants