mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 04:32:37 +00:00
Add kubectl to build/release scripts.
Also Refactor build helpers into client/cross and server/linux. This make it easier to tell users what to build to get just the client binaries.
This commit is contained in:
@@ -23,6 +23,19 @@ cd "${KUBE_ROOT}"
|
||||
readonly KUBE_TARGET="${KUBE_ROOT}/_output/build"
|
||||
readonly KUBE_GO_PACKAGE=github.com/GoogleCloudPlatform/kubernetes
|
||||
|
||||
server_targets=(
|
||||
cmd/proxy
|
||||
cmd/apiserver
|
||||
cmd/controller-manager
|
||||
cmd/kubelet
|
||||
plugin/cmd/scheduler
|
||||
)
|
||||
|
||||
client_targets=(
|
||||
cmd/kubecfg
|
||||
cmd/kubectl
|
||||
)
|
||||
|
||||
mkdir -p "${KUBE_TARGET}"
|
||||
|
||||
if [[ ! -f "/kube-build-image" ]]; then
|
||||
@@ -46,19 +59,11 @@ function kube::build::make_binary() {
|
||||
}
|
||||
|
||||
function kube::build::make_binaries() {
|
||||
local -a targets=(
|
||||
cmd/proxy
|
||||
cmd/apiserver
|
||||
cmd/controller-manager
|
||||
cmd/kubelet
|
||||
cmd/kubecfg
|
||||
plugin/cmd/scheduler
|
||||
)
|
||||
|
||||
if [[ -n "${1-}" ]]; then
|
||||
targets=("$1")
|
||||
fi
|
||||
[[ $# -gt 0 ]] || {
|
||||
echo "!!! Internal error. kube::build::make_binaries called with no targets."
|
||||
}
|
||||
|
||||
local -a targets=("$@")
|
||||
local -a binaries=()
|
||||
local target
|
||||
for target in "${targets[@]}"; do
|
||||
|
@@ -21,16 +21,19 @@ set -o pipefail
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/build/build-image/common.sh"
|
||||
|
||||
readonly CROSS_BINARIES=(
|
||||
./cmd/kubecfg
|
||||
)
|
||||
platforms=(linux/amd64 $KUBE_CROSSPLATFORMS)
|
||||
targets=("${client_targets[@]}")
|
||||
|
||||
for platform in ${KUBE_CROSSPLATFORMS}; do
|
||||
if [[ $# -gt 0 ]]; then
|
||||
targets=("$@")
|
||||
fi
|
||||
|
||||
for platform in "${platforms[@]}"; do
|
||||
(
|
||||
# Subshell to contain these exports
|
||||
export GOOS=${platform%/*}
|
||||
export GOARCH=${platform##*/}
|
||||
for binary in "${CROSS_BINARIES[@]}"; do
|
||||
kube::build::make_binaries "${binary}"
|
||||
done
|
||||
|
||||
kube::build::make_binaries "${targets[@]}"
|
||||
)
|
||||
done
|
@@ -21,4 +21,9 @@ set -o pipefail
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||
source "${KUBE_ROOT}/build/build-image/common.sh"
|
||||
|
||||
kube::build::make_binaries "$@"
|
||||
targets=("${server_targets[@]}")
|
||||
if [[ $# -gt 0 ]]; then
|
||||
targets=("$@")
|
||||
fi
|
||||
|
||||
kube::build::make_binaries "${targets[@]}"
|
Reference in New Issue
Block a user