Speed up dockerized builds#30787
Conversation
|
Roughly how much faster is it? |
|
I'll pull together some benchmarks before I remove the WIP label. |
build/common.sh
Outdated
| chown -R $(id -u).$(id -g) "${REMOTE_OUTPUT_ROOT}" | ||
| chown -R $(id -u).$(id -g) | ||
| "${REMOTE_ROOT}" | ||
| /usr/local/go/pkg/linux_386_cgo |
There was a problem hiding this comment.
why not just do all of /usr/local/go/pkg/
There was a problem hiding this comment.
That ends up whiting out the compiler:
$ make WHAT='cmd/kubectl'
+++ [0820 16:28:15] Generating bindata:
/go/src/k8s.io/kubernetes/test/e2e/framework/gobindata_util.go
../../../hack/../test/e2e/generated/bindata.go.tmp ../../../hack/../test/e2e/generated/bindata.go differ: char 1523, line 29
+++ [0820 16:28:16] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
go tool: no such tool "compile"
Makefile.generated_files:279: recipe for target '_output/bin/deepcopy-gen' failed
make[1]: *** [_output/bin/deepcopy-gen] Error 1
Makefile:281: recipe for target 'generated_files' failed
make: *** [generated_files] Error 2
There was a problem hiding this comment.
to just chown? Or is that from volume mounting on pkg, which I could understand.
There was a problem hiding this comment.
The compiler itself is under /usr/local/go/pkg. If we make that a volume it gets whited out. Not sure what else to do there.
We could do something where we move it aside when building the image and then copy it back as part of the chown step, but that seems complicated too.
There was a problem hiding this comment.
I meant just to chmod/chown the whole thing, not to volume mount the whole
thing.
On Mon, Aug 22, 2016 at 2:24 PM, Joe Beda notifications@github.com wrote:
In build/common.sh
#30787 (comment)
:--volume "${REMOTE_OUTPUT_GOPATH}" # make a non-root owned mountpoint "${KUBE_BUILD_IMAGE}"
chown -R $(id -u).$(id -g) "${REMOTE_OUTPUT_ROOT}"chown -R $(id -u).$(id -g)"${REMOTE_ROOT}"/usr/local/go/pkg/linux_386_cgoThe compiler itself is under /usr/local/go/pkg. If we make that a volume
it gets whited out. Not sure what else to do there.We could do something where we move it aside when building the image and
then copy it back as part of the chown step, but that seems complicated too.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/30787/files/c0ba418d1f5f07f74ae8e9aa392e7ddbcfa0a144#r75761703,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVEMQP4zlhDmbqAsqoZD3z7Rl7Y3Yks5qihN5gaJpZM4Jmt7e
.
There was a problem hiding this comment.
That seems to work. Latest versions have that.
| if !pkgNeedsGeneration { | ||
| glog.V(5).Infof(" no viable conversions, not generating for this package") | ||
| continue | ||
| glog.Errorf("Package %v has 'k8s:conversion-gen' tags but no viable conversions", i) |
There was a problem hiding this comment.
The fact that this wasn't outputting a file was confusing your generated files make system. I wasn't able to get to a "no op" make without some sort of fix here.
There was a problem hiding this comment.
?? How do I repro that at head?
On Mon, Aug 22, 2016 at 6:18 AM, Joe Beda notifications@github.com wrote:
In cmd/libs/go2idl/conversion-gen/generators/conversion.go
#30787 (comment)
:@@ -280,8 +280,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
}
}
if !pkgNeedsGeneration {
glog.V(5).Infof(" no viable conversions, not generating for this package")continueglog.Errorf("Package %v has 'k8s:conversion-gen' tags but no viable conversions", i)The fact that this wasn't outputting a file was confusing your generated
files make system. I wasn't able to get to a "no op" make without some sort
of fix here.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/30787/files/9269652b4fc9760754e0b4e47cc2cb995f9d3e24#r75674739,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVM2XusCz26zLyZDn5qPbaCQ91KPbks5qiaGdgaJpZM4Jmt7e
.
There was a problem hiding this comment.
It's pretty fast but still extra work.
repo
[jbeda@k8s-build:~/src/kubernetes] (master)$ make clean
+++ [0822 18:08:36] Verifying Prerequisites....
!!! [0822 18:08:36] Build image not built. Cannot clean via docker build image.
+++ [0822 18:08:36] Removing data container kube-build-data-27932f596f
+++ [0822 18:08:36] Removing _output directory
+++ [0822 18:08:36] Deleting docker image kube-build:build-27932f596f
+++ [0822 18:08:36] Cleaning all other untagged docker images
:) Mon Aug 22 18:08:36
[jbeda@k8s-build:~/src/kubernetes] (master)$ make generated_files
+++ [0822 18:08:49] Generating bindata:
/home/jbeda/src/kubernetes/test/e2e/framework/gobindata_util.go
+++ [0822 18:08:49] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
+++ [0822 18:08:50] Building go targets for linux/amd64:
cmd/libs/go2idl/deepcopy-gen
+++ [0822 18:08:55] Generating bindata:
/home/jbeda/src/kubernetes/test/e2e/framework/gobindata_util.go
+++ [0822 18:08:56] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
+++ [0822 18:08:56] Building go targets for linux/amd64:
cmd/libs/go2idl/conversion-gen
E0822 18:09:00.238473 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/apps/v1alpha1.PetSetSpec <-> k8s.io/kubernetes/pkg/apis/apps.PetSetSpec
E0822 18:09:00.258650 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/extensions/v1beta1.HorizontalPodAutoscalerSpec <-> k8s.io/kubernetes/pkg/apis/autoscaling.HorizontalPodAutoscalerSpec
E0822 18:09:00.266875 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/extensions/v1beta1.JobSpec <-> k8s.io/kubernetes/pkg/apis/batch.JobSpec
E0822 18:09:00.282497 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/extensions/v1beta1.RollingUpdateDeployment <-> k8s.io/kubernetes/pkg/apis/extensions.RollingUpdateDeployment
E0822 18:09:00.285592 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/extensions/v1beta1.ScaleStatus <-> k8s.io/kubernetes/pkg/apis/extensions.ScaleStatus
:) Mon Aug 22 18:09:00
[jbeda@k8s-build:~/src/kubernetes] (master)$ make generated_files --debug=b
GNU Make 4.0
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
File 'generated_files' does not exist.
Must remake target 'generated_files'.
GNU Make 4.0
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
File 'generated_files' does not exist.
File 'gen_deepcopy' does not exist.
Must remake target 'gen_deepcopy'.
Successfully remade target file 'gen_deepcopy'.
File 'gen_conversion' does not exist.
File 'federation/apis/core/v1/zz_generated.conversion.go' does not exist.
Must remake target 'federation/apis/core/v1/zz_generated.conversion.go'.
Successfully remade target file 'federation/apis/core/v1/zz_generated.conversion.go'.
Must remake target 'gen_conversion'.
Successfully remade target file 'gen_conversion'.
Must remake target 'generated_files'.
Successfully remade target file 'generated_files'.
Successfully remade target file 'generated_files'.
There was a problem hiding this comment.
ACK. Good catch.
On Mon, Aug 22, 2016 at 11:13 AM, Joe Beda notifications@github.com wrote:
In cmd/libs/go2idl/conversion-gen/generators/conversion.go
#30787 (comment)
:@@ -280,8 +280,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
}
}
if !pkgNeedsGeneration {
glog.V(5).Infof(" no viable conversions, not generating for this package")continueglog.Errorf("Package %v has 'k8s:conversion-gen' tags but no viable conversions", i)It's pretty fast but still extra work.
repo
jbeda@k8s-build:~/src/kubernetes$ make clean
—
+++ [0822 18:08:36] Verifying Prerequisites....
!!! [0822 18:08:36] Build image not built. Cannot clean via docker build image.
+++ [0822 18:08:36] Removing data container kube-build-data-27932f596f
+++ [0822 18:08:36] Removing _output directory
+++ [0822 18:08:36] Deleting docker image kube-build:build-27932f596f
+++ [0822 18:08:36] Cleaning all other untagged docker images
:) Mon Aug 22 18:08:36
jbeda@k8s-build:~/src/kubernetes$ make generated_files
+++ [0822 18:08:49] Generating bindata:
/home/jbeda/src/kubernetes/test/e2e/framework/gobindata_util.go
+++ [0822 18:08:49] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
+++ [0822 18:08:50] Building go targets for linux/amd64:
cmd/libs/go2idl/deepcopy-gen
+++ [0822 18:08:55] Generating bindata:
/home/jbeda/src/kubernetes/test/e2e/framework/gobindata_util.go
+++ [0822 18:08:56] Building the toolchain targets:
k8s.io/kubernetes/hack/cmd/teststale
+++ [0822 18:08:56] Building go targets for linux/amd64:
cmd/libs/go2idl/conversion-gen
E0822 18:09:00.238473 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/apps/v1alpha1.PetSetSpec <-> k8s.io/kubernetes/pkg/apis/apps.PetSetSpec
E0822 http://k8s.io/kubernetes/pkg/apis/apps.PetSetSpecE0822 18:09:00.258650 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/extensions/v1beta1.HorizontalPodAutoscalerSpec <-> k8s.io/kubernetes/pkg/apis/autoscaling.HorizontalPodAutoscalerSpec
E0822 http://k8s.io/kubernetes/pkg/apis/autoscaling.HorizontalPodAutoscalerSpecE0822 18:09:00.266875 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/extensions/v1beta1.JobSpec <-> k8s.io/kubernetes/pkg/apis/batch.JobSpec
E0822 http://k8s.io/kubernetes/pkg/apis/batch.JobSpecE0822 18:09:00.282497 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/extensions/v1beta1.RollingUpdateDeployment <-> k8s.io/kubernetes/pkg/apis/extensions.RollingUpdateDeployment
E0822 http://k8s.io/kubernetes/pkg/apis/extensions.RollingUpdateDeploymentE0822 18:09:00.285592 8625 conversion.go:589] Warning: could not generate autoConvert functions for k8s.io/kubernetes/pkg/apis/extensions/v1beta1.ScaleStatus <-> k8s.io/kubernetes/pkg/apis/extensions.ScaleStatus
:) Mon Aug 22 18:09:00
jbeda@k8s-build:~/src/kubernetes$ make generated_files --debug=b
GNU Make 4.0
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
File 'generated_files' does not exist.
Must remake target 'generated_files'.
GNU Make 4.0
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating goal targets....
File 'generated_files' does not exist.
File 'gen_deepcopy' does not exist.
Must remake target 'gen_deepcopy'.
Successfully remade target file 'gen_deepcopy'.
File 'gen_conversion' does not exist.
File 'federation/apis/core/v1/zz_generated.conversion.go' does not exist.
Must remake target 'federation/apis/core/v1/zz_generated.conversion.go'.
Successfully remade target file 'federation/apis/core/v1/zz_generated.conversion.go'.
Must remake target 'gen_conversion'.
Successfully remade target file 'gen_conversion'.
Must remake target 'generated_files'.
Successfully remade target file 'generated_files'.
Successfully remade target file 'generated_files'.
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/kubernetes/pull/30787/files/9269652b4fc9760754e0b4e47cc2cb995f9d3e24#r75728857,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFVgVNEJWxeUo7Q5hXJa-bOF4I1RVespks5qiebagaJpZM4Jmt7e
.
477bdf5 to
0d4efbc
Compare
6ac6d27 to
dd2cac8
Compare
|
To anyone watching from home, I'm fighting with Jenkins. I was using a Docker 1.12 feature and had to discover that Jenkins was using 1.9.1 and adjust. Now the verification test is failing (can't talk to the rsync container) and I'm trying to figure out why. The only way I have to test is to push a new change with debug commands. It is essentially printf debugging with a 15m+ delay. I'll clean up the patch set after things look to be working reliably. |
build/README.md
Outdated
| 3. **Optional** [Google Cloud SDK](https://developers.google.com/cloud/sdk/) | ||
| 1. Docker, using one of the following configurations: | ||
| 1. **Mac OS X** You can either use Docker for Mac or docker-machine. See installation instructions [here](https://docs.docker.com/installation/mac/). | ||
| **Note**: You will want to set the Docker VM to have at least 3GB of initial memory or building will likely fail. (See: [#11852]( http://issue.k8s.io/11852)). https://github.com/kubernetes/kubernetes/issues/14773)) |
There was a problem hiding this comment.
Too many closing parens on this line.
make-generated-{protobuf,runtime}.sh was doing some really nasty stuff with how
the build container was managed in order to copy results out. Since we have
more flexibility to grab results out of the build container, we can now avoid
all of this. Ideally we wouldn't have `hack` calling `build` at all, but we
aren't there yet.
We weren't getting incremental builds because of new test only subpackages. Our voodoo combo of 'go install' and 'go test -c' didn't cache things like 'test/e2e_node/services'. Add the '-i' flag to 'go test' to install test only dependencies too.
|
Okay! Please take another look. Hopefully we are there. |
|
I have slightly unexpected possible use for remote docker mode: don't rsync back binaries after build, use them to start DIND cluster on remote docker instead. E.g. I'm on a not very fast 3G connection and want to use GCE for dev. How hard it's to do this? (at least opt out of rsyncing binaries back) |
|
@ivan4th -- interesting case! Right now we always "copy back" to the host machine but we can explore making that optional after this gets in. |
|
@jbeda actually it looks like |
ixdy
left a comment
There was a problem hiding this comment.
woo! I'm fine with getting this in and then iterating with any additional fixes if necessary. two minor comments, neither of which is blocking.
| LOCAL_OUTPUT_BUILD_CONTEXT="${LOCAL_OUTPUT_IMAGE_STAGING}/${KUBE_BUILD_IMAGE}" | ||
|
|
||
| kube::version::get_version_vars | ||
| kube::version::save_version_vars "${KUBE_ROOT}/.dockerized-kube-version-defs" |
There was a problem hiding this comment.
minor nonblocking suggestion: maybe clean deletes this?
| # limitations under the License. | ||
|
|
||
| # This file creates release artifacts (tar files, container images) that are | ||
| # ready to distribute to install or distribute to end users. |
There was a problem hiding this comment.
nit: "ready to distribute to install or distribute" seems awkward?
|
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
|
Automatic merge from submit-queue |
|
woo hoo! |
This was broken by kubernetes#30787. A stray bash `source` caused an undefined variable reference. Apparently the federation images have a parallel nad different "release" path that isn't tested by the pre-checkin tests.
Automatic merge from submit-queue Fix broken build/push-federation-images.sh The federation CI build is broken by #30787. A stray bash `source` caused an undefined variable reference. Apparently the federation images have a parallel nad different "release" path that isn't tested by the pre-checkin tests.
This was broken by kubernetes#30787. A stray bash `source` caused an undefined variable reference. Apparently the federation images have a parallel nad different "release" path that isn't tested by the pre-checkin tests.
Automatic merge from submit-queue Make kubernetes-src.tar.gz contain source code again **What this PR does / why we need it**: This PR fixes `kubernetes-src.tar.gz` by reviving the logic for `kube-source.tar.gz` from before #30787. **Which issue this PR fixes**: fixes #36403 @saad-ali @jbeda @zmerlynn
This PR speeds up dockerized builds. First, we make sure that we are as incremental as possible. The bigger change is that now we use rsync to move sources into the container and get data back out.
To do yet:
zz_generated.*files generated bymake generated_fileshack/hack/update-*-dockerized.shThis replaces #28518 and is related to #30600.
cc @thockin @spxtr @david-mcmahon @MHBauer
Benchmarks by running
make clean ; sync ; time bash -xc 'time build/make-build-image.sh ; time sync ; time build/run.sh make ; time sync; time build/run.sh make'on a GCE n1-standard-8 with PD-SSD.This change is