diff --git a/.travis.yml b/.travis.yml index f9855c5d3354b..995f17dd98dec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: go +arch: + - amd64 + - arm64 os: - linux - osx @@ -10,16 +13,20 @@ go: go_import_path: k8s.io/kops script: - - GOPROXY=https://proxy.golang.org make nodeup examples test + - GOPROXY=https://proxy.golang.org travis_wait 30 make nodeup examples test jobs: # Exclude GO 1.14 for OSX until it becomes the default because of limited availability exclude: - os: osx - go: 1.14.x + go: 1.13.x + - os: linux + go: 1.13.x + arch: arm64 include: - name: Verify + arch: amd64 os: linux go: 1.13.x script: diff --git a/Makefile b/Makefile index ad835fdae2e0e..f55d3bbfef585 100644 --- a/Makefile +++ b/Makefile @@ -216,8 +216,19 @@ ${DIST}/linux/amd64/nodeup: ${BINDATA_TARGETS} mkdir -p ${DIST} GOOS=linux GOARCH=amd64 go build ${GCFLAGS} -a ${EXTRA_BUILDFLAGS} -o $@ ${LDFLAGS}"${EXTRA_LDFLAGS} -X k8s.io/kops.Version=${VERSION} -X k8s.io/kops.GitVersion=${GITSHA}" k8s.io/kops/cmd/nodeup +.PHONY: ${DIST}/linux/arm64/nodeup +${DIST}/linux/arm64/nodeup: ${BINDATA_TARGETS} + mkdir -p ${DIST} + GOOS=linux GOARCH=arm64 go build ${GCFLAGS} -a ${EXTRA_BUILDFLAGS} -o $@ ${LDFLAGS}"${EXTRA_LDFLAGS} -X k8s.io/kops.Version=${VERSION} -X k8s.io/kops.GitVersion=${GITSHA}" k8s.io/kops/cmd/nodeup + +.PHONY: crossbuild-nodeup-amd64 +crossbuild-nodeup-amd64: ${DIST}/linux/amd64/nodeup + +.PHONY: crossbuild-nodeup-arm64 +crossbuild-nodeup-arm64: ${DIST}/linux/arm64/nodeup + .PHONY: crossbuild-nodeup -crossbuild-nodeup: ${DIST}/linux/amd64/nodeup +crossbuild-nodeup: crossbuild-nodeup-amd64 crossbuild-nodeup-arm64 .PHONY: crossbuild-nodeup-in-docker crossbuild-nodeup-in-docker: @@ -229,6 +240,14 @@ crossbuild-nodeup-in-docker: docker kill nodeup-build-${UNIQUE} docker rm nodeup-build-${UNIQUE} +.PHONY: nodeup-dist +nodeup-dist: crossbuild-nodeup-in-docker + mkdir -p ${DIST} + tools/sha1 ${DIST}/linux/amd64/nodeup ${DIST}/linux/amd64/nodeup.sha1 + tools/sha256 ${DIST}/linux/amd64/nodeup ${DIST}/linux/amd64/nodeup.sha256 + tools/sha1 ${DIST}/linux/arm64/nodeup ${DIST}/linux/arm64/nodeup.sha1 + tools/sha256 ${DIST}/linux/arm64/nodeup ${DIST}/linux/arm64/nodeup.sha256 + .PHONY: ${DIST}/darwin/amd64/kops ${DIST}/darwin/amd64/kops: ${BINDATA_TARGETS} mkdir -p ${DIST} @@ -239,14 +258,18 @@ ${DIST}/linux/amd64/kops: ${BINDATA_TARGETS} mkdir -p ${DIST} GOOS=linux GOARCH=amd64 go build ${GCFLAGS} -a ${EXTRA_BUILDFLAGS} -o $@ ${LDFLAGS}"${EXTRA_LDFLAGS} -X k8s.io/kops.Version=${VERSION} -X k8s.io/kops.GitVersion=${GITSHA}" k8s.io/kops/cmd/kops +.PHONY: ${DIST}/linux/arm64/kops +${DIST}/linux/arm64/kops: ${BINDATA_TARGETS} + mkdir -p ${DIST} + GOOS=linux GOARCH=arm64 go build ${GCFLAGS} -a ${EXTRA_BUILDFLAGS} -o $@ ${LDFLAGS}"${EXTRA_LDFLAGS} -X k8s.io/kops.Version=${VERSION} -X k8s.io/kops.GitVersion=${GITSHA}" k8s.io/kops/cmd/kops + .PHONY: ${DIST}/windows/amd64/kops.exe ${DIST}/windows/amd64/kops.exe: ${BINDATA_TARGETS} mkdir -p ${DIST} GOOS=windows GOARCH=amd64 go build ${GCFLAGS} -a ${EXTRA_BUILDFLAGS} -o $@ ${LDFLAGS}"${EXTRA_LDFLAGS} -X k8s.io/kops.Version=${VERSION} -X k8s.io/kops.GitVersion=${GITSHA}" k8s.io/kops/cmd/kops - .PHONY: crossbuild -crossbuild: ${DIST}/windows/amd64/kops.exe ${DIST}/darwin/amd64/kops ${DIST}/linux/amd64/kops +crossbuild: ${DIST}/windows/amd64/kops.exe ${DIST}/darwin/amd64/kops ${DIST}/linux/amd64/kops ${DIST}/linux/arm64/kops .PHONY: crossbuild-in-docker crossbuild-in-docker: @@ -265,6 +288,8 @@ kops-dist: crossbuild-in-docker tools/sha256 ${DIST}/darwin/amd64/kops ${DIST}/darwin/amd64/kops.sha256 tools/sha1 ${DIST}/linux/amd64/kops ${DIST}/linux/amd64/kops.sha1 tools/sha256 ${DIST}/linux/amd64/kops ${DIST}/linux/amd64/kops.sha256 + tools/sha1 ${DIST}/linux/arm64/kops ${DIST}/linux/arm64/kops.sha1 + tools/sha256 ${DIST}/linux/arm64/kops ${DIST}/linux/arm64/kops.sha256 tools/sha1 ${DIST}/windows/amd64/kops.exe ${DIST}/windows/amd64/kops.exe.sha1 tools/sha256 ${DIST}/windows/amd64/kops.exe ${DIST}/windows/amd64/kops.exe.sha256 @@ -272,18 +297,24 @@ kops-dist: crossbuild-in-docker version-dist: nodeup-dist kops-dist protokube-export utils-dist rm -rf ${UPLOAD} mkdir -p ${UPLOAD}/kops/${VERSION}/linux/amd64/ + mkdir -p ${UPLOAD}/kops/${VERSION}/linux/arm64/ mkdir -p ${UPLOAD}/kops/${VERSION}/darwin/amd64/ mkdir -p ${UPLOAD}/kops/${VERSION}/images/ - mkdir -p ${UPLOAD}/utils/${VERSION}/linux/amd64/ - cp ${DIST}/nodeup ${UPLOAD}/kops/${VERSION}/linux/amd64/nodeup - cp ${DIST}/nodeup.sha1 ${UPLOAD}/kops/${VERSION}/linux/amd64/nodeup.sha1 - cp ${DIST}/nodeup.sha256 ${UPLOAD}/kops/${VERSION}/linux/amd64/nodeup.sha256 + cp ${DIST}/linux/amd64/nodeup ${UPLOAD}/kops/${VERSION}/linux/amd64/nodeup + cp ${DIST}/linux/amd64/nodeup.sha1 ${UPLOAD}/kops/${VERSION}/linux/amd64/nodeup.sha1 + cp ${DIST}/linux/amd64/nodeup.sha256 ${UPLOAD}/kops/${VERSION}/linux/amd64/nodeup.sha256 + cp ${DIST}/linux/arm64/nodeup ${UPLOAD}/kops/${VERSION}/linux/arm64/nodeup + cp ${DIST}/linux/arm64/nodeup.sha1 ${UPLOAD}/kops/${VERSION}/linux/arm64/nodeup.sha1 + cp ${DIST}/linux/arm64/nodeup.sha256 ${UPLOAD}/kops/${VERSION}/linux/arm64/nodeup.sha256 cp ${IMAGES}/protokube.tar.gz ${UPLOAD}/kops/${VERSION}/images/protokube.tar.gz cp ${IMAGES}/protokube.tar.gz.sha1 ${UPLOAD}/kops/${VERSION}/images/protokube.tar.gz.sha1 cp ${IMAGES}/protokube.tar.gz.sha256 ${UPLOAD}/kops/${VERSION}/images/protokube.tar.gz.sha256 cp ${DIST}/linux/amd64/kops ${UPLOAD}/kops/${VERSION}/linux/amd64/kops cp ${DIST}/linux/amd64/kops.sha1 ${UPLOAD}/kops/${VERSION}/linux/amd64/kops.sha1 cp ${DIST}/linux/amd64/kops.sha256 ${UPLOAD}/kops/${VERSION}/linux/amd64/kops.sha256 + cp ${DIST}/linux/arm64/kops ${UPLOAD}/kops/${VERSION}/linux/arm64/kops + cp ${DIST}/linux/arm64/kops.sha1 ${UPLOAD}/kops/${VERSION}/linux/arm64/kops.sha1 + cp ${DIST}/linux/arm64/kops.sha256 ${UPLOAD}/kops/${VERSION}/linux/arm64/kops.sha256 cp ${DIST}/darwin/amd64/kops ${UPLOAD}/kops/${VERSION}/darwin/amd64/kops cp ${DIST}/darwin/amd64/kops.sha1 ${UPLOAD}/kops/${VERSION}/darwin/amd64/kops.sha1 cp ${DIST}/darwin/amd64/kops.sha256 ${UPLOAD}/kops/${VERSION}/darwin/amd64/kops.sha256 @@ -324,27 +355,48 @@ gen-cli-docs: ${KOPS} # Regenerate CLI docs KOPS_FEATURE_FLAGS= \ ${KOPS} genhelpdocs --out docs/cli -.PHONY: push -# Will always push a linux-based build up to the server -push: crossbuild-nodeup +.PHONY: push-amd64 +push-amd64: crossbuild-nodeup-amd64 scp -C .build/dist/linux/amd64/nodeup ${TARGET}:/tmp/ -.PHONY: push-gce-dry -push-gce-dry: push +.PHONY: push-arm64 +push-arm64: crossbuild-nodeup-arm64 + scp -C .build/dist/linux/arm64/nodeup ${TARGET}:/tmp/ + +.PHONY: push-gce-dry-amd64 +push-gce-dry-amd64: push-amd64 + ssh ${TARGET} sudo /tmp/nodeup --conf=metadata://gce/instance/attributes/config --dryrun --v=8 + +.PHONY: push-gce-dry-arm64 +push-gce-dry-arm64: push-arm64 ssh ${TARGET} sudo /tmp/nodeup --conf=metadata://gce/instance/attributes/config --dryrun --v=8 -.PHONY: push-gce-dry -push-aws-dry: push +.PHONY: push-aws-dry-amd64 +push-aws-dry-amd64: push-amd64 ssh ${TARGET} sudo /tmp/nodeup --conf=/opt/kops/conf/kube_env.yaml --dryrun --v=8 -.PHONY: push-gce-run -push-gce-run: push +.PHONY: push-aws-dry-arm64 +push-aws-dry-arm64: push-arm64 + ssh ${TARGET} sudo /tmp/nodeup --conf=/opt/kops/conf/kube_env.yaml --dryrun --v=8 + +.PHONY: push-gce-run-amd64 +push-gce-run-amd64: push-amd64 ssh ${TARGET} sudo cp /tmp/nodeup /var/lib/toolbox/kubernetes-install/nodeup ssh ${TARGET} sudo /var/lib/toolbox/kubernetes-install/nodeup --conf=/var/lib/toolbox/kubernetes-install/kube_env.yaml --v=8 +.PHONY: push-gce-run-arm64 +push-gce-run-arm64: push-arm64 + ssh ${TARGET} sudo cp /tmp/nodeup /var/lib/toolbox/kubernetes-install/nodeup + ssh ${TARGET} sudo /var/lib/toolbox/kubernetes-install/nodeup --conf=/var/lib/toolbox/kubernetes-install/kube_env.yaml --v=8 + +# -t is for CentOS http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password +.PHONY: push-aws-run-amd64 +push-aws-run-amd64: push-amd64 + ssh -t ${TARGET} sudo /tmp/nodeup --conf=/opt/kops/conf/kube_env.yaml --v=8 + # -t is for CentOS http://unix.stackexchange.com/questions/122616/why-do-i-need-a-tty-to-run-sudo-if-i-can-sudo-without-a-password -.PHONY: push-aws-run -push-aws-run: push +.PHONY: push-aws-run-arm64 +push-aws-run-arm64: push-arm64 ssh -t ${TARGET} sudo /tmp/nodeup --conf=/opt/kops/conf/kube_env.yaml --v=8 .PHONY: ${PROTOKUBE} @@ -388,17 +440,6 @@ nodeup: ${NODEUP} ${NODEUP}: ${BINDATA_TARGETS} go build ${GCFLAGS} ${EXTRA_BUILDFLAGS} ${LDFLAGS}"${EXTRA_LDFLAGS} -X k8s.io/kops.Version=${VERSION} -X k8s.io/kops.GitVersion=${GITSHA}" -o $@ k8s.io/kops/cmd/nodeup -.PHONY: nodeup-dist -nodeup-dist: - mkdir -p ${DIST} - docker pull golang:${GOVERSION} # Keep golang image up to date - docker run --name=nodeup-build-${UNIQUE} -e STATIC_BUILD=yes -e VERSION=${VERSION} -v ${KOPS_ROOT}:/go/src/k8s.io/kops golang:${GOVERSION} make -C /go/src/k8s.io/kops/ nodeup - docker start nodeup-build-${UNIQUE} - docker exec nodeup-build-${UNIQUE} chown -R ${UID}:${GID} /go/src/k8s.io/kops/.build - docker cp nodeup-build-${UNIQUE}:/go/src/k8s.io/kops/.build/local/nodeup .build/dist/ - tools/sha1 .build/dist/nodeup .build/dist/nodeup.sha1 - tools/sha256 .build/dist/nodeup .build/dist/nodeup.sha256 - .PHONY: bazel-crossbuild-dns-controller bazel-crossbuild-dns-controller: bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //dns-controller/... @@ -632,11 +673,13 @@ bazel-build-cli: bazel-crossbuild-kops: bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd/kops/... bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/kops/... + bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd/kops/... bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64 //cmd/kops/... .PHONY: bazel-crossbuild-nodeup bazel-crossbuild-nodeup: bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/nodeup/... + bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd/nodeup/... .PHONY: bazel-crossbuild-protokube bazel-crossbuild-protokube: @@ -742,10 +785,13 @@ bazel-version-dist: bazel-crossbuild-nodeup bazel-crossbuild-kops bazel-kops-con mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/darwin/amd64/ mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/windows/amd64/ mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/images/ - mkdir -p ${BAZELUPLOAD}/utils/${VERSION}/linux/amd64/ cp bazel-bin/cmd/nodeup/linux_amd64_pure_stripped/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup tools/sha1 ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup.sha1 tools/sha256 ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup.sha256 + mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/ + cp bazel-bin/cmd/nodeup/linux_arm64_pure_stripped/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup + tools/sha1 ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup.sha1 + tools/sha256 ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup.sha256 cp ${BAZELIMAGES}/protokube.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/protokube.tar.gz cp ${BAZELIMAGES}/protokube.tar.gz.sha1 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube.tar.gz.sha1 cp ${BAZELIMAGES}/protokube.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube.tar.gz.sha256 @@ -760,6 +806,9 @@ bazel-version-dist: bazel-crossbuild-nodeup bazel-crossbuild-kops bazel-kops-con cp bazel-bin/cmd/kops/linux_amd64_pure_stripped/kops ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/kops tools/sha1 ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/kops ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/kops.sha1 tools/sha256 ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/kops ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/kops.sha256 + cp bazel-bin/cmd/kops/linux_arm64_pure_stripped/kops ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/kops + tools/sha1 ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/kops ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/kops.sha1 + tools/sha256 ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/kops ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/kops.sha256 cp bazel-bin/cmd/kops/darwin_amd64_pure_stripped/kops ${BAZELUPLOAD}/kops/${VERSION}/darwin/amd64/kops tools/sha1 ${BAZELUPLOAD}/kops/${VERSION}/darwin/amd64/kops ${BAZELUPLOAD}/kops/${VERSION}/darwin/amd64/kops.sha1 tools/sha256 ${BAZELUPLOAD}/kops/${VERSION}/darwin/amd64/kops ${BAZELUPLOAD}/kops/${VERSION}/darwin/amd64/kops.sha256 @@ -816,6 +865,10 @@ dev-upload-nodeup: bazel-crossbuild-nodeup cp -fp bazel-bin/cmd/nodeup/linux_amd64_pure_stripped/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup tools/sha1 ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup.sha1 tools/sha256 ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup.sha256 + mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/ + cp -fp bazel-bin/cmd/nodeup/linux_arm64_pure_stripped/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup + tools/sha1 ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup.sha1 + tools/sha256 ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup.sha256 ${UPLOAD_CMD} ${BAZELUPLOAD}/ ${UPLOAD_DEST} # dev-upload-protokube uploads protokube to GCS diff --git a/docs/development/adding_a_feature.md b/docs/development/adding_a_feature.md index 6360bf7aa0ce2..dc2f2254222b4 100644 --- a/docs/development/adding_a_feature.md +++ b/docs/development/adding_a_feature.md @@ -226,7 +226,7 @@ You can `make` and run `kops` locally. But `nodeup` is pulled from an S3 bucket To rapidly test a nodeup change, you can build it, scp it to a running machine, and run it over SSH with the output viewable locally: -`make push-aws-run TARGET=admin@` +`make push-aws-run-amd64 TARGET=admin@` For more complete testing though, you will likely want to do a private build of diff --git a/docs/development/building.md b/docs/development/building.md index 840f6ff2e0b61..91b2f359d1503 100644 --- a/docs/development/building.md +++ b/docs/development/building.md @@ -25,7 +25,7 @@ make ## Cross Compiling -Cross compiling for things like `nodeup` are now done automatically via `make nodeup`. `make push-aws-run TARGET=admin@$TARGET` will automatically choose the linux amd64 build from your `.build` directory. +Cross compiling for things like `nodeup` are now done automatically via `make nodeup`. `make push-aws-run-amd64 TARGET=admin@$TARGET` will automatically choose the linux amd64 build from your `.build` directory. ## Debugging