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

speed up kubernetes builds #2097

Merged

Conversation

BenTheElder
Copy link
Member

xref: kubernetes/kubernetes#99517

iterating towards what would make sense to have in a make target

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 28, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 28, 2021
"build/run.sh",
// bypass make targets to skip running codegen again, call build
// rule implementation directly
"hack/make-rules/build.sh",
Copy link
Member Author

Choose a reason for hiding this comment

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

the "all" (default) make target is just:

all: generated_files
	hack/make-rules/build.sh $(WHAT)

and has been for over four years. https://github.com/kubernetes/kubernetes/blame/184c6d348c80c1f529b742c8959677817689a182/build/root/Makefile#L91

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

seven years ago it was hack/build-go.sh $(WHAT). around 5 years ago things switched more to make and it went to hack/make-rules/build.sh and then the dependency on generated_files was introduced to automatically generate those.

@BenTheElder BenTheElder changed the title avoid make generated_files repeatedly when building [WIP] avoid make generated_files repeatedly when building Feb 28, 2021
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 28, 2021
@BenTheElder
Copy link
Member Author

booo, somehow it depends on this (generated files not being synced?)

@aojea
Copy link
Contributor

aojea commented Feb 28, 2021

booo, somehow it depends on this (generated files not being synced?)

yeah, some tests depend on the generated files

@BenTheElder
Copy link
Member Author

yeah, some tests depend on the generated files

yes, but:

  • we're not building tests at that point we're building cli binaries
  • we just ran make quick-release-images which ran the codegen, so something lost the codegen between that and building the binaries :/

@BenTheElder
Copy link
Member Author

The core problem is upstream is still trying to support running the make build against a remote docker which is:
a) unnecessarily complicated, the user can deal with source syncing / ssh themselves
b) slowing down the local build, because we clobber generated files while attempting to save bandwidth

Arguably the entire rsync thing should be done away-with in favor of a cached volume mount and no more special treatment for mac's performance issues here. See background: kubernetes/kubernetes#50717

@BenTheElder
Copy link
Member Author

kubernetes/kubernetes#100046 instead (will update the PR if/when that lands)

@BenTheElder BenTheElder force-pushed the slightly-faster-build branch from a27c50a to 6acf1d5 Compare March 11, 2021 01:36
@BenTheElder
Copy link
Member Author

e2e working well. need to fix a spelling error

@BenTheElder BenTheElder force-pushed the slightly-faster-build branch from 6acf1d5 to 496a623 Compare March 11, 2021 02:23
@BenTheElder BenTheElder changed the title [WIP] avoid make generated_files repeatedly when building build Kubernetes with a single make invocation when possible Mar 11, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 11, 2021
@BenTheElder BenTheElder changed the title build Kubernetes with a single make invocation when possible speed up kubernetes builds Mar 11, 2021
@BenTheElder
Copy link
Member Author

/test all

1 similar comment
@BenTheElder
Copy link
Member Author

/test all

@aojea
Copy link
Contributor

aojea commented Mar 11, 2021

/lgtm
/hold
unhold once you consider necessary

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 11, 2021
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2021
// build images
cmd = exec.Command("make", "quick-release-images").SetEnv(env...)
// build images + binaries (binaries only on 1.21+)
cmd := exec.Command("make", "quick-release-images", "KUBE_EXTRA_WHAT="+strings.Join(what, " ")).SetEnv(env...)
Copy link
Contributor

Choose a reason for hiding this comment

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

why added here and not in env?

Copy link
Member Author

Choose a reason for hiding this comment

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

because it's not common across commands and make supports it either way.

@BenTheElder
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 11, 2021
@k8s-ci-robot
Copy link
Contributor

@BenTheElder: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-kind-e2e-kubernetes 496a623 link /test pull-kind-e2e-kubernetes

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@BenTheElder
Copy link
Member Author

upstream test flakes

@BenTheElder BenTheElder merged commit a4df15b into kubernetes-sigs:master Mar 11, 2021
@BenTheElder BenTheElder deleted the slightly-faster-build branch March 11, 2021 08:42
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. 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants