diff --git a/Makefile b/Makefile index 5a40bd873eb40..260a140248ee1 100644 --- a/Makefile +++ b/Makefile @@ -283,8 +283,8 @@ version-dist: nodeup-dist kops-dist protokube-export 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.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.sha256 ${UPLOAD}/kops/${VERSION}/images/protokube.tar.gz.sha256 + cp ${IMAGES}/protokube-amd64.tar.gz ${UPLOAD}/kops/${VERSION}/images/protokube-amd64.tar.gz + cp ${IMAGES}/protokube-amd64.tar.gz.sha256 ${UPLOAD}/kops/${VERSION}/images/protokube-amd64.tar.gz.sha256 cp ${DIST}/linux/amd64/kops ${UPLOAD}/kops/${VERSION}/linux/amd64/kops cp ${DIST}/linux/amd64/kops.sha256 ${UPLOAD}/kops/${VERSION}/linux/amd64/kops.sha256 cp ${DIST}/linux/arm64/kops ${UPLOAD}/kops/${VERSION}/linux/arm64/kops @@ -326,14 +326,22 @@ bazel-version-ci: bazel-crossbuild-kops-ci bazel-crossbuild-nodeup bazel-kops-co tools/sha256 ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/nodeup.sha256 cp bazel-bin/cmd/nodeup/linux_arm64_pure_stripped/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup 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.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube.tar.gz.sha256 - cp ${BAZELIMAGES}/kops-controller.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller.tar.gz - cp ${BAZELIMAGES}/kops-controller.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller.tar.gz.sha256 - cp ${BAZELIMAGES}/kube-apiserver-healthcheck.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck.tar.gz - cp ${BAZELIMAGES}/kube-apiserver-healthcheck.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck.tar.gz.sha256 - cp ${BAZELIMAGES}/dns-controller.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller.tar.gz - cp ${BAZELIMAGES}/dns-controller.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller.tar.gz.sha256 + cp ${BAZELIMAGES}/protokube-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-amd64.tar.gz + cp ${BAZELIMAGES}/protokube-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-amd64.tar.gz.sha256 + cp ${BAZELIMAGES}/protokube-arm64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-arm64.tar.gz + cp ${BAZELIMAGES}/protokube-arm64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-arm64.tar.gz.sha256 + cp ${BAZELIMAGES}/kops-controller-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-amd64.tar.gz + cp ${BAZELIMAGES}/kops-controller-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-amd64.tar.gz.sha256 + cp ${BAZELIMAGES}/kops-controller-arm64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-arm64.tar.gz + cp ${BAZELIMAGES}/kops-controller-arm64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-arm64.tar.gz.sha256 + cp ${BAZELIMAGES}/kube-apiserver-healthcheck-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-amd64.tar.gz + cp ${BAZELIMAGES}/kube-apiserver-healthcheck-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-amd64.tar.gz.sha256 + cp ${BAZELIMAGES}/kube-apiserver-healthcheck-arm64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-arm64.tar.gz + cp ${BAZELIMAGES}/kube-apiserver-healthcheck-arm64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-arm64.tar.gz.sha256 + cp ${BAZELIMAGES}/dns-controller-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-amd64.tar.gz + cp ${BAZELIMAGES}/dns-controller-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-amd64.tar.gz.sha256 + cp ${BAZELIMAGES}/dns-controller-arm64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-arm64.tar.gz + cp ${BAZELIMAGES}/dns-controller-arm64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-arm64.tar.gz.sha256 cp -fr ${BAZELUPLOAD}/kops/${VERSION}/* ${BAZELDIST}/ # gcs-publish-ci is the entry point for CI testing @@ -420,9 +428,9 @@ protokube-image: protokube-build-in-docker .PHONY: protokube-export protokube-export: protokube-image - docker save protokube:${PROTOKUBE_TAG} > ${IMAGES}/protokube.tar - gzip --no-name --force --best ${IMAGES}/protokube.tar - tools/sha256 ${IMAGES}/protokube.tar.gz ${IMAGES}/protokube.tar.gz.sha256 + docker save protokube:${PROTOKUBE_TAG} > ${IMAGES}/protokube-amd64.tar + gzip --no-name --force --best ${IMAGES}/protokube-amd64.tar + tools/sha256 ${IMAGES}/protokube-amd64.tar.gz ${IMAGES}/protokube-amd64.tar.gz.sha256 # protokube-push is no longer used (we upload a docker image tar file to S3 instead), # but we're keeping it around in case it is useful for development etc @@ -441,6 +449,7 @@ ${NODEUP}: ${BINDATA_TARGETS} .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/... + bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //dns-controller/... .PHONY: dns-controller-push @@ -661,10 +670,12 @@ bazel-crossbuild-nodeup: .PHONY: bazel-crossbuild-protokube bazel-crossbuild-protokube: bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //protokube/... + bazel build ${BAZEL_CONFIG} --features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //protokube/... .PHONY: bazel-crossbuild-protokube-image bazel-crossbuild-protokube-image: - bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //images:protokube.tar + bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //protokube/cmd/protokube:image-bundle-amd64.tar + bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //protokube/cmd/protokube:image-bundle-arm64.tar .PHONY: bazel-crossbuild-node-authorizer-image bazel-crossbuild-node-authorizer-image: @@ -716,30 +727,42 @@ push-node-authorizer: .PHONY: bazel-protokube-export bazel-protokube-export: mkdir -p ${BAZELIMAGES} - bazel build ${BAZEL_CONFIG} --action_env=PROTOKUBE_TAG=${PROTOKUBE_TAG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //images:protokube.tar.gz //images:protokube.tar.gz.sha256 - cp -fp bazel-bin/images/protokube.tar.gz ${BAZELIMAGES}/protokube.tar.gz - cp -fp bazel-bin/images/protokube.tar.gz.sha256 ${BAZELIMAGES}/protokube.tar.gz.sha256 + bazel build ${BAZEL_CONFIG} --action_env=PROTOKUBE_TAG=${PROTOKUBE_TAG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //protokube/cmd/protokube:image-bundle-amd64.tar.gz //protokube/cmd/protokube:image-bundle-amd64.tar.gz.sha256 + bazel build ${BAZEL_CONFIG} --action_env=PROTOKUBE_TAG=${PROTOKUBE_TAG} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //protokube/cmd/protokube:image-bundle-arm64.tar.gz //protokube/cmd/protokube:image-bundle-arm64.tar.gz.sha256 + cp -fp bazel-bin/protokube/cmd/protokube/image-bundle-amd64.tar.gz ${BAZELIMAGES}/protokube-amd64.tar.gz + cp -fp bazel-bin/protokube/cmd/protokube/image-bundle-arm64.tar.gz ${BAZELIMAGES}/protokube-arm64.tar.gz + cp -fp bazel-bin/protokube/cmd/protokube/image-bundle-amd64.tar.gz.sha256 ${BAZELIMAGES}/protokube-amd64.tar.gz.sha256 + cp -fp bazel-bin/protokube/cmd/protokube/image-bundle-arm64.tar.gz.sha256 ${BAZELIMAGES}/protokube-arm64.tar.gz.sha256 .PHONY: bazel-kube-apiserver-healthcheck-export bazel-kube-apiserver-healthcheck-export: mkdir -p ${BAZELIMAGES} - DOCKER_REGISTRY="" DOCKER_IMAGE_PREFIX="kope/" KUBE_APISERVER_HEALTHCHECK_TAG=${KUBE_APISERVER_HEALTHCHECK_TAG} bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/kube-apiserver-healthcheck:image-bundle.tar.gz //cmd/kube-apiserver-healthcheck:image-bundle.tar.gz.sha256 - cp -fp bazel-bin/cmd/kube-apiserver-healthcheck/image-bundle.tar.gz ${BAZELIMAGES}/kube-apiserver-healthcheck.tar.gz - cp -fp bazel-bin/cmd/kube-apiserver-healthcheck/image-bundle.tar.gz.sha256 ${BAZELIMAGES}/kube-apiserver-healthcheck.tar.gz.sha256 + DOCKER_REGISTRY="" DOCKER_IMAGE_PREFIX="kope/" KUBE_APISERVER_HEALTHCHECK_TAG=${KUBE_APISERVER_HEALTHCHECK_TAG} bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/kube-apiserver-healthcheck:image-bundle-amd64.tar.gz.sha256 + DOCKER_REGISTRY="" DOCKER_IMAGE_PREFIX="kope/" KUBE_APISERVER_HEALTHCHECK_TAG=${KUBE_APISERVER_HEALTHCHECK_TAG} bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd/kube-apiserver-healthcheck:image-bundle-arm64.tar.gz.sha256 + cp -fp bazel-bin/cmd/kube-apiserver-healthcheck/image-bundle-amd64.tar.gz ${BAZELIMAGES}/kube-apiserver-healthcheck-amd64.tar.gz + cp -fp bazel-bin/cmd/kube-apiserver-healthcheck/image-bundle-arm64.tar.gz ${BAZELIMAGES}/kube-apiserver-healthcheck-arm64.tar.gz + cp -fp bazel-bin/cmd/kube-apiserver-healthcheck/image-bundle-amd64.tar.gz.sha256 ${BAZELIMAGES}/kube-apiserver-healthcheck-amd64.tar.gz.sha256 + cp -fp bazel-bin/cmd/kube-apiserver-healthcheck/image-bundle-arm64.tar.gz.sha256 ${BAZELIMAGES}/kube-apiserver-healthcheck-arm64.tar.gz.sha256 .PHONY: bazel-kops-controller-export bazel-kops-controller-export: mkdir -p ${BAZELIMAGES} - DOCKER_REGISTRY="" DOCKER_IMAGE_PREFIX="kope/" KOPS_CONTROLLER_TAG=${KOPS_CONTROLLER_TAG} bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/kops-controller:image-bundle.tar.gz //cmd/kops-controller:image-bundle.tar.gz.sha256 - cp -fp bazel-bin/cmd/kops-controller/image-bundle.tar.gz ${BAZELIMAGES}/kops-controller.tar.gz - cp -fp bazel-bin/cmd/kops-controller/image-bundle.tar.gz.sha256 ${BAZELIMAGES}/kops-controller.tar.gz.sha256 + DOCKER_REGISTRY="" DOCKER_IMAGE_PREFIX="kope/" KOPS_CONTROLLER_TAG=${KOPS_CONTROLLER_TAG} bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/kops-controller:image-bundle-amd64.tar.gz.sha256 + DOCKER_REGISTRY="" DOCKER_IMAGE_PREFIX="kope/" KOPS_CONTROLLER_TAG=${KOPS_CONTROLLER_TAG} bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //cmd/kops-controller:image-bundle-arm64.tar.gz.sha256 + cp -fp bazel-bin/cmd/kops-controller/image-bundle-amd64.tar.gz ${BAZELIMAGES}/kops-controller-amd64.tar.gz + cp -fp bazel-bin/cmd/kops-controller/image-bundle-arm64.tar.gz ${BAZELIMAGES}/kops-controller-arm64.tar.gz + cp -fp bazel-bin/cmd/kops-controller/image-bundle-amd64.tar.gz.sha256 ${BAZELIMAGES}/kops-controller-amd64.tar.gz.sha256 + cp -fp bazel-bin/cmd/kops-controller/image-bundle-arm64.tar.gz.sha256 ${BAZELIMAGES}/kops-controller-arm64.tar.gz.sha256 .PHONY: bazel-dns-controller-export bazel-dns-controller-export: mkdir -p ${BAZELIMAGES} - DOCKER_REGISTRY="" DOCKER_IMAGE_PREFIX="kope/" DNS_CONTROLLER_TAG=${DNS_CONTROLLER_TAG} bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //dns-controller/cmd/dns-controller:image-bundle.tar.gz //dns-controller/cmd/dns-controller:image-bundle.tar.gz.sha256 - cp -fp bazel-bin/dns-controller/cmd/dns-controller/image-bundle.tar.gz ${BAZELIMAGES}/dns-controller.tar.gz - cp -fp bazel-bin/dns-controller/cmd/dns-controller/image-bundle.tar.gz.sha256 ${BAZELIMAGES}/dns-controller.tar.gz.sha256 + DOCKER_REGISTRY="" DOCKER_IMAGE_PREFIX="kope/" DNS_CONTROLLER_TAG=${DNS_CONTROLLER_TAG} bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //dns-controller/cmd/dns-controller:image-bundle-amd64.tar.gz.sha256 + DOCKER_REGISTRY="" DOCKER_IMAGE_PREFIX="kope/" DNS_CONTROLLER_TAG=${DNS_CONTROLLER_TAG} bazel build ${BAZEL_CONFIG} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //dns-controller/cmd/dns-controller:image-bundle-arm64.tar.gz.sha256 + cp -fp bazel-bin/dns-controller/cmd/dns-controller/image-bundle-amd64.tar.gz ${BAZELIMAGES}/dns-controller-amd64.tar.gz + cp -fp bazel-bin/dns-controller/cmd/dns-controller/image-bundle-arm64.tar.gz ${BAZELIMAGES}/dns-controller-arm64.tar.gz + cp -fp bazel-bin/dns-controller/cmd/dns-controller/image-bundle-amd64.tar.gz.sha256 ${BAZELIMAGES}/dns-controller-amd64.tar.gz.sha256 + cp -fp bazel-bin/dns-controller/cmd/dns-controller/image-bundle-arm64.tar.gz.sha256 ${BAZELIMAGES}/dns-controller-arm64.tar.gz.sha256 .PHONY: bazel-version-dist bazel-version-dist: bazel-crossbuild-nodeup bazel-crossbuild-kops bazel-kops-controller-export bazel-kube-apiserver-healthcheck-export bazel-dns-controller-export bazel-protokube-export @@ -753,14 +776,22 @@ bazel-version-dist: bazel-crossbuild-nodeup bazel-crossbuild-kops bazel-kops-con mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/ cp bazel-bin/cmd/nodeup/linux_arm64_pure_stripped/nodeup ${BAZELUPLOAD}/kops/${VERSION}/linux/arm64/nodeup 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.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube.tar.gz.sha256 - cp ${BAZELIMAGES}/kops-controller.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller.tar.gz - cp ${BAZELIMAGES}/kops-controller.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller.tar.gz.sha256 - cp ${BAZELIMAGES}/kube-apiserver-healthcheck.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck.tar.gz - cp ${BAZELIMAGES}/kube-apiserver-healthcheck.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck.tar.gz.sha256 - cp ${BAZELIMAGES}/dns-controller.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller.tar.gz - cp ${BAZELIMAGES}/dns-controller.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller.tar.gz.sha256 + cp ${BAZELIMAGES}/protokube-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-amd64.tar.gz + cp ${BAZELIMAGES}/protokube-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-amd64.tar.gz.sha256 + cp ${BAZELIMAGES}/protokube-arm64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-arm64.tar.gz + cp ${BAZELIMAGES}/protokube-arm64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-arm64.tar.gz.sha256 + cp ${BAZELIMAGES}/kops-controller-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-amd64.tar.gz + cp ${BAZELIMAGES}/kops-controller-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-amd64.tar.gz.sha256 + cp ${BAZELIMAGES}/kops-controller-arm64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-arm64.tar.gz + cp ${BAZELIMAGES}/kops-controller-arm64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-arm64.tar.gz.sha256 + cp ${BAZELIMAGES}/kube-apiserver-healthcheck-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-amd64.tar.gz + cp ${BAZELIMAGES}/kube-apiserver-healthcheck-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-amd64.tar.gz.sha256 + cp ${BAZELIMAGES}/kube-apiserver-healthcheck-arm64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-arm64.tar.gz + cp ${BAZELIMAGES}/kube-apiserver-healthcheck-arm64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-arm64.tar.gz.sha256 + cp ${BAZELIMAGES}/dns-controller-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-amd64.tar.gz + cp ${BAZELIMAGES}/dns-controller-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-amd64.tar.gz.sha256 + cp ${BAZELIMAGES}/dns-controller-arm64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-arm64.tar.gz + cp ${BAZELIMAGES}/dns-controller-arm64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-arm64.tar.gz.sha256 cp bazel-bin/cmd/kops/linux_amd64_pure_stripped/kops ${BAZELUPLOAD}/kops/${VERSION}/linux/amd64/kops 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 @@ -817,32 +848,32 @@ dev-upload-nodeup: bazel-crossbuild-nodeup .PHONY: dev-upload-protokube dev-upload-protokube: bazel-protokube-export # Upload kops to GCS mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/images/ - cp -fp ${BAZELIMAGES}/protokube.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/protokube.tar.gz - cp -fp ${BAZELIMAGES}/protokube.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube.tar.gz.sha256 + cp -fp ${BAZELIMAGES}/protokube-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-amd64.tar.gz + cp -fp ${BAZELIMAGES}/protokube-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/protokube-amd64.tar.gz.sha256 ${UPLOAD_CMD} ${BAZELUPLOAD}/ ${UPLOAD_DEST} # dev-upload-kops-controller uploads kops-controller to GCS .PHONY: dev-upload-kops-controller dev-upload-kops-controller: bazel-kops-controller-export # Upload kops to GCS mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/images/ - cp -fp ${BAZELIMAGES}/kops-controller.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller.tar.gz - cp -fp ${BAZELIMAGES}/kops-controller.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller.tar.gz.sha256 + cp -fp ${BAZELIMAGES}/kops-controller-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-amd64.tar.gz + cp -fp ${BAZELIMAGES}/kops-controller-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kops-controller-amd64.tar.gz.sha256 ${UPLOAD_CMD} ${BAZELUPLOAD}/ ${UPLOAD_DEST} # dev-upload-dns-controller uploads dns-controller to GCS .PHONY: dev-upload-dns-controller dev-upload-dns-controller: bazel-dns-controller-export # Upload kops to GCS mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/images/ - cp -fp ${BAZELIMAGES}/dns-controller.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller.tar.gz - cp -fp ${BAZELIMAGES}/dns-controller.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller.tar.gz.sha256 + cp -fp ${BAZELIMAGES}/dns-controller-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-amd64.tar.gz + cp -fp ${BAZELIMAGES}/dns-controller-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/dns-controller-amd64.tar.gz.sha256 ${UPLOAD_CMD} ${BAZELUPLOAD}/ ${UPLOAD_DEST} # dev-upload-kube-apiserver-healthcheck uploads kube-apiserver-healthcheck to GCS .PHONY: dev-upload-kube-apiserver-healthcheck dev-upload-kube-apiserver-healthcheck: bazel-kube-apiserver-healthcheck-export # Upload kops to GCS mkdir -p ${BAZELUPLOAD}/kops/${VERSION}/images/ - cp -fp ${BAZELIMAGES}/kube-apiserver-healthcheck.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck.tar.gz - cp -fp ${BAZELIMAGES}/kube-apiserver-healthcheck.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck.tar.gz.sha256 + cp -fp ${BAZELIMAGES}/kube-apiserver-healthcheck-amd64.tar.gz ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-amd64.tar.gz + cp -fp ${BAZELIMAGES}/kube-apiserver-healthcheck-amd64.tar.gz.sha256 ${BAZELUPLOAD}/kops/${VERSION}/images/kube-apiserver-healthcheck-amd64.tar.gz.sha256 ${UPLOAD_CMD} ${BAZELUPLOAD}/ ${UPLOAD_DEST} # dev-upload does a faster build and uploads to GCS / S3 @@ -866,4 +897,4 @@ kops-controller-push: .PHONY: kube-apiserver-healthcheck-push kube-apiserver-healthcheck-push: - DOCKER_REGISTRY=${DOCKER_REGISTRY} DOCKER_IMAGE_PREFIX=${DOCKER_IMAGE_PREFIX} KUBE_APISERVER_HEALTHCHECK_TAG=${KUBE_APISERVER_HEALTHCHECK_TAG} bazel run --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/kube-apiserver-healthcheck:push-image + DOCKER_REGISTRY=${DOCKER_REGISTRY} DOCKER_IMAGE_PREFIX=${DOCKER_IMAGE_PREFIX} KUBE_APISERVER_HEALTHCHECK_TAG=${KUBE_APISERVER_HEALTHCHECK_TAG} bazel run --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/kube-apiserver-healthcheck:push-image-amd64 diff --git a/cmd/kops-controller/BUILD.bazel b/cmd/kops-controller/BUILD.bazel index ac98455a9d149..12e3abbfbe731 100644 --- a/cmd/kops-controller/BUILD.bazel +++ b/cmd/kops-controller/BUILD.bazel @@ -33,48 +33,53 @@ go_binary( load( "@io_bazel_rules_docker//container:container.bzl", "container_image", - "container_push", "container_bundle", + "container_push", ) -container_image( - name = "image", +ARCH = [ + "amd64", + "arm64", +] + +[container_image( + name = "image-%s" % arch, + architecture = arch, base = "@distroless_base//image", - cmd = ["/usr/bin/kops-controller"], + cmd = ["/kops-controller"], user = "10001", - directory = "/usr/bin/", files = [ "//cmd/kops-controller", ], stamp = True, -) - -container_push( - name = "push-image", - format = "Docker", - image = ":image", - registry = "{STABLE_DOCKER_REGISTRY}", - repository = "{STABLE_DOCKER_IMAGE_PREFIX}kops-controller", - tag = "{STABLE_KOPS_CONTROLLER_TAG}", -) +) for arch in ARCH] -container_bundle( - name = "image-bundle", +[container_bundle( + name = "image-bundle-%s" % arch, images = { - "{STABLE_DOCKER_IMAGE_PREFIX}kops-controller:{STABLE_KOPS_CONTROLLER_TAG}": "image", + "{STABLE_DOCKER_IMAGE_PREFIX}kops-controller:{STABLE_KOPS_CONTROLLER_TAG}": "image-%s" % arch, }, -) +) for arch in ARCH] load("//tools:gzip.bzl", "gzip") -gzip( - name = "image-bundle.tar.gz", - src = "image-bundle.tar", -) +[gzip( + name = "image-bundle-%s.tar.gz" % arch, + src = "image-bundle-%s.tar" % arch, +) for arch in ARCH] load("//tools:hashes.bzl", "hashes") -hashes( - name = "image-bundle.tar.gz.hashes", - src = "image-bundle.tar.gz", -) +[hashes( + name = "image-bundle-%s.tar.gz.hashes" % arch, + src = "image-bundle-%s.tar.gz" % arch, +) for arch in ARCH] + +[container_push( + name = "push-image-%s" % arch, + format = "Docker", + image = ":image-%s" % arch, + registry = "{STABLE_DOCKER_REGISTRY}", + repository = "{STABLE_DOCKER_IMAGE_PREFIX}kops-controller", + tag = "{STABLE_KOPS_CONTROLLER_TAG}-%s" % arch, +) for arch in ARCH] diff --git a/cmd/kube-apiserver-healthcheck/BUILD.bazel b/cmd/kube-apiserver-healthcheck/BUILD.bazel index e80718cc070f3..403e45acfe47f 100644 --- a/cmd/kube-apiserver-healthcheck/BUILD.bazel +++ b/cmd/kube-apiserver-healthcheck/BUILD.bazel @@ -11,6 +11,12 @@ go_library( ], ) +go_test( + name = "go_default_test", + srcs = ["proxy_test.go"], + embed = [":go_default_library"], +) + go_binary( name = "kube-apiserver-healthcheck", embed = [":go_default_library"], @@ -20,54 +26,53 @@ go_binary( load( "@io_bazel_rules_docker//container:container.bzl", "container_image", - "container_push", "container_bundle", + "container_push", ) -container_image( - name = "image", +ARCH = [ + "amd64", + "arm64", +] + +[container_image( + name = "image-%s" % arch, + architecture = arch, base = "@distroless_base//image", - cmd = ["/usr/bin/kube-apiserver-healthcheck"], + cmd = ["/kube-apiserver-healthcheck"], user = "10012", - directory = "/usr/bin/", files = [ "//cmd/kube-apiserver-healthcheck", ], stamp = True, -) - -container_push( - name = "push-image", - format = "Docker", - image = ":image", - registry = "{STABLE_DOCKER_REGISTRY}", - repository = "{STABLE_DOCKER_IMAGE_PREFIX}kube-apiserver-healthcheck", - tag = "{STABLE_KUBE_APISERVER_HEALTHCHECK_TAG}", -) +) for arch in ARCH] -container_bundle( - name = "image-bundle", +[container_bundle( + name = "image-bundle-%s" % arch, images = { - "{STABLE_DOCKER_IMAGE_PREFIX}kube-apiserver-healthcheck:{STABLE_KUBE_APISERVER_HEALTHCHECK_TAG}": "image", + "{STABLE_DOCKER_IMAGE_PREFIX}kube-apiserver-healthcheck:{STABLE_KUBE_APISERVER_HEALTHCHECK_TAG}": "image-%s" % arch, }, -) +) for arch in ARCH] load("//tools:gzip.bzl", "gzip") -gzip( - name = "image-bundle.tar.gz", - src = "image-bundle.tar", -) +[gzip( + name = "image-bundle-%s.tar.gz" % arch, + src = "image-bundle-%s.tar" % arch, +) for arch in ARCH] load("//tools:hashes.bzl", "hashes") -hashes( - name = "image-bundle.tar.gz.hashes", - src = "image-bundle.tar.gz", -) +[hashes( + name = "image-bundle-%s.tar.gz.hashes" % arch, + src = "image-bundle-%s.tar.gz" % arch, +) for arch in ARCH] -go_test( - name = "go_default_test", - srcs = ["proxy_test.go"], - embed = [":go_default_library"], -) +[container_push( + name = "push-image-%s" % arch, + format = "Docker", + image = ":image-%s" % arch, + registry = "{STABLE_DOCKER_REGISTRY}", + repository = "{STABLE_DOCKER_IMAGE_PREFIX}kube-apiserver-healthcheck", + tag = "{STABLE_KUBE_APISERVER_HEALTHCHECK_TAG}-%s" % arch, +) for arch in ARCH] diff --git a/dns-controller/cmd/dns-controller/BUILD.bazel b/dns-controller/cmd/dns-controller/BUILD.bazel index ea26d1ce78627..f20790c53f88d 100644 --- a/dns-controller/cmd/dns-controller/BUILD.bazel +++ b/dns-controller/cmd/dns-controller/BUILD.bazel @@ -39,48 +39,53 @@ go_binary( load( "@io_bazel_rules_docker//container:container.bzl", "container_image", - "container_push", "container_bundle", + "container_push", ) -container_image( - name = "image", +ARCH = [ + "amd64", + "arm64", +] + +[container_image( + name = "image-%s" % arch, + architecture = arch, base = "@distroless_base//image", - cmd = ["/usr/bin/dns-controller"], + cmd = ["/dns-controller"], user = "10001", - directory = "/usr/bin/", files = [ - "dns-controller", + "//dns-controller/cmd/dns-controller", ], stamp = True, -) - -container_push( - name = "push-image", - format = "Docker", - image = ":image", - registry = "{STABLE_DOCKER_REGISTRY}", - repository = "{STABLE_DOCKER_IMAGE_PREFIX}dns-controller", - tag = "{STABLE_DNS_CONTROLLER_TAG}", -) +) for arch in ARCH] -container_bundle( - name = "image-bundle", +[container_bundle( + name = "image-bundle-%s" % arch, images = { - "{STABLE_DOCKER_IMAGE_PREFIX}dns-controller:{STABLE_DNS_CONTROLLER_TAG}": "image", + "{STABLE_DOCKER_IMAGE_PREFIX}dns-controller:{STABLE_DNS_CONTROLLER_TAG}": "image-%s" % arch, }, -) +) for arch in ARCH] load("//tools:gzip.bzl", "gzip") -gzip( - name = "image-bundle.tar.gz", - src = "image-bundle.tar", -) +[gzip( + name = "image-bundle-%s.tar.gz" % arch, + src = "image-bundle-%s.tar" % arch, +) for arch in ARCH] load("//tools:hashes.bzl", "hashes") -hashes( - name = "image-bundle.tar.gz.hashes", - src = "image-bundle.tar.gz", -) +[hashes( + name = "image-bundle-%s.tar.gz.hashes" % arch, + src = "image-bundle-%s.tar.gz" % arch, +) for arch in ARCH] + +[container_push( + name = "push-image-%s" % arch, + format = "Docker", + image = ":image-%s" % arch, + registry = "{STABLE_DOCKER_REGISTRY}", + repository = "{STABLE_DOCKER_IMAGE_PREFIX}dns-controller", + tag = "{STABLE_DNS_CONTROLLER_TAG}-%s" % arch, +) for arch in ARCH] diff --git a/images/BUILD.bazel b/images/BUILD.bazel deleted file mode 100644 index e81414330346d..0000000000000 --- a/images/BUILD.bazel +++ /dev/null @@ -1,50 +0,0 @@ -package(default_visibility = ["//visibility:public"]) - -load( - "@io_bazel_rules_docker//container:container.bzl", - "container_image", - "container_bundle", -) - -container_image( - name = "protokube-image", - base = "@distroless_base//image", - cmd = ["/protokube"], - files = [ - "//channels/cmd/channels", - "//protokube/cmd/protokube", - ], - stamp = True, -) - -container_bundle( - name = "protokube", - images = { - "protokube:{STABLE_PROTOKUBE_TAG}": "protokube-image", - }, -) - -load("//tools:gzip.bzl", "gzip") - -gzip( - name = "protokube.tar.gz", - src = "protokube.tar", -) - -load("//tools:hashes.bzl", "hashes") - -hashes( - name = "protokube.tar.gz.hashes", - src = "protokube.tar.gz", -) - -container_image( - name = "kops-controller", - base = "@distroless_base//image", - cmd = ["/usr/bin/kops-controller"], - directory = "/usr/bin/", - files = [ - "//cmd/kops-controller", - ], - stamp = True, -) diff --git a/nodeup/pkg/model/protokube.go b/nodeup/pkg/model/protokube.go index e583e938d65f7..82149721c5c3e 100644 --- a/nodeup/pkg/model/protokube.go +++ b/nodeup/pkg/model/protokube.go @@ -56,7 +56,7 @@ func (t *ProtokubeBuilder) Build(c *fi.ModelBuilderContext) error { return nil } - if protokubeImage := t.NodeupConfig.ProtokubeImage; protokubeImage != nil { + if protokubeImage := t.NodeupConfig.ProtokubeImage[t.Architecture]; protokubeImage != nil { c.AddTask(&nodetasks.LoadImageTask{ Name: "protokube", Sources: protokubeImage.Sources, @@ -166,8 +166,8 @@ func (t *ProtokubeBuilder) buildSystemdService() (*nodetasks.Service, error) { // ProtokubeImageName returns the docker image for protokube func (t *ProtokubeBuilder) ProtokubeImageName() string { name := "" - if t.NodeupConfig.ProtokubeImage != nil && t.NodeupConfig.ProtokubeImage.Name != "" { - name = t.NodeupConfig.ProtokubeImage.Name + if t.NodeupConfig.ProtokubeImage[t.Architecture] != nil && t.NodeupConfig.ProtokubeImage[t.Architecture].Name != "" { + name = t.NodeupConfig.ProtokubeImage[t.Architecture].Name } if name == "" { // use current default corresponding to this version of nodeup @@ -179,8 +179,8 @@ func (t *ProtokubeBuilder) ProtokubeImageName() string { // ProtokubeImagePullCommand returns the command to pull the image func (t *ProtokubeBuilder) ProtokubeImagePullCommand() (string, error) { var sources []string - if t.NodeupConfig.ProtokubeImage != nil { - sources = t.NodeupConfig.ProtokubeImage.Sources + if t.NodeupConfig.ProtokubeImage[t.Architecture] != nil { + sources = t.NodeupConfig.ProtokubeImage[t.Architecture].Sources } if len(sources) == 0 { // Nothing to pull; return dummy value diff --git a/nodeup/pkg/model/protokube_test.go b/nodeup/pkg/model/protokube_test.go index f1a8ca3b7adb9..72067e587a5df 100644 --- a/nodeup/pkg/model/protokube_test.go +++ b/nodeup/pkg/model/protokube_test.go @@ -21,6 +21,7 @@ import ( "k8s.io/kops/pkg/apis/nodeup" "k8s.io/kops/upup/pkg/fi" + "k8s.io/kops/util/pkg/architectures" ) func TestProtokubeBuilder_Docker(t *testing.T) { @@ -43,7 +44,7 @@ func populateImage(ctx *NodeupModelContext) { if ctx.NodeupConfig == nil { ctx.NodeupConfig = &nodeup.Config{} } - ctx.NodeupConfig.ProtokubeImage = &nodeup.Image{ + ctx.NodeupConfig.ProtokubeImage[architectures.ArchitectureAmd64] = &nodeup.Image{ Name: "protokube image name", } } diff --git a/pkg/apis/nodeup/config.go b/pkg/apis/nodeup/config.go index dbba9474a0c17..dd865b70c29d4 100644 --- a/pkg/apis/nodeup/config.go +++ b/pkg/apis/nodeup/config.go @@ -46,7 +46,7 @@ type Config struct { // ClusterName is the name of the cluster ClusterName string `json:",omitempty"` // ProtokubeImage is the docker image to load for protokube (bootstrapping) - ProtokubeImage *Image `json:"protokubeImage,omitempty"` + ProtokubeImage map[architectures.Architecture]*Image `json:"protokubeImage,omitempty"` // Channels is a list of channels that we should apply Channels []string `json:"channels,omitempty"` // ApiserverAdditionalIPs are additional IP address to put in the apiserver server cert. diff --git a/pkg/model/components/kubeapiserver/model.go b/pkg/model/components/kubeapiserver/model.go index d3ad555ba88ee..17cce0ec7697b 100644 --- a/pkg/model/components/kubeapiserver/model.go +++ b/pkg/model/components/kubeapiserver/model.go @@ -106,7 +106,7 @@ spec: initialDelaySeconds: 5 timeoutSeconds: 5 command: - - /usr/bin/kube-apiserver-healthcheck + - /kube-apiserver-healthcheck args: - --ca-cert=/secrets/ca.crt - --client-cert=/secrets/client.crt diff --git a/protokube/cmd/protokube/BUILD.bazel b/protokube/cmd/protokube/BUILD.bazel index 02dce985946a9..c6be450c218ed 100644 --- a/protokube/cmd/protokube/BUILD.bazel +++ b/protokube/cmd/protokube/BUILD.bazel @@ -1,3 +1,5 @@ +package(default_visibility = ["//visibility:public"]) + load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") go_library( @@ -30,3 +32,47 @@ go_binary( embed = [":go_default_library"], visibility = ["//visibility:public"], ) + +load( + "@io_bazel_rules_docker//container:container.bzl", + "container_image", + "container_bundle", +) + +ARCH = [ + "amd64", + "arm64", +] + +[container_image( + name = "image-%s" % arch, + architecture = arch, + base = "@distroless_base//image", + cmd = ["/protokube"], + files = [ + "//channels/cmd/channels", + "//protokube/cmd/protokube", + ], + stamp = True, +) for arch in ARCH] + +[container_bundle( + name = "image-bundle-%s" % arch, + images = { + "protokube:{STABLE_PROTOKUBE_TAG}": "image-%s" % arch, + }, +) for arch in ARCH] + +load("//tools:gzip.bzl", "gzip") + +[gzip( + name = "image-bundle-%s.tar.gz" % arch, + src = "image-bundle-%s.tar" % arch, +) for arch in ARCH] + +load("//tools:hashes.bzl", "hashes") + +[hashes( + name = "image-bundle-%s.tar.gz.hashes" % arch, + src = "image-bundle-%s.tar.gz" % arch, +) for arch in ARCH] diff --git a/upup/pkg/fi/cloudup/apply_cluster.go b/upup/pkg/fi/cloudup/apply_cluster.go index 10d3f794826a5..c5ac52c8f4bf3 100644 --- a/upup/pkg/fi/cloudup/apply_cluster.go +++ b/upup/pkg/fi/cloudup/apply_cluster.go @@ -998,7 +998,6 @@ func (c *ApplyClusterCmd) validateKubernetesVersion() error { func (c *ApplyClusterCmd) addFileAssets(assetBuilder *assets.AssetBuilder) error { var baseURL string - var err error if components.IsBaseURL(c.Cluster.Spec.KubernetesVersion) { baseURL = c.Cluster.Spec.KubernetesVersion } else { @@ -1084,14 +1083,14 @@ func (c *ApplyClusterCmd) addFileAssets(assetBuilder *assets.AssetBuilder) error } c.NodeUpSource[arch] = strings.Join(asset.Locations, ",") c.NodeUpHash[arch] = asset.Hash.Hex() - } - // Explicitly add the protokube image, - // otherwise when the Target is DryRun this asset is not added - // Is there a better way to call this? - _, _, err = ProtokubeImageSource(assetBuilder) - if err != nil { - return err + // Explicitly add the protokube image, + // otherwise when the Target is DryRun this asset is not added + // Is there a better way to call this? + _, _, err = ProtokubeImageSource(assetBuilder, arch) + if err != nil { + return err + } } return nil @@ -1135,7 +1134,7 @@ type nodeUpConfigBuilder struct { etcdManifests map[kops.InstanceGroupRole][]string images map[kops.InstanceGroupRole]map[architectures.Architecture][]*nodeup.Image nodeUpTags []string - protokubeImage map[kops.InstanceGroupRole]*nodeup.Image + protokubeImage map[kops.InstanceGroupRole]map[architectures.Architecture]*nodeup.Image } func (c *ApplyClusterCmd) newNodeUpConfigBuilder(assetBuilder *assets.AssetBuilder) (model.NodeUpConfigBuilder, error) { @@ -1169,7 +1168,7 @@ func (c *ApplyClusterCmd) newNodeUpConfigBuilder(assetBuilder *assets.AssetBuild etcdManifests := map[kops.InstanceGroupRole][]string{} images := map[kops.InstanceGroupRole]map[architectures.Architecture][]*nodeup.Image{} - protokubeImage := map[kops.InstanceGroupRole]*nodeup.Image{} + protokubeImage := map[kops.InstanceGroupRole]map[architectures.Architecture]*nodeup.Image{} for _, role := range kops.AllInstanceGroupRoles { isMaster := role == kops.InstanceGroupRoleMaster @@ -1209,18 +1208,13 @@ func (c *ApplyClusterCmd) newNodeUpConfigBuilder(assetBuilder *assets.AssetBuild // don't need to push/pull from a registry if os.Getenv("KOPS_BASE_URL") != "" && isMaster { for _, arch := range architectures.GetSupported() { - // TODO: Build multi-arch Kops images - if arch != architectures.ArchitectureAmd64 { - continue - } - for _, name := range []string{"kops-controller", "dns-controller", "kube-apiserver-healthcheck"} { baseURL, err := url.Parse(os.Getenv("KOPS_BASE_URL")) if err != nil { return nil, err } - baseURL.Path = path.Join(baseURL.Path, "/images/"+name+".tar.gz") + baseURL.Path = path.Join(baseURL.Path, "/images/"+name+"-"+string(arch)+".tar.gz") u, hash, err := assetBuilder.RemapFileAndSHA(baseURL) if err != nil { @@ -1237,17 +1231,20 @@ func (c *ApplyClusterCmd) newNodeUpConfigBuilder(assetBuilder *assets.AssetBuild } if isMaster || useGossip { - u, hash, err := ProtokubeImageSource(assetBuilder) - if err != nil { - return nil, err - } + protokubeImage[role] = make(map[architectures.Architecture]*nodeup.Image) + for _, arch := range architectures.GetSupported() { + u, hash, err := ProtokubeImageSource(assetBuilder, arch) + if err != nil { + return nil, err + } - asset := BuildMirroredAsset(u, hash) + asset := BuildMirroredAsset(u, hash) - protokubeImage[role] = &nodeup.Image{ - Name: kopsbase.DefaultProtokubeImageName(), - Sources: asset.Locations, - Hash: asset.Hash.Hex(), + protokubeImage[role][arch] = &nodeup.Image{ + Name: kopsbase.DefaultProtokubeImageName(), + Sources: asset.Locations, + Hash: asset.Hash.Hex(), + } } } diff --git a/upup/pkg/fi/cloudup/template_functions.go b/upup/pkg/fi/cloudup/template_functions.go index 3314ede6699c6..044f13d366f84 100644 --- a/upup/pkg/fi/cloudup/template_functions.go +++ b/upup/pkg/fi/cloudup/template_functions.go @@ -274,7 +274,7 @@ func (tf *TemplateFunctions) DNSControllerArgv() ([]string, error) { var argv []string - argv = append(argv, "/usr/bin/dns-controller") + argv = append(argv, "/dns-controller") // @check if the dns controller has custom configuration if cluster.Spec.ExternalDNS == nil { @@ -402,7 +402,7 @@ func (tf *TemplateFunctions) KopsControllerConfig() (string, error) { func (tf *TemplateFunctions) KopsControllerArgv() ([]string, error) { var argv []string - argv = append(argv, "/usr/bin/kops-controller") + argv = append(argv, "/kops-controller") // Verbose, but not excessive logging argv = append(argv, "--v=2") diff --git a/upup/pkg/fi/cloudup/urls.go b/upup/pkg/fi/cloudup/urls.go index 6f2e07246f159..b9d9a72a21799 100644 --- a/upup/pkg/fi/cloudup/urls.go +++ b/upup/pkg/fi/cloudup/urls.go @@ -61,10 +61,10 @@ var kopsBaseURL *url.URL var nodeUpAsset map[architectures.Architecture]*MirroredAsset // protokubeLocation caches the protokubeLocation url -var protokubeLocation *url.URL +var protokubeLocation map[architectures.Architecture]*url.URL // protokubeHash caches the hash for protokube -var protokubeHash *hashing.Hash +var protokubeHash map[architectures.Architecture]*hashing.Hash // BaseURL returns the base url for the distribution of kops - in particular for nodeup & docker images func BaseURL() (*url.URL, error) { @@ -122,7 +122,8 @@ func SetKopsAssetsLocations(assetsBuilder *assets.AssetBuilder) error { func NodeUpAsset(assetsBuilder *assets.AssetBuilder, arch architectures.Architecture) (*MirroredAsset, error) { if nodeUpAsset == nil { nodeUpAsset = make(map[architectures.Architecture]*MirroredAsset) - } else if nodeUpAsset[arch] != nil { + } + if nodeUpAsset[arch] != nil { // Avoid repeated logging klog.V(8).Infof("Using cached nodeup location for %s: %v", arch, nodeUpAsset[arch].Locations) return nodeUpAsset[arch], nil @@ -168,34 +169,44 @@ func NodeUpAsset(assetsBuilder *assets.AssetBuilder, arch architectures.Architec // ProtokubeImageSource returns the source for the docker image for protokube. // Either a docker name (e.g. gcr.io/protokube:1.4), or a URL (https://...) in which case we download // the contents of the url and docker load it -func ProtokubeImageSource(assetsBuilder *assets.AssetBuilder) (*url.URL, *hashing.Hash, error) { - // Avoid repeated logging - if protokubeLocation != nil && protokubeHash != nil { - klog.V(8).Infof("Using cached protokube location: %q", protokubeLocation) - return protokubeLocation, protokubeHash, nil +func ProtokubeImageSource(assetsBuilder *assets.AssetBuilder, arch architectures.Architecture) (*url.URL, *hashing.Hash, error) { + if protokubeLocation == nil { + protokubeLocation = make(map[architectures.Architecture]*url.URL) + } + if protokubeHash == nil { + protokubeHash = make(map[architectures.Architecture]*hashing.Hash) + } + if nodeUpAsset[arch] != nil && protokubeHash[arch] != nil { + // Avoid repeated logging + klog.V(8).Infof("Using cached protokube location for %s: %q", arch, protokubeLocation[arch]) + return protokubeLocation[arch], protokubeHash[arch], nil + } + // Use multi-arch env var, but fall back to well known env var + env := os.Getenv(fmt.Sprintf("PROTOKUBE_IMAGE_%s", strings.ToUpper(string(arch)))) + if env == "" { + env = os.Getenv("PROTOKUBE_IMAGE") } - env := os.Getenv("PROTOKUBE_IMAGE") var err error if env == "" { - protokubeLocation, protokubeHash, err = KopsFileURL("images/protokube.tar.gz", assetsBuilder) + protokubeLocation[arch], protokubeHash[arch], err = KopsFileURL(fmt.Sprintf("images/protokube-%s.tar.gz", arch), assetsBuilder) if err != nil { return nil, nil, err } - klog.V(8).Infof("Using default protokube location: %q", protokubeLocation) + klog.V(8).Infof("Using default protokube location: %q", protokubeLocation[arch]) } else { protokubeImageSource, err := url.Parse(env) if err != nil { - return nil, nil, fmt.Errorf("unable to parse env var PROTOKUBE_IMAGE %q as a url: %v", env, err) + return nil, nil, fmt.Errorf("unable to parse env var PROTOKUBE_IMAGE(_%s) %q as a url: %v", strings.ToUpper(string(arch)), env, err) } - protokubeLocation, protokubeHash, err = assetsBuilder.RemapFileAndSHA(protokubeImageSource) + protokubeLocation[arch], protokubeHash[arch], err = assetsBuilder.RemapFileAndSHA(protokubeImageSource) if err != nil { return nil, nil, err } - klog.Warningf("Using protokube location from PROTOKUBE_IMAGE env var: %q", protokubeLocation) + klog.Warningf("Using protokube location from PROTOKUBE_IMAGE(_%s) env var: %q", strings.ToUpper(string(arch)), protokubeLocation[arch]) } - return protokubeLocation, protokubeHash, nil + return protokubeLocation[arch], protokubeHash[arch], nil } // KopsFileURL returns the base url for the distribution of kops - in particular for nodeup & docker images