mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +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:
parent
f61d434783
commit
3701c2ac0e
@ -18,10 +18,10 @@ There is also early support for building Docker "run" containers
|
|||||||
|
|
||||||
## Key scripts
|
## Key scripts
|
||||||
|
|
||||||
* `make-binaries.sh`: This will compile all of the Kubernetes binaries
|
* `make-server.sh`: This will compile all of the Kubernetes server binaries for linux/amd64
|
||||||
|
* `make-client.sh`: This will make all cross-compiled client binaries
|
||||||
* `run-tests.sh`: This will run the Kubernetes unit tests
|
* `run-tests.sh`: This will run the Kubernetes unit tests
|
||||||
* `run-integration.sh`: This will build and run the integration test
|
* `run-integration.sh`: This will build and run the integration test
|
||||||
* `make-cross.sh`: This will make all cross-compiled binaries (currently just `kubecfg`)
|
|
||||||
* `copy-output.sh`: This will copy the contents of `_output/build` from any remote Docker container to the local `_output/build`. Right now this is only necessary on Mac OS X with `boot2docker`.
|
* `copy-output.sh`: This will copy the contents of `_output/build` from any remote Docker container to the local `_output/build`. Right now this is only necessary on Mac OS X with `boot2docker`.
|
||||||
* `make-clean.sh`: Clean out the contents of `_output/build` and remove any local built container images.
|
* `make-clean.sh`: Clean out the contents of `_output/build` and remove any local built container images.
|
||||||
* `shell.sh`: Drop into a `bash` shell in a build container with a snapshot of the current repo code.
|
* `shell.sh`: Drop into a `bash` shell in a build container with a snapshot of the current repo code.
|
||||||
|
@ -23,6 +23,19 @@ cd "${KUBE_ROOT}"
|
|||||||
readonly KUBE_TARGET="${KUBE_ROOT}/_output/build"
|
readonly KUBE_TARGET="${KUBE_ROOT}/_output/build"
|
||||||
readonly KUBE_GO_PACKAGE=github.com/GoogleCloudPlatform/kubernetes
|
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}"
|
mkdir -p "${KUBE_TARGET}"
|
||||||
|
|
||||||
if [[ ! -f "/kube-build-image" ]]; then
|
if [[ ! -f "/kube-build-image" ]]; then
|
||||||
@ -46,19 +59,11 @@ function kube::build::make_binary() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function kube::build::make_binaries() {
|
function kube::build::make_binaries() {
|
||||||
local -a targets=(
|
[[ $# -gt 0 ]] || {
|
||||||
cmd/proxy
|
echo "!!! Internal error. kube::build::make_binaries called with no targets."
|
||||||
cmd/apiserver
|
}
|
||||||
cmd/controller-manager
|
|
||||||
cmd/kubelet
|
|
||||||
cmd/kubecfg
|
|
||||||
plugin/cmd/scheduler
|
|
||||||
)
|
|
||||||
|
|
||||||
if [[ -n "${1-}" ]]; then
|
|
||||||
targets=("$1")
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
local -a targets=("$@")
|
||||||
local -a binaries=()
|
local -a binaries=()
|
||||||
local target
|
local target
|
||||||
for target in "${targets[@]}"; do
|
for target in "${targets[@]}"; do
|
||||||
|
@ -21,16 +21,19 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||||
source "${KUBE_ROOT}/build/build-image/common.sh"
|
source "${KUBE_ROOT}/build/build-image/common.sh"
|
||||||
|
|
||||||
readonly CROSS_BINARIES=(
|
platforms=(linux/amd64 $KUBE_CROSSPLATFORMS)
|
||||||
./cmd/kubecfg
|
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 GOOS=${platform%/*}
|
||||||
export GOARCH=${platform##*/}
|
export GOARCH=${platform##*/}
|
||||||
for binary in "${CROSS_BINARIES[@]}"; do
|
|
||||||
kube::build::make_binaries "${binary}"
|
kube::build::make_binaries "${targets[@]}"
|
||||||
done
|
|
||||||
)
|
)
|
||||||
done
|
done
|
@ -21,4 +21,9 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
||||||
source "${KUBE_ROOT}/build/build-image/common.sh"
|
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[@]}"
|
@ -63,6 +63,7 @@ readonly DOCKER_MOUNT_ARGS=(--volume "${LOCAL_OUTPUT_BUILD}:${REMOTE_OUTPUT_DIR}
|
|||||||
|
|
||||||
readonly KUBE_CLIENT_BINARIES=(
|
readonly KUBE_CLIENT_BINARIES=(
|
||||||
kubecfg
|
kubecfg
|
||||||
|
kubectl
|
||||||
)
|
)
|
||||||
|
|
||||||
readonly KUBE_SERVER_BINARIES=(
|
readonly KUBE_SERVER_BINARIES=(
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Make all of the Kubernetes binaries for cross compile targets
|
# Make all of the client Kubernetes binaries for cross compile targets
|
||||||
#
|
#
|
||||||
# This makes the docker build image, builds the cross binaries and copies them
|
# This makes the docker build image, builds the cross binaries and copies them
|
||||||
# out of the docker container.
|
# out of the docker container.
|
||||||
@ -28,5 +28,5 @@ source "$KUBE_ROOT/build/common.sh"
|
|||||||
|
|
||||||
kube::build::verify_prereqs
|
kube::build::verify_prereqs
|
||||||
kube::build::build_image
|
kube::build::build_image
|
||||||
kube::build::run_build_command build/build-image/make-cross.sh
|
kube::build::run_build_command build/build-image/make-client.sh "$@"
|
||||||
kube::build::copy_output
|
kube::build::copy_output
|
@ -14,7 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Make all of the Kubernetes binaries.
|
# Make all of the Kubernetes server binaries.
|
||||||
#
|
#
|
||||||
# This makes the docker build image, builds the binaries and copies them out
|
# This makes the docker build image, builds the binaries and copies them out
|
||||||
# of the docker container.
|
# of the docker container.
|
||||||
@ -27,5 +27,5 @@ source "$KUBE_ROOT/build/common.sh"
|
|||||||
|
|
||||||
kube::build::verify_prereqs
|
kube::build::verify_prereqs
|
||||||
kube::build::build_image
|
kube::build::build_image
|
||||||
kube::build::run_build_command build/build-image/make-binaries.sh "$@"
|
kube::build::run_build_command build/build-image/make-server.sh "$@"
|
||||||
kube::build::copy_output
|
kube::build::copy_output
|
@ -29,8 +29,8 @@ KUBE_RELEASE_RUN_TESTS=${KUBE_RELEASE_RUN_TESTS-y}
|
|||||||
|
|
||||||
kube::build::verify_prereqs
|
kube::build::verify_prereqs
|
||||||
kube::build::build_image
|
kube::build::build_image
|
||||||
kube::build::run_build_command build/build-image/make-binaries.sh
|
kube::build::run_build_command build/build-image/make-client.sh
|
||||||
kube::build::run_build_command build/build-image/make-cross.sh
|
kube::build::run_build_command build/build-image/make-server.sh
|
||||||
|
|
||||||
if [[ $KUBE_RELEASE_RUN_TESTS =~ ^[yY]$ ]]; then
|
if [[ $KUBE_RELEASE_RUN_TESTS =~ ^[yY]$ ]]; then
|
||||||
kube::build::run_build_command build/build-image/run-tests.sh
|
kube::build::run_build_command build/build-image/run-tests.sh
|
||||||
|
@ -68,7 +68,7 @@ if [[ ! -x "$kubecfg" ]]; then
|
|||||||
echo "It looks as if you don't have a compiled kubecfg binary."
|
echo "It looks as if you don't have a compiled kubecfg binary."
|
||||||
echo
|
echo
|
||||||
echo "If you are running from a clone of the git repo, please run"
|
echo "If you are running from a clone of the git repo, please run"
|
||||||
echo "'./build/make-cross.sh'. Note that this requires having Docker installed."
|
echo "'./build/make-client.sh'. Note that this requires having Docker installed."
|
||||||
echo
|
echo
|
||||||
echo "If you are running from a binary release tarball, something is wrong. "
|
echo "If you are running from a binary release tarball, something is wrong. "
|
||||||
echo "Look at http://kubernetes.io/ for information on how to contact the "
|
echo "Look at http://kubernetes.io/ for information on how to contact the "
|
||||||
|
Loading…
Reference in New Issue
Block a user