Remove hyperkube

This commit is contained in:
Davanum Srinivas 2020-02-28 19:09:21 -05:00
parent 7cadf86d75
commit e6cdc0e0f3
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59
17 changed files with 1 additions and 504 deletions

View File

@ -1 +0,0 @@
/cni-tars

View File

@ -1,63 +0,0 @@
# Copyright 2017 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.
FROM BASEIMAGE
# TODO(#69896): deprecate the shortened aliases in /
RUN ln -s /hyperkube /apiserver \
&& ln -s /hyperkube /cloud-controller-manager \
&& ln -s /hyperkube /controller-manager \
&& ln -s /hyperkube /kubectl \
&& ln -s /hyperkube /kubelet \
&& ln -s /hyperkube /proxy \
&& ln -s /hyperkube /scheduler \
&& ln -s /hyperkube /usr/local/bin/cloud-controller-manager \
&& ln -s /hyperkube /usr/local/bin/kube-apiserver \
&& ln -s /hyperkube /usr/local/bin/kube-controller-manager \
&& ln -s /hyperkube /usr/local/bin/kube-proxy \
&& ln -s /hyperkube /usr/local/bin/kube-scheduler \
&& ln -s /hyperkube /usr/local/bin/kubectl \
&& ln -s /hyperkube /usr/local/bin/kubelet
RUN echo CACHEBUST>/dev/null && clean-install \
bash
# The samba-common, cifs-utils, and nfs-common packages depend on
# ucf, which itself depends on /bin/bash.
RUN echo "dash dash/sh boolean false" | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
RUN echo CACHEBUST>/dev/null && clean-install \
ca-certificates \
ceph-common \
cifs-utils \
conntrack \
e2fsprogs \
xfsprogs \
ebtables \
ethtool \
git \
glusterfs-client \
iptables \
ipset \
jq \
kmod \
openssh-client \
netbase \
nfs-common \
socat \
udev \
util-linux
COPY cni-bin/bin /opt/cni/bin

View File

@ -1,85 +0,0 @@
# Copyright 2017 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 the hyperkube base image. This image is used to build the hyperkube image.
#
# Usage:
# [ARCH=amd64] [REGISTRY="staging-k8s.gcr.io"] make (build|push)
REGISTRY?=staging-k8s.gcr.io
IMAGE?=$(REGISTRY)/debian-hyperkube-base
TAG=0.12.2
ARCH?=amd64
ALL_ARCH = amd64 arm arm64 ppc64le s390x
CACHEBUST?=1
BASEIMAGE=k8s.gcr.io/debian-base-$(ARCH):0.4.1
CNI_VERSION=v0.8.5
TEMP_DIR:=$(shell mktemp -d)
CNI_TARBALL=cni-plugins-linux-$(ARCH)-$(CNI_VERSION).tgz
# This option is for running docker manifest command
export DOCKER_CLI_EXPERIMENTAL := enabled
SUDO=$(if $(filter 0,$(shell id -u)),,sudo)
.PHONY: all build push clean all-build all-push-images all-push push-manifest
all: all-push
sub-build-%:
$(MAKE) ARCH=$* build
all-build: $(addprefix sub-build-,$(ALL_ARCH))
sub-push-image-%:
$(MAKE) ARCH=$* push
all-push-images: $(addprefix sub-push-image-,$(ALL_ARCH))
all-push: all-push-images push-manifest
push-manifest:
docker manifest create --amend $(IMAGE):$(TAG) $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(IMAGE)\-&:$(TAG)~g")
@for arch in $(ALL_ARCH); do docker manifest annotate --arch $${arch} ${IMAGE}:${TAG} ${IMAGE}-$${arch}:${TAG}; done
docker manifest push --purge ${IMAGE}:${TAG}
cni-tars/$(CNI_TARBALL):
mkdir -p cni-tars/
cd cni-tars/ && curl -sSLO --retry 5 https://storage.googleapis.com/k8s-artifacts-cni/release/${CNI_VERSION}/${CNI_TARBALL}
clean:
rm -rf cni-tars/
build: cni-tars/$(CNI_TARBALL)
cp Dockerfile $(TEMP_DIR)
cd $(TEMP_DIR) && sed -i "s|BASEIMAGE|$(BASEIMAGE)|g" Dockerfile
ifeq ($(CACHEBUST),1)
cd ${TEMP_DIR} && sed -i.back "s|CACHEBUST|$(shell uuidgen)|g" Dockerfile
endif
mkdir -p ${TEMP_DIR}/cni-bin/bin
tar -xz -C ${TEMP_DIR}/cni-bin/bin -f "cni-tars/${CNI_TARBALL}"
ifneq ($(ARCH),amd64)
# Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel
$(SUDO) ../../third_party/multiarch/qemu-user-static/register/register.sh --reset
endif
docker build --pull -t $(IMAGE)-$(ARCH):$(TAG) $(TEMP_DIR)
rm -rf $(TEMP_DIR)
push: build
docker push $(IMAGE)-$(ARCH):$(TAG)

View File

@ -1,12 +0,0 @@
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- BenTheElder
- mkumatag
- tallclair
approvers:
- BenTheElder
- mkumatag
- tallclair
labels:
- sig/release

View File

@ -1,25 +0,0 @@
### debian-hyperkube-base
Serves as the base image for `k8s.gcr.io/hyperkube-${ARCH}`
images.
This image is compiled for multiple architectures.
#### How to release
If you're editing the Dockerfile or some other thing, please bump the `TAG` in the Makefile.
```console
# Build and push images for all the architectures
$ make all-push
# ---> staging-k8s.gcr.io/debian-hyperkube-base-amd64:TAG
# ---> staging-k8s.gcr.io/debian-hyperkube-base-arm:TAG
# ---> staging-k8s.gcr.io/debian-hyperkube-base-arm64:TAG
# ---> staging-k8s.gcr.io/debian-hyperkube-base-ppc64le:TAG
# ---> staging-k8s.gcr.io/debian-hyperkube-base-s390x:TAG
```
If you don't want to push the images, run `make all-build` instead
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/build/debian-hyperkube-base/README.md?pixel)]()

View File

@ -46,8 +46,6 @@ dependencies:
- name: "cni"
version: 0.8.5
refPaths:
- path: build/debian-hyperkube-base/Makefile
match: CNI_VERSION=
- path: build/workspace.bzl
match: CNI_VERSION =
- path: cluster/gce/gci/configure.sh

View File

@ -299,24 +299,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
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"
@ -416,10 +398,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}" &

View File

@ -30,11 +30,6 @@ if [[ "${KUBE_BUILD_CONFORMANCE}" =~ [yY] ]]; then
CMD_TARGETS="${CMD_TARGETS} ${KUBE_CONFORMANCE_IMAGE_TARGETS[*]}"
fi
# TODO(dims): Remove this when we get rid of hyperkube image
if [[ "${KUBE_BUILD_HYPERKUBE}" =~ [yY] ]]; then
CMD_TARGETS=$(echo "${CMD_TARGETS} cmd/kubelet cmd/kubectl" | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
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[*]}"

View File

