mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 02:11:09 +00:00
add make targets for building server images
This commit is contained in:
parent
83030032ad
commit
037fabd842
@ -90,7 +90,7 @@ readonly KUBE_CONTAINER_RSYNC_PORT=8730
|
|||||||
kube::build::get_docker_wrapped_binaries() {
|
kube::build::get_docker_wrapped_binaries() {
|
||||||
debian_iptables_version=v10.1
|
debian_iptables_version=v10.1
|
||||||
### If you change any of these lists, please also update DOCKERIZED_BINARIES
|
### If you change any of these lists, please also update DOCKERIZED_BINARIES
|
||||||
### in build/BUILD.
|
### in build/BUILD. And kube::golang::server_image_targets
|
||||||
case $1 in
|
case $1 in
|
||||||
"amd64")
|
"amd64")
|
||||||
local targets=(
|
local targets=(
|
||||||
|
@ -193,6 +193,36 @@ function kube::release::package_node_tarballs() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Package up all of the server binaries in docker images
|
||||||
|
function kube::release::build_server_images() {
|
||||||
|
# Clean out any old images
|
||||||
|
rm -rf "${RELEASE_IMAGES}"
|
||||||
|
local platform
|
||||||
|
for platform in "${KUBE_SERVER_PLATFORMS[@]}"; do
|
||||||
|
local platform_tag=${platform/\//-} # Replace a "/" for a "-"
|
||||||
|
local arch=$(basename "${platform}")
|
||||||
|
kube::log::status "Building images: $platform_tag"
|
||||||
|
|
||||||
|
local release_stage="${RELEASE_STAGE}/server/${platform_tag}/kubernetes"
|
||||||
|
rm -rf "${release_stage}"
|
||||||
|
mkdir -p "${release_stage}/server/bin"
|
||||||
|
mkdir -p "${release_stage}/addons"
|
||||||
|
|
||||||
|
# This fancy expression will expand to prepend a path
|
||||||
|
# (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the
|
||||||
|
# KUBE_SERVER_IMAGE_BINARIES array.
|
||||||
|
cp "${KUBE_SERVER_IMAGE_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \
|
||||||
|
"${release_stage}/server/bin/"
|
||||||
|
|
||||||
|
# if we are building hyperkube, we also need to copy that binary
|
||||||
|
if [[ "${KUBE_BUILD_HYPERKUBE}" =~ [yY] ]]; then
|
||||||
|
cp "${LOCAL_OUTPUT_BINPATH}/${platform}/hyperkube" "${release_stage}/server/bin"
|
||||||
|
fi
|
||||||
|
|
||||||
|
kube::release::create_docker_images_for_server "${release_stage}/server/bin" "${arch}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Package up all of the server binaries
|
# Package up all of the server binaries
|
||||||
function kube::release::package_server_tarballs() {
|
function kube::release::package_server_tarballs() {
|
||||||
local platform
|
local platform
|
||||||
|
39
build/release-images.sh
Executable file
39
build/release-images.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright 2018 The Kubernetes Authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# Build Kubernetes release images. This will build the server target binaries,
|
||||||
|
# and create wrap them in Docker images, see `make release` for full releases
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||||
|
source "${KUBE_ROOT}/build/common.sh"
|
||||||
|
source "${KUBE_ROOT}/build/lib/release.sh"
|
||||||
|
|
||||||
|
CMD_TARGETS="${KUBE_SERVER_IMAGE_TARGETS[*]}"
|
||||||
|
if [[ "${KUBE_BUILD_HYPERKUBE}" =~ [yY] ]]; then
|
||||||
|
CMD_TARGETS="${CMD_TARGETS} cmd/hyperkube"
|
||||||
|
fi
|
||||||
|
|
||||||
|
kube::build::verify_prereqs
|
||||||
|
kube::build::build_image
|
||||||
|
kube::build::run_build_command make all WHAT="${CMD_TARGETS}" KUBE_BUILD_PLATFORMS="${KUBE_SERVER_PLATFORMS[*]}"
|
||||||
|
|
||||||
|
kube::build::copy_output
|
||||||
|
|
||||||
|
kube::release::build_server_images
|
@ -386,6 +386,24 @@ release-in-a-container:
|
|||||||
build/release-in-a-container.sh
|
build/release-in-a-container.sh
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
define RELEASE_IMAGES_HELP_INFO
|
||||||
|
# Build release images
|
||||||
|
#
|
||||||
|
# Args:
|
||||||
|
# KUBE_BUILD_HYPERKUBE: Whether to build hyperkube image as well. Set to 'n' to skip.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# make release-images
|
||||||
|
endef
|
||||||
|
.PHONY: release-images
|
||||||
|
ifeq ($(PRINT_HELP),y)
|
||||||
|
release-images:
|
||||||
|
@echo "$$RELEASE_IMAGES_HELP_INFO"
|
||||||
|
else
|
||||||
|
release-images:
|
||||||
|
build/release-images.sh
|
||||||
|
endif
|
||||||
|
|
||||||
define RELEASE_SKIP_TESTS_HELP_INFO
|
define RELEASE_SKIP_TESTS_HELP_INFO
|
||||||
# Build a release, but skip tests
|
# Build a release, but skip tests
|
||||||
#
|
#
|
||||||
@ -408,6 +426,26 @@ release-skip-tests quick-release:
|
|||||||
build/release.sh
|
build/release.sh
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
define QUICK_RELEASE_IMAGES_HELP_INFO
|
||||||
|
# Build release images, but only for linux/amd64
|
||||||
|
#
|
||||||
|
# Args:
|
||||||
|
# KUBE_FASTBUILD: Whether to cross-compile for other architectures. Set to 'false' to do so.
|
||||||
|
# KUBE_BUILD_HYPERKUBE: Whether to build hyperkube image as well. Set to 'n' to skip.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# make quick-release-images
|
||||||
|
endef
|
||||||
|
.PHONY: quick-release-images
|
||||||
|
ifeq ($(PRINT_HELP),y)
|
||||||
|
quick-release-images:
|
||||||
|
@echo "$$QUICK_RELEASE_IMAGES_HELP_INFO"
|
||||||
|
else
|
||||||
|
quick-release-images: KUBE_FASTBUILD = true
|
||||||
|
quick-release-images:
|
||||||
|
build/release-images.sh
|
||||||
|
endif
|
||||||
|
|
||||||
define PACKAGE_HELP_INFO
|
define PACKAGE_HELP_INFO
|
||||||
# Package tarballs
|
# Package tarballs
|
||||||
# Use the 'package-tarballs' target to run the final packaging steps of
|
# Use the 'package-tarballs' target to run the final packaging steps of
|
||||||
|
@ -40,6 +40,23 @@ IFS=" " read -ra KUBE_SERVER_TARGETS <<< "$(kube::golang::server_targets)"
|
|||||||
readonly KUBE_SERVER_TARGETS
|
readonly KUBE_SERVER_TARGETS
|
||||||
readonly KUBE_SERVER_BINARIES=("${KUBE_SERVER_TARGETS[@]##*/}")
|
readonly KUBE_SERVER_BINARIES=("${KUBE_SERVER_TARGETS[@]##*/}")
|
||||||
|
|
||||||
|
# The set of server targets we build docker images for
|
||||||
|
kube::golang::server_image_targets() {
|
||||||
|
# NOTE: this contains cmd targets for kube::build::get_docker_wrapped_binaries
|
||||||
|
local targets=(
|
||||||
|
cmd/cloud-controller-manager
|
||||||
|
cmd/kube-apiserver
|
||||||
|
cmd/kube-controller-manager
|
||||||
|
cmd/kube-scheduler
|
||||||
|
cmd/kube-proxy
|
||||||
|
)
|
||||||
|
echo "${targets[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
IFS=" " read -ra KUBE_SERVER_IMAGE_TARGETS <<< "$(kube::golang::server_image_targets)"
|
||||||
|
readonly KUBE_SERVER_IMAGE_TARGETS
|
||||||
|
readonly KUBE_SERVER_IMAGE_BINARIES=("${KUBE_SERVER_IMAGE_TARGETS[@]##*/}")
|
||||||
|
|
||||||
# The set of server targets that we are only building for Kubernetes nodes
|
# The set of server targets that we are only building for Kubernetes nodes
|
||||||
# If you update this list, please also update build/BUILD.
|
# If you update this list, please also update build/BUILD.
|
||||||
kube::golang::node_targets() {
|
kube::golang::node_targets() {
|
||||||
|
Loading…
Reference in New Issue
Block a user