mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Remove hyperkube from release artifacts
Change-Id: Ie09248d6fc688ffffbeb0271824817a5129346a0
This commit is contained in:
parent
bce9d225b1
commit
138571b23f
@ -135,7 +135,6 @@ release_filegroup(
|
||||
name = "server-targets",
|
||||
conditioned_srcs = for_platforms(for_server = [
|
||||
"//cluster/gce/gci/mounter",
|
||||
"//cmd/hyperkube",
|
||||
"//cmd/kube-apiserver",
|
||||
"//cmd/kube-controller-manager",
|
||||
"//cmd/kube-scheduler",
|
||||
|
@ -28,7 +28,6 @@ readonly RELEASE_STAGE="${LOCAL_OUTPUT_ROOT}/release-stage"
|
||||
readonly RELEASE_TARS="${LOCAL_OUTPUT_ROOT}/release-tars"
|
||||
readonly RELEASE_IMAGES="${LOCAL_OUTPUT_ROOT}/release-images"
|
||||
|
||||
KUBE_BUILD_HYPERKUBE=${KUBE_BUILD_HYPERKUBE:-y}
|
||||
KUBE_BUILD_CONFORMANCE=${KUBE_BUILD_CONFORMANCE:-y}
|
||||
KUBE_BUILD_PULL_LATEST_IMAGES=${KUBE_BUILD_PULL_LATEST_IMAGES:-y}
|
||||
|
||||
@ -218,11 +217,6 @@ function kube::release::build_server_images() {
|
||||
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
|
||||
}
|
||||
@ -284,23 +278,6 @@ function kube::release::sha1() {
|
||||
fi
|
||||
}
|
||||
|
||||
function kube::release::build_hyperkube_image() {
|
||||
local -r arch="$1"
|
||||
local -r registry="$2"
|
||||
local -r version="$3"
|
||||
local -r save_dir="${4-}"
|
||||
kube::log::status "Building hyperkube image for arch: ${arch}"
|
||||
ARCH="${arch}" REGISTRY="${registry}" VERSION="${version}" \
|
||||
make -C cluster/images/hyperkube/ build >/dev/null
|
||||
|
||||
local hyperkube_tag="${registry}/hyperkube-${arch}:${version}"
|
||||
if [[ -n "${save_dir}" ]]; then
|
||||
"${DOCKER[@]}" save "${hyperkube_tag}" > "${save_dir}/hyperkube-${arch}.tar"
|
||||
fi
|
||||
kube::log::status "Deleting hyperkube image ${hyperkube_tag}"
|
||||
"${DOCKER[@]}" rmi "${hyperkube_tag}" &>/dev/null || true
|
||||
}
|
||||
|
||||
function kube::release::build_conformance_image() {
|
||||
local -r arch="$1"
|
||||
local -r registry="$2"
|
||||
@ -398,10 +375,6 @@ EOF
|
||||
) &
|
||||
done
|
||||
|
||||
if [[ "${KUBE_BUILD_HYPERKUBE}" =~ [yY] ]]; then
|
||||
kube::release::build_hyperkube_image "${arch}" "${docker_registry}" \
|
||||
"${docker_tag}" "${images_dir}" &
|
||||
fi
|
||||
if [[ "${KUBE_BUILD_CONFORMANCE}" =~ [yY] ]]; then
|
||||
kube::release::build_conformance_image "${arch}" "${docker_registry}" \
|
||||
"${docker_tag}" "${images_dir}" &
|
||||
|
@ -26,9 +26,6 @@ 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
|
||||
if [[ "${KUBE_BUILD_CONFORMANCE}" =~ [yY] ]]; then
|
||||
CMD_TARGETS="${CMD_TARGETS} ${KUBE_CONFORMANCE_IMAGE_TARGETS[*]}"
|
||||
fi
|
||||
|
@ -35,7 +35,6 @@ filegroup(
|
||||
# TODO: collect all relevant docker_push targets into one target that can be run:
|
||||
# //build:push-server-images
|
||||
# //cluster/images/conformance:push-conformance
|
||||
# //cluster/images/hyperkube:push-hyperkube
|
||||
gcs_upload(
|
||||
name = "push-build",
|
||||
data = [
|
||||
|
@ -426,7 +426,6 @@ define RELEASE_IMAGES_HELP_INFO
|
||||
# Build release images
|
||||
#
|
||||
# Args:
|
||||
# KUBE_BUILD_HYPERKUBE: Whether to build hyperkube image as well. Set to 'n' to skip.
|
||||
# KUBE_BUILD_CONFORMANCE: Whether to build conformance testing image as well. Set to 'n' to skip.
|
||||
#
|
||||
# Example:
|
||||
@ -470,7 +469,6 @@ define QUICK_RELEASE_IMAGES_HELP_INFO
|
||||
#
|
||||
# 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.
|
||||
# KUBE_BUILD_CONFORMANCE: Whether to build conformance testing image as well. Set to 'n' to skip.
|
||||
#
|
||||
# Example:
|
||||
|
@ -98,7 +98,6 @@ package_group(
|
||||
name = "pkg_kubectl_cmd_CONSUMERS_BAD",
|
||||
packages = [
|
||||
"//cmd/clicheck",
|
||||
"//cmd/hyperkube",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -1,202 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2015 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.
|
||||
|
||||
# This script will download latest version of kubectl command line tool and will
|
||||
# bring up a local Kubernetes cluster with a single node.
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_HOST=${KUBE_HOST:-localhost}
|
||||
KUBELET_KUBECONFIG=${KUBELET_KUBECONFIG:-"/var/run/kubernetes/kubelet.kubeconfig"}
|
||||
|
||||
declare -r RED="\\033[0;31m"
|
||||
declare -r GREEN="\\033[0;32m"
|
||||
declare -r YELLOW="\\033[0;33m"
|
||||
|
||||
function echo_green {
|
||||
echo -e "${GREEN}$1"; tput sgr0
|
||||
}
|
||||
|
||||
function echo_red {
|
||||
echo -e "${RED}$1"; tput sgr0
|
||||
}
|
||||
|
||||
function echo_yellow {
|
||||
echo -e "${YELLOW}$1"; tput sgr0
|
||||
}
|
||||
|
||||
function run {
|
||||
# For a moment we need to change bash options to capture message if a command fails.
|
||||
set +o errexit
|
||||
output=$($1 2>&1)
|
||||
exit_code=$?
|
||||
set -o errexit
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
echo_green "SUCCESS"
|
||||
else
|
||||
echo_red "FAILED"
|
||||
echo "${output}" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Creates a kubeconfig file for the kubelet.
|
||||
# Args: the IP address of the API server (e.g. "http://localhost:8080"), destination file path
|
||||
function create-kubelet-kubeconfig() {
|
||||
#local api_addr="${1}"
|
||||
local destination dest_dir
|
||||
destination="${2}"
|
||||
if [[ -z "${destination}" ]]; then
|
||||
echo "Must provide destination path to create Kubelet kubeconfig file!"
|
||||
exit 1
|
||||
fi
|
||||
echo "Creating Kubelet kubeconfig file"
|
||||
dest_dir="$(dirname "${destination}")"
|
||||
mkdir -p "${dest_dir}" &>/dev/null || sudo mkdir -p "${dest_dir}"
|
||||
sudo=$(test -w "${dest_dir}" || echo "sudo -E")
|
||||
cat <<EOF | ${sudo} tee "${destination}" > /dev/null
|
||||
apiVersion: v1
|
||||
kind: Config
|
||||
clusters:
|
||||
- cluster:
|
||||
server: http://localhost:8080
|
||||
name: local
|
||||
contexts:
|
||||
- context:
|
||||
cluster: local
|
||||
name: local
|
||||
current-context: local
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function create_cluster {
|
||||
echo "Creating a local cluster:"
|
||||
echo -e -n "\\tStarting kubelet..."
|
||||
create-kubelet-kubeconfig "http://localhost:8080" "${KUBELET_KUBECONFIG}"
|
||||
run "docker run \
|
||||
--volume=/:/rootfs:ro \
|
||||
--volume=/sys:/sys:ro \
|
||||
--volume=/var/lib/docker/:/var/lib/docker:rw \
|
||||
--volume=/var/lib/kubelet/:/var/lib/kubelet:rw \
|
||||
--volume=/usr/libexec/kubernetes/kubelet-plugins/volume/exec:/usr/libexec/kubernetes/kubelet-plugins/volume/exec:rw \
|
||||
--volume=/var/run:/var/run:rw \
|
||||
--volume=/run/xtables.lock:/run/xtables.lock:rw \
|
||||
--net=host \
|
||||
--pid=host \
|
||||
--privileged=true \
|
||||
-d \
|
||||
k8s.gcr.io/hyperkube-${arch}:${release} \
|
||||
/hyperkube kubelet \
|
||||
--containerized \
|
||||
--hostname-override=127.0.0.1 \
|
||||
--address=0.0.0.0 \
|
||||
--kubeconfig=${KUBELET_KUBECONFIG} \
|
||||
--pod-manifest-path=/etc/kubernetes/manifests \
|
||||
--cluster-dns=10.0.0.10 \
|
||||
--cluster-domain=cluster.local \
|
||||
--v=2"
|
||||
|
||||
echo -e -n "\tWaiting for master components to start..."
|
||||
while true; do
|
||||
local running_count
|
||||
running_count=$(kubectl "-s=http://${KUBE_HOST}:8080" get pods --no-headers --namespace=kube-system 2>/dev/null | grep -c "Running")
|
||||
# We expect to have 3 running pods - etcd, master and kube-proxy.
|
||||
if [ "$running_count" -ge 3 ]; then
|
||||
break
|
||||
fi
|
||||
echo -n "."
|
||||
sleep 1
|
||||
done
|
||||
echo_green "SUCCESS"
|
||||
echo_green "Cluster created!"
|
||||
echo ""
|
||||
kubectl -s "http://${KUBE_HOST}:8080" clusterinfo
|
||||
}
|
||||
|
||||
function get_latest_version_number {
|
||||
local -r latest_url="https://storage.googleapis.com/kubernetes-release/release/stable.txt"
|
||||
if [[ $(which wget) ]]; then
|
||||
wget -qO- ${latest_url}
|
||||
elif [[ $(which curl) ]]; then
|
||||
curl -Ss ${latest_url}
|
||||
else
|
||||
echo_red "Couldn't find curl or wget. Bailing out."
|
||||
exit 4
|
||||
fi
|
||||
}
|
||||
|
||||
latest_release=$(get_latest_version_number)
|
||||
release=${KUBE_VERSION:-${latest_release}}
|
||||
|
||||
uname=$(uname)
|
||||
if [[ "${uname}" == "Darwin" ]]; then
|
||||
platform="darwin"
|
||||
elif [[ "${uname}" == "Linux" ]]; then
|
||||
platform="linux"
|
||||
else
|
||||
echo_red "Unknown, unsupported platform: (${uname})."
|
||||
echo_red "Supported platforms: Linux, Darwin."
|
||||
echo_red "Bailing out."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
machine=$(uname -m)
|
||||
if [[ "${machine}" == "x86_64" ]]; then
|
||||
arch="amd64"
|
||||
elif [[ "${machine}" == "i686" ]]; then
|
||||
arch="386"
|
||||
elif [[ "${machine}" == "arm*" ]]; then
|
||||
arch="arm"
|
||||
elif [[ "${machine}" == "s390x*" ]]; then
|
||||
arch="s390x"
|
||||
else
|
||||
echo_red "Unknown, unsupported architecture (${machine})."
|
||||
echo_red "Supported architectures x86_64, i686, arm, s390x."
|
||||
echo_red "Bailing out."
|
||||
exit 3
|
||||
fi
|
||||
|
||||
kubectl_url="https://storage.googleapis.com/kubernetes-release/release/${release}/bin/${platform}/${arch}/kubectl"
|
||||
|
||||
if [[ ! -f ./kubectl ]]; then
|
||||
echo -n "Downloading kubectl binary..."
|
||||
if [[ $(which wget) ]]; then
|
||||
run "wget ${kubectl_url}"
|
||||
elif [[ $(which curl) ]]; then
|
||||
run "curl -OL ${kubectl_url}"
|
||||
else
|
||||
echo_red "Couldn't find curl or wget. Bailing out."
|
||||
exit 1
|
||||
fi
|
||||
chmod a+x kubectl
|
||||
echo ""
|
||||
else
|
||||
# TODO: We should detect version of kubectl binary if it too old
|
||||
# download newer version.
|
||||
echo "Detected existing kubectl binary. Skipping download."
|
||||
fi
|
||||
|
||||
create_cluster
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
echo "To list the nodes in your cluster run"
|
||||
echo_yellow "\\tkubectl -s=http://${KUBE_HOST}:8080 get nodes"
|
||||
echo ""
|
||||
echo "To run your first pod run"
|
||||
echo_yellow "\\tkubectl -s http://${KUBE_HOST}:8080 run nginx --image=nginx --port=80"
|
@ -1,49 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This script builds hyperkube and then the hyperkube image.
|
||||
# REGISTRY and VERSION must be set.
|
||||
# Example usage:
|
||||
# $ export REGISTRY=gcr.io/someone
|
||||
# $ export VERSION=v1.4.0-testfix
|
||||
# ./hack/dev-push-hyperkube.sh
|
||||
# That will build and push gcr.io/someone/hyperkube-amd64:v1.4.0-testfix
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT="$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
source "${KUBE_ROOT}/build/common.sh"
|
||||
|
||||
if [[ -z "${REGISTRY:-}" ]]; then
|
||||
echo "REGISTRY must be set"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${VERSION:-}" ]]; then
|
||||
echo "VERSION must be set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IMAGE="${REGISTRY}/hyperkube-amd64:${VERSION}"
|
||||
|
||||
kube::build::verify_prereqs
|
||||
kube::build::build_image
|
||||
kube::build::run_build_command make WHAT=cmd/hyperkube
|
||||
kube::build::copy_output
|
||||
|
||||
make -C "${KUBE_ROOT}/cluster/images/hyperkube" build
|
||||
docker push "${IMAGE}"
|
@ -73,7 +73,6 @@ kube::golang::server_targets() {
|
||||
cmd/kube-controller-manager
|
||||
cmd/kubelet
|
||||
cmd/kubeadm
|
||||
cmd/hyperkube
|
||||
cmd/kube-scheduler
|
||||
vendor/k8s.io/apiextensions-apiserver
|
||||
cluster/gce/gci/mounter
|
||||
|
@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2014 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::setup_env
|
||||
|
||||
kube::util::ensure-temp-dir
|
||||
OUTPUT="${KUBE_TEMP}"/symbols-output
|
||||
cleanup() {
|
||||
rm -rf "${OUTPUT}"
|
||||
}
|
||||
trap "cleanup" EXIT SIGINT
|
||||
mkdir -p "${OUTPUT}"
|
||||
|
||||
GOLDFLAGS="-w" make -C "${KUBE_ROOT}" WHAT=cmd/hyperkube
|
||||
|
||||
# Add other BADSYMBOLS here.
|
||||
BADSYMBOLS=(
|
||||
"httptest"
|
||||
"testify"
|
||||
"testing[.]"
|
||||
"TestOnlySetFatalOnDecodeError"
|
||||
"TrackStorageCleanup"
|
||||
)
|
||||
|
||||
# b/c hyperkube binds everything simply check that for bad symbols
|
||||
go tool nm "${KUBE_OUTPUT_HOSTBIN}/hyperkube" > "${OUTPUT}/hyperkube-symbols"
|
||||
|
||||
if ! grep -q "NewHyperKubeCommand" "${OUTPUT}/hyperkube-symbols"; then
|
||||
echo "No symbols found in hyperkube binary."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RESULT=0
|
||||
for BADSYMBOL in "${BADSYMBOLS[@]}"; do
|
||||
if FOUND=$(grep "${BADSYMBOL}" < "${OUTPUT}/hyperkube-symbols"); then
|
||||
echo "Found bad symbol '${BADSYMBOL}':"
|
||||
echo "$FOUND"
|
||||
RESULT=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $RESULT
|
||||
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
Loading…
Reference in New Issue
Block a user