@ -125,15 +125,6 @@ def debian_image_dependencies():
tag = "v12.0.1", # ignored, but kept here for documentation
)
container_pull(
name = "debian-hyperkube-base-" + arch,
architecture = arch,
digest = _digest(_DEBIAN_HYPERKUBE_BASE_DIGEST, arch),
registry = "k8s.gcr.io",
repository = "debian-hyperkube-base",
tag = "0.12.1", # ignored, but kept here for documentation
)
def etcd_tarballs():
for arch, sha in _ETCD_TARBALL_ARCH_SHA256.items():
http_archive(

View File

@ -18,7 +18,6 @@ filegroup(
"//cluster/images/conformance:all-srcs",
"//cluster/images/etcd-version-monitor:all-srcs",
"//cluster/images/etcd/migrate:all-srcs",
"//cluster/images/hyperkube:all-srcs",
"//cluster/images/kubemark:all-srcs",
],
tags = ["automanaged"],

View File

@ -23,7 +23,7 @@ container_layer(
multi_arch_container(
name = "conformance",
architectures = SERVER_PLATFORMS["linux"],
base = "@debian-hyperkube-base-{ARCH}//image",
base = "@debian-base-{ARCH}//image",
cmd = [
"/bin/bash",
"-c",

View File

@ -1,58 +0,0 @@
load("@io_bazel_rules_docker//container:container.bzl", "container_layer")
load("//build:container.bzl", "multi_arch_container")
load("//build:platforms.bzl", "SERVER_PLATFORMS")
container_layer(
name = "scripts",
directory = "/",
files = [
"hyperkube",
],
)
container_layer(
name = "bins",
directory = "/usr/local/bin",
files = [
"//cmd/kube-apiserver",
"//cmd/kube-controller-manager",
"//cmd/kube-proxy",
"//cmd/kube-scheduler",
"//cmd/kubectl",
"//cmd/kubelet",
],
)
multi_arch_container(
name = "image",
architectures = SERVER_PLATFORMS["linux"],
base = "@debian-hyperkube-base-{ARCH}//image",
cmd = [
"/hyperkube",
],
# {ARCH} is replaced by the macro, but STABLE_ vars are replaced by the
# build stamping, so we need to escape them
docker_push_tags = ["{{STABLE_DOCKER_PUSH_REGISTRY}}/hyperkube-{ARCH}:{{STABLE_DOCKER_TAG}}"],
docker_tags = ["{{STABLE_DOCKER_REGISTRY}}/hyperkube-{ARCH}:{{STABLE_DOCKER_TAG}}"],
layers = [
":bins",
":scripts",
],
stamp = True,
tags = ["manual"],
visibility = ["//visibility:public"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -1,23 +0,0 @@
# Copyright 2016 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.
FROM BASEIMAGE
# Cleanup all the soft links
ADD binaries.tgz /usr/local/bin
# Copy the shell script
COPY hyperkube /hyperkube
ENTRYPOINT ["/hyperkube"]

View File

@ -1,59 +0,0 @@
# Copyright 2016 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 the hyperkube image.
#
# Usage:
# [ARCH=amd64] [REGISTRY="staging-k8s.gcr.io"] make (build|push) VERSION={some_released_version_of_kubernetes}
REGISTRY?=staging-k8s.gcr.io
ARCH?=amd64
OUT_DIR?=_output
BASEIMAGE=k8s.gcr.io/debian-hyperkube-base-$(ARCH):0.12.1
LOCAL_OUTPUT_PATH=$(shell pwd)/../../../$(OUT_DIR)/local/bin/linux/$(ARCH)
DOCKERIZED_OUTPUT_PATH=$(shell pwd)/../../../$(OUT_DIR)/dockerized/bin/linux/$(ARCH)
OUTPUT_PATH?=$(shell test -d $(LOCAL_OUTPUT_PATH) && echo $(LOCAL_OUTPUT_PATH) || echo $(DOCKERIZED_OUTPUT_PATH))
TEMP_DIR:=$(shell mktemp -d -t hyperkubeXXXXXX)
all: build
build:
ifndef VERSION
$(error VERSION is undefined)
endif
cp -r ./* ${TEMP_DIR}
tar -cvzf ${TEMP_DIR}/binaries.tgz -C ${OUTPUT_PATH} kube-apiserver kube-controller-manager \
kube-proxy kube-scheduler kubectl kubelet
chmod a+rx ${TEMP_DIR}/hyperkube
cd ${TEMP_DIR} && sed -i.back "s|BASEIMAGE|${BASEIMAGE}|g" Dockerfile
docker build --pull -t ${REGISTRY}/hyperkube-${ARCH}:${VERSION} ${TEMP_DIR}
rm -rf "${TEMP_DIR}"
push: build
docker push ${REGISTRY}/hyperkube-${ARCH}:${VERSION}
ifeq ($(ARCH),amd64)
docker rmi ${REGISTRY}/hyperkube:${VERSION} 2>/dev/null || true
docker tag ${REGISTRY}/hyperkube-${ARCH}:${VERSION} ${REGISTRY}/hyperkube:${VERSION}
docker push ${REGISTRY}/hyperkube:${VERSION}
endif
.PHONY: build push all

View File

@ -1,12 +0,0 @@
# See the OWNERS docs at https://go.k8s.io/owners
reviewers:
- ixdy
- luxas
- mikedanese
approvers:
- ixdy
- luxas
- mikedanese
labels:
- sig/release

View File

@ -1,50 +0,0 @@
### hyperkube
`hyperkube` is an all-in-one binary for the Kubernetes server components.
`hyperkube` is built for multiple architectures and _the image is pushed automatically on every release._
#### Images for development scenarios
During the development process, it's effective to just build only the required binaries for specific
architecture and generate single hyperkube image from it. The following shows how to generate
linux/amd64 hyperkube image:
```console
# Run the following from the top level kubernetes directory, to build the binaries necessary for creating hyperkube image.
$ KUBE_BUILD_PLATFORMS=linux/amd64 make kube-apiserver kube-controller-manager kube-proxy kube-scheduler kubectl kubelet
# Create and push the hyperkube image
$ REGISTRY=<registry> VERSION=<image version> ARCH=amd64 make -C cluster/images/hyperkube push
```
#### How to release by hand
```console
# First, build the binaries
$ build/run.sh make cross
# Build for linux/amd64 (default)
# export REGISTRY=$HOST/$ORG to switch from staging-k8s.gcr.io
$ make push VERSION={target_version} ARCH=amd64
# ---> staging-k8s.gcr.io/hyperkube-amd64:VERSION
# ---> staging-k8s.gcr.io/hyperkube:VERSION (image with backwards-compatible naming)
$ make push VERSION={target_version} ARCH=arm
# ---> staging-k8s.gcr.io/hyperkube-arm:VERSION
$ make push VERSION={target_version} ARCH=arm64
# ---> staging-k8s.gcr.io/hyperkube-arm64:VERSION
$ make push VERSION={target_version} ARCH=ppc64le
# ---> staging-k8s.gcr.io/hyperkube-ppc64le:VERSION
$ make push VERSION={target_version} ARCH=s390x
# ---> staging-k8s.gcr.io/hyperkube-s390x:VERSION
```
If you don't want to push the images, run `make` or `make build` instead
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/cluster/images/hyperkube/README.md?pixel)]()

View File

@ -1,76 +0,0 @@
#!/usr/bin/env bash
# Copyright 2019 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
BINS=(
kube-apiserver
kube-controller-manager
kube-proxy
kube-scheduler
kubectl
kubelet
)
function array_contains() {
local search="$1"
local element
shift
for element; do
if [[ "${element}" == "${search}" ]]; then
return 0
fi
done
return 1
}
function print_usage() {
cat <<EOF
Usage:
$(basename "$0") [command]
Available Commands:
help Help about any command
kube-apiserver
kube-controller-manager
kube-proxy
kube-scheduler
kubectl kubectl controls the Kubernetes cluster manager
kubelet
EOF
exit 0
}
function main() {
if [[ "$#" -lt 1 || "${1:-}" == "--help" || "${1:-}" == "help" ]]; then
print_usage
fi
if ! array_contains "$1" "${BINS[@]}"; then
echo "$1: command not supported"
print_usage
fi
command=${1}
shift
if ! command -v "${command}" &>/dev/null; then
echo "${command}: command not found"
exit 1
fi
exec "${command}" "${@}"
}
main "${@}"