k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/build/lib/release.sh (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2016 The Kubernetes Authors. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # This file creates release artifacts (tar files, container images) that are 18 # ready to distribute to install or distribute to end users. 19 20 ############################################################################### 21 # Most of the ::release:: namespace functions have been moved to 22 # github.com/kubernetes/release. Have a look in that repo and specifically in 23 # lib/releaselib.sh for ::release::-related functionality. 24 ############################################################################### 25 26 # This is where the final release artifacts are created locally 27 readonly RELEASE_STAGE="${LOCAL_OUTPUT_ROOT}/release-stage" 28 readonly RELEASE_TARS="${LOCAL_OUTPUT_ROOT}/release-tars" 29 readonly RELEASE_IMAGES="${LOCAL_OUTPUT_ROOT}/release-images" 30 31 KUBE_BUILD_CONFORMANCE=${KUBE_BUILD_CONFORMANCE:-n} 32 KUBE_BUILD_PULL_LATEST_IMAGES=${KUBE_BUILD_PULL_LATEST_IMAGES:-y} 33 34 # --------------------------------------------------------------------------- 35 # Build final release artifacts 36 function kube::release::clean_cruft() { 37 # Clean out cruft 38 find "${RELEASE_STAGE}" -name '*~' -exec rm {} \; 39 find "${RELEASE_STAGE}" -name '#*#' -exec rm {} \; 40 find "${RELEASE_STAGE}" -name '.DS*' -exec rm {} \; 41 } 42 43 function kube::release::package_tarballs() { 44 # Clean out any old releases 45 rm -rf "${RELEASE_STAGE}" "${RELEASE_TARS}" "${RELEASE_IMAGES}" 46 mkdir -p "${RELEASE_TARS}" 47 kube::release::package_src_tarball & 48 kube::release::package_client_tarballs & 49 kube::release::package_kube_manifests_tarball & 50 kube::util::wait-for-jobs || { kube::log::error "previous tarball phase failed"; return 1; } 51 52 # _node and _server tarballs depend on _src tarball 53 kube::release::package_node_tarballs & 54 kube::release::package_server_tarballs & 55 kube::util::wait-for-jobs || { kube::log::error "previous tarball phase failed"; return 1; } 56 57 kube::release::package_final_tarball & # _final depends on some of the previous phases 58 kube::release::package_test_tarballs & # _test doesn't depend on anything 59 kube::util::wait-for-jobs || { kube::log::error "previous tarball phase failed"; return 1; } 60 } 61 62 # Package the source code we built, for compliance/licensing/audit/yadda. 63 function kube::release::package_src_tarball() { 64 local -r src_tarball="${RELEASE_TARS}/kubernetes-src.tar.gz" 65 kube::log::status "Building tarball: src" 66 if [[ "${KUBE_GIT_TREE_STATE-}" = 'clean' ]]; then 67 git archive -o "${src_tarball}" HEAD 68 else 69 find "${KUBE_ROOT}" -mindepth 1 -maxdepth 1 \ 70 ! \( \ 71 \( -path "${KUBE_ROOT}"/_\* -o \ 72 -path "${KUBE_ROOT}"/.git\* -o \ 73 -path "${KUBE_ROOT}"/.config\* -o \ 74 -path "${KUBE_ROOT}"/.gsutil\* \ 75 \) -prune \ 76 \) -print0 \ 77 | "${TAR}" czf "${src_tarball}" --transform "s|${KUBE_ROOT#/*}|kubernetes|" --null -T - 78 fi 79 } 80 81 # Package up all of the cross compiled clients. Over time this should grow into 82 # a full SDK 83 function kube::release::package_client_tarballs() { 84 # Find all of the built client binaries 85 local long_platforms=("${LOCAL_OUTPUT_BINPATH}"/*/*) 86 if [[ -n ${KUBE_BUILD_PLATFORMS-} ]]; then 87 read -ra long_platforms <<< "${KUBE_BUILD_PLATFORMS}" 88 fi 89 90 for platform_long in "${long_platforms[@]}"; do 91 local platform 92 local platform_tag 93 platform=${platform_long##"${LOCAL_OUTPUT_BINPATH}"/} # Strip LOCAL_OUTPUT_BINPATH 94 platform_tag=${platform/\//-} # Replace a "/" for a "-" 95 kube::log::status "Starting tarball: client $platform_tag" 96 97 ( 98 local release_stage="${RELEASE_STAGE}/client/${platform_tag}/kubernetes" 99 rm -rf "${release_stage}" 100 mkdir -p "${release_stage}/client/bin" 101 102 local client_bins=("${KUBE_CLIENT_BINARIES[@]}") 103 if [[ "${platform%/*}" = 'windows' ]]; then 104 client_bins=("${KUBE_CLIENT_BINARIES_WIN[@]}") 105 fi 106 107 # This fancy expression will expand to prepend a path 108 # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the 109 # client_bins array. 110 cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ 111 "${release_stage}/client/bin/" 112 113 kube::release::clean_cruft 114 115 local package_name="${RELEASE_TARS}/kubernetes-client-${platform_tag}.tar.gz" 116 kube::release::create_tarball "${package_name}" "${release_stage}/.." 117 ) & 118 done 119 120 kube::log::status "Waiting on tarballs" 121 kube::util::wait-for-jobs || { kube::log::error "client tarball creation failed"; exit 1; } 122 } 123 124 # Package up all of the node binaries 125 function kube::release::package_node_tarballs() { 126 local platform 127 for platform in "${KUBE_NODE_PLATFORMS[@]}"; do 128 local platform_tag 129 local arch 130 platform_tag=${platform/\//-} # Replace a "/" for a "-" 131 arch=$(basename "${platform}") 132 kube::log::status "Building tarball: node $platform_tag" 133 134 local release_stage="${RELEASE_STAGE}/node/${platform_tag}/kubernetes" 135 rm -rf "${release_stage}" 136 mkdir -p "${release_stage}/node/bin" 137 138 local node_bins=("${KUBE_NODE_BINARIES[@]}") 139 if [[ "${platform%/*}" = 'windows' ]]; then 140 node_bins=("${KUBE_NODE_BINARIES_WIN[@]}") 141 fi 142 # This fancy expression will expand to prepend a path 143 # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the 144 # node_bins array. 145 cp "${node_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ 146 "${release_stage}/node/bin/" 147 148 # TODO: Docker images here 149 # kube::release::create_docker_images_for_server "${release_stage}/server/bin" "${arch}" 150 151 # Include the client binaries here too as they are useful debugging tools. 152 local client_bins=("${KUBE_CLIENT_BINARIES[@]}") 153 if [[ "${platform%/*}" = 'windows' ]]; then 154 client_bins=("${KUBE_CLIENT_BINARIES_WIN[@]}") 155 fi 156 # This fancy expression will expand to prepend a path 157 # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the 158 # client_bins array. 159 cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ 160 "${release_stage}/node/bin/" 161 162 cp -R "${KUBE_ROOT}/LICENSES" "${release_stage}/" 163 164 cp "${RELEASE_TARS}/kubernetes-src.tar.gz" "${release_stage}/" 165 166 kube::release::clean_cruft 167 168 local package_name="${RELEASE_TARS}/kubernetes-node-${platform_tag}.tar.gz" 169 kube::release::create_tarball "${package_name}" "${release_stage}/.." 170 done 171 } 172 173 # Package up all of the server binaries in docker images 174 function kube::release::build_server_images() { 175 kube::util::ensure-docker-buildx 176 177 # Clean out any old images 178 rm -rf "${RELEASE_IMAGES}" 179 local platform 180 for platform in "${KUBE_SERVER_PLATFORMS[@]}"; do 181 local platform_tag 182 local arch 183 platform_tag=${platform/\//-} # Replace a "/" for a "-" 184 arch=$(basename "${platform}") 185 kube::log::status "Building images: $platform_tag" 186 187 local release_stage 188 release_stage="${RELEASE_STAGE}/server/${platform_tag}/kubernetes" 189 rm -rf "${release_stage}" 190 mkdir -p "${release_stage}/server/bin" 191 192 # This fancy expression will expand to prepend a path 193 # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the 194 # KUBE_SERVER_IMAGE_BINARIES array. 195 cp "${KUBE_SERVER_IMAGE_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ 196 "${release_stage}/server/bin/" 197 198 kube::release::create_docker_images_for_server "${release_stage}/server/bin" "${arch}" 199 done 200 } 201 202 # Package up all of the server binaries 203 function kube::release::package_server_tarballs() { 204 kube::release::build_server_images 205 local platform 206 for platform in "${KUBE_SERVER_PLATFORMS[@]}"; do 207 local platform_tag 208 local arch 209 platform_tag=${platform/\//-} # Replace a "/" for a "-" 210 arch=$(basename "${platform}") 211 kube::log::status "Building tarball: server $platform_tag" 212 213 # NOTE: this directory was setup in kube::release::build_server_images 214 local release_stage 215 release_stage="${RELEASE_STAGE}/server/${platform_tag}/kubernetes" 216 mkdir -p "${release_stage}/addons" 217 218 # This fancy expression will expand to prepend a path 219 # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the 220 # KUBE_SERVER_BINARIES array. 221 cp "${KUBE_SERVER_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ 222 "${release_stage}/server/bin/" 223 224 # Include the client binaries here too as they are useful debugging tools. 225 local client_bins 226 client_bins=("${KUBE_CLIENT_BINARIES[@]}") 227 if [[ "${platform%/*}" = 'windows' ]]; then 228 client_bins=("${KUBE_CLIENT_BINARIES_WIN[@]}") 229 fi 230 # This fancy expression will expand to prepend a path 231 # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the 232 # client_bins array. 233 cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ 234 "${release_stage}/server/bin/" 235 236 cp -R "${KUBE_ROOT}/LICENSES" "${release_stage}/" 237 238 cp "${RELEASE_TARS}/kubernetes-src.tar.gz" "${release_stage}/" 239 240 kube::release::clean_cruft 241 242 local package_name 243 package_name="${RELEASE_TARS}/kubernetes-server-${platform_tag}.tar.gz" 244 kube::release::create_tarball "${package_name}" "${release_stage}/.." 245 done 246 } 247 248 function kube::release::md5() { 249 if which md5 >/dev/null 2>&1; then 250 md5 -q "$1" 251 else 252 md5sum "$1" | awk '{ print $1 }' 253 fi 254 } 255 256 function kube::release::sha1() { 257 if which sha1sum >/dev/null 2>&1; then 258 sha1sum "$1" | awk '{ print $1 }' 259 else 260 shasum -a1 "$1" | awk '{ print $1 }' 261 fi 262 } 263 264 function kube::release::build_conformance_image() { 265 local -r arch="$1" 266 local -r registry="$2" 267 local -r version="$3" 268 local -r save_dir="${4-}" 269 kube::log::status "Building conformance image for arch: ${arch}" 270 ARCH="${arch}" REGISTRY="${registry}" VERSION="${version}" \ 271 make -C test/conformance/image/ build >/dev/null 272 273 local conformance_tag 274 conformance_tag="${registry}/conformance-${arch}:${version}" 275 if [[ -n "${save_dir}" ]]; then 276 "${DOCKER[@]}" save "${conformance_tag}" > "${save_dir}/conformance-${arch}.tar" 277 fi 278 kube::log::status "Deleting conformance image ${conformance_tag}" 279 "${DOCKER[@]}" rmi "${conformance_tag}" &>/dev/null || true 280 } 281 282 # This builds all the release docker images (One docker image per binary) 283 # Args: 284 # $1 - binary_dir, the directory to save the tared images to. 285 # $2 - arch, architecture for which we are building docker images. 286 function kube::release::create_docker_images_for_server() { 287 # Create a sub-shell so that we don't pollute the outer environment 288 ( 289 local binary_dir 290 local arch 291 local binaries 292 local images_dir 293 binary_dir="$1" 294 arch="$2" 295 binaries=$(kube::build::get_docker_wrapped_binaries) 296 images_dir="${RELEASE_IMAGES}/${arch}" 297 mkdir -p "${images_dir}" 298 299 # registry.k8s.io is the constant tag in the docker archives, this is also the default for config scripts in GKE. 300 # We can use KUBE_DOCKER_REGISTRY to include and extra registry in the docker archive. 301 # If we use KUBE_DOCKER_REGISTRY="registry.k8s.io", then the extra tag (same) is ignored, see release_docker_image_tag below. 302 local -r docker_registry="registry.k8s.io" 303 # Docker tags cannot contain '+' 304 local docker_tag="${KUBE_GIT_VERSION/+/_}" 305 if [[ -z "${docker_tag}" ]]; then 306 kube::log::error "git version information missing; cannot create Docker tag" 307 return 1 308 fi 309 310 # provide `--pull` argument to `docker build` if `KUBE_BUILD_PULL_LATEST_IMAGES` 311 # is set to y or Y; otherwise try to build the image without forcefully 312 # pulling the latest base image. 313 local docker_build_opts 314 docker_build_opts= 315 if [[ "${KUBE_BUILD_PULL_LATEST_IMAGES}" =~ [yY] ]]; then 316 docker_build_opts='--pull' 317 fi 318 319 for wrappable in $binaries; do 320 321 local binary_name=${wrappable%%,*} 322 local base_image=${wrappable##*,} 323 local binary_file_path="${binary_dir}/${binary_name}" 324 local docker_build_path="${binary_file_path}.dockerbuild" 325 local docker_image_tag="${docker_registry}/${binary_name}-${arch}:${docker_tag}" 326 327 local docker_file_path="${KUBE_ROOT}/build/server-image/Dockerfile" 328 # If this binary has its own Dockerfile use that else use the generic Dockerfile. 329 if [[ -f "${KUBE_ROOT}/build/server-image/${binary_name}/Dockerfile" ]]; then 330 docker_file_path="${KUBE_ROOT}/build/server-image/${binary_name}/Dockerfile" 331 fi 332 333 kube::log::status "Starting docker build for image: ${binary_name}-${arch}" 334 ( 335 rm -rf "${docker_build_path}" 336 mkdir -p "${docker_build_path}" 337 ln "${binary_file_path}" "${docker_build_path}/${binary_name}" 338 339 local build_log="${docker_build_path}/build.log" 340 if ! DOCKER_CLI_EXPERIMENTAL=enabled "${DOCKER[@]}" buildx build \ 341 -f "${docker_file_path}" \ 342 --platform linux/"${arch}" \ 343 --load ${docker_build_opts:+"${docker_build_opts}"} \ 344 -t "${docker_image_tag}" \ 345 --build-arg BASEIMAGE="${base_image}" \ 346 --build-arg SETCAP_IMAGE="${KUBE_BUILD_SETCAP_IMAGE}" \ 347 --build-arg BINARY="${binary_name}" \ 348 "${docker_build_path}" >"${build_log}" 2>&1; then 349 cat "${build_log}" 350 exit 1 351 fi 352 rm "${build_log}" 353 354 # If we are building an official/alpha/beta release we want to keep 355 # docker images and tag them appropriately. 356 local -r release_docker_image_tag="${KUBE_DOCKER_REGISTRY-$docker_registry}/${binary_name}-${arch}:${KUBE_DOCKER_IMAGE_TAG-$docker_tag}" 357 if [[ "${release_docker_image_tag}" != "${docker_image_tag}" ]]; then 358 kube::log::status "Tagging docker image ${docker_image_tag} as ${release_docker_image_tag}" 359 "${DOCKER[@]}" rmi "${release_docker_image_tag}" 2>/dev/null || true 360 "${DOCKER[@]}" tag "${docker_image_tag}" "${release_docker_image_tag}" 2>/dev/null 361 fi 362 "${DOCKER[@]}" save -o "${binary_file_path}.tar" "${docker_image_tag}" "${release_docker_image_tag}" 363 echo "${docker_tag}" > "${binary_file_path}.docker_tag" 364 rm -rf "${docker_build_path}" 365 ln "${binary_file_path}.tar" "${images_dir}/" 366 367 kube::log::status "Deleting docker image ${docker_image_tag}" 368 "${DOCKER[@]}" rmi "${docker_image_tag}" &>/dev/null || true 369 ) & 370 done 371 372 if [[ "${KUBE_BUILD_CONFORMANCE}" =~ [yY] ]]; then 373 kube::release::build_conformance_image "${arch}" "${docker_registry}" \ 374 "${docker_tag}" "${images_dir}" & 375 fi 376 377 kube::util::wait-for-jobs || { kube::log::error "previous Docker build failed"; return 1; } 378 kube::log::status "Docker builds done" 379 ) 380 381 } 382 383 # This will pack kube-system manifests files for distros such as COS. 384 function kube::release::package_kube_manifests_tarball() { 385 kube::log::status "Building tarball: manifests" 386 387 local src_dir="${KUBE_ROOT}/cluster/gce/manifests" 388 389 local release_stage="${RELEASE_STAGE}/manifests/kubernetes" 390 rm -rf "${release_stage}" 391 392 local dst_dir="${release_stage}/gci-trusty" 393 mkdir -p "${dst_dir}" 394 cp "${src_dir}/kube-proxy.manifest" "${dst_dir}/" 395 cp "${src_dir}/cluster-autoscaler.manifest" "${dst_dir}/" 396 cp "${src_dir}/etcd.manifest" "${dst_dir}" 397 cp "${src_dir}/kube-scheduler.manifest" "${dst_dir}" 398 cp "${src_dir}/kube-apiserver.manifest" "${dst_dir}" 399 cp "${src_dir}/konnectivity-server.yaml" "${dst_dir}" 400 cp "${src_dir}/abac-authz-policy.jsonl" "${dst_dir}" 401 cp "${src_dir}/cloud-controller-manager.manifest" "${dst_dir}" 402 cp "${src_dir}/kube-controller-manager.manifest" "${dst_dir}" 403 cp "${src_dir}/kube-addon-manager.yaml" "${dst_dir}" 404 cp "${src_dir}/glbc.manifest" "${dst_dir}" 405 find "${src_dir}" -name 'internal-*' -exec cp {} "${dst_dir}" \; 406 cp "${KUBE_ROOT}/cluster/gce/gci/configure-helper.sh" "${dst_dir}/gci-configure-helper.sh" 407 cp "${KUBE_ROOT}/cluster/gce/gci/configure-kubeapiserver.sh" "${dst_dir}/configure-kubeapiserver.sh" 408 if [[ -e "${KUBE_ROOT}/cluster/gce/gci/gke-internal-configure-helper.sh" ]]; then 409 cp "${KUBE_ROOT}/cluster/gce/gci/gke-internal-configure-helper.sh" "${dst_dir}/" 410 fi 411 cp "${KUBE_ROOT}/cluster/gce/gci/health-monitor.sh" "${dst_dir}/health-monitor.sh" 412 # Merge GCE-specific addons with general purpose addons. 413 for d in cluster/addons cluster/gce/addons; do 414 find "${KUBE_ROOT}/${d}" \( \( -name \*.yaml -o -name \*.yaml.in -o -name \*.json \) -a ! \( -name \*demo\* \) \) -print0 | "${TAR}" c --transform "s|${KUBE_ROOT#/*}/${d}||" --null -T - | "${TAR}" x -C "${dst_dir}" 415 done 416 417 kube::release::clean_cruft 418 419 local package_name="${RELEASE_TARS}/kubernetes-manifests.tar.gz" 420 kube::release::create_tarball "${package_name}" "${release_stage}/.." 421 } 422 423 # Builds tarballs for each test platform containing the appropriate binaries. 424 function kube::release::package_test_platform_tarballs() { 425 local platform 426 rm -rf "${RELEASE_STAGE}/test" 427 # KUBE_TEST_SERVER_PLATFORMS is a subset of KUBE_TEST_PLATFORMS, 428 # so process it first. 429 for platform in "${KUBE_TEST_SERVER_PLATFORMS[@]}"; do 430 local platform_tag=${platform/\//-} # Replace a "/" for a "-" 431 local release_stage="${RELEASE_STAGE}/test/${platform_tag}/kubernetes" 432 mkdir -p "${release_stage}/test/bin" 433 # This fancy expression will expand to prepend a path 434 # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the 435 # KUBE_TEST_SERVER_BINARIES array. 436 cp "${KUBE_TEST_SERVER_BINARIES[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ 437 "${release_stage}/test/bin/" 438 done 439 for platform in "${KUBE_TEST_PLATFORMS[@]}"; do 440 ( 441 local platform_tag=${platform/\//-} # Replace a "/" for a "-" 442 kube::log::status "Starting tarball: test $platform_tag" 443 local release_stage="${RELEASE_STAGE}/test/${platform_tag}/kubernetes" 444 mkdir -p "${release_stage}/test/bin" 445 446 local test_bins=("${KUBE_TEST_BINARIES[@]}") 447 if [[ "${platform%/*}" = 'windows' ]]; then 448 test_bins=("${KUBE_TEST_BINARIES_WIN[@]}") 449 fi 450 # This fancy expression will expand to prepend a path 451 # (${LOCAL_OUTPUT_BINPATH}/${platform}/) to every item in the 452 # test_bins array. 453 cp "${test_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ 454 "${release_stage}/test/bin/" 455 456 local package_name="${RELEASE_TARS}/kubernetes-test-${platform_tag}.tar.gz" 457 kube::release::create_tarball "${package_name}" "${release_stage}/.." 458 ) & 459 done 460 461 kube::log::status "Waiting on test tarballs" 462 kube::util::wait-for-jobs || { kube::log::error "test tarball creation failed"; exit 1; } 463 } 464 465 466 # This is the stuff you need to run tests from the binary distribution. 467 function kube::release::package_test_tarballs() { 468 kube::release::package_test_platform_tarballs 469 470 kube::log::status "Building tarball: test portable" 471 472 local release_stage="${RELEASE_STAGE}/test/kubernetes" 473 rm -rf "${release_stage}" 474 mkdir -p "${release_stage}" 475 476 # First add test image files and other portable sources so we can create 477 # the portable test tarball. 478 mkdir -p "${release_stage}/test/images" 479 cp -fR "${KUBE_ROOT}/test/images" "${release_stage}/test/" 480 "${TAR}" c "${KUBE_TEST_PORTABLE[@]}" | "${TAR}" x -C "${release_stage}" 481 482 kube::release::clean_cruft 483 484 local portable_tarball_name="${RELEASE_TARS}/kubernetes-test-portable.tar.gz" 485 kube::release::create_tarball "${portable_tarball_name}" "${release_stage}/.." 486 } 487 488 # This is all the platform-independent stuff you need to run/install kubernetes. 489 # Arch-specific binaries will need to be downloaded separately (possibly by 490 # using the bundled cluster/get-kube-binaries.sh script). 491 # Included in this tarball: 492 # - Cluster spin up/down scripts and configs for various cloud providers 493 # - Tarballs for manifest configs that are ready to be uploaded 494 # - Examples (which may or may not still work) 495 # - The remnants of the docs/ directory 496 function kube::release::package_final_tarball() { 497 kube::log::status "Building tarball: final" 498 499 # This isn't a "full" tarball anymore, but the release lib still expects 500 # artifacts under "full/kubernetes/" 501 local release_stage="${RELEASE_STAGE}/full/kubernetes" 502 rm -rf "${release_stage}" 503 mkdir -p "${release_stage}" 504 505 mkdir -p "${release_stage}/client" 506 cat <<EOF > "${release_stage}/client/README" 507 Client binaries are no longer included in the Kubernetes final tarball. 508 509 Run cluster/get-kube-binaries.sh to download client and server binaries. 510 EOF 511 512 # We want everything in /cluster. 513 cp -R "${KUBE_ROOT}/cluster" "${release_stage}/" 514 515 mkdir -p "${release_stage}/server" 516 cp "${RELEASE_TARS}/kubernetes-manifests.tar.gz" "${release_stage}/server/" 517 cat <<EOF > "${release_stage}/server/README" 518 Server binary tarballs are no longer included in the Kubernetes final tarball. 519 520 Run cluster/get-kube-binaries.sh to download client and server binaries. 521 EOF 522 523 # Include hack/lib as a dependency for the cluster/ scripts 524 mkdir -p "${release_stage}/hack" 525 cp -R "${KUBE_ROOT}/hack/lib" "${release_stage}/hack/" 526 527 cp -R "${KUBE_ROOT}/docs" "${release_stage}/" 528 cp "${KUBE_ROOT}/README.md" "${release_stage}/" 529 cp -R "${KUBE_ROOT}/LICENSES" "${release_stage}/" 530 531 echo "${KUBE_GIT_VERSION}" > "${release_stage}/version" 532 533 kube::release::clean_cruft 534 535 local package_name="${RELEASE_TARS}/kubernetes.tar.gz" 536 kube::release::create_tarball "${package_name}" "${release_stage}/.." 537 } 538 539 # Build a release tarball. $1 is the output tar name. $2 is the base directory 540 # of the files to be packaged. This assumes that ${2}/kubernetes is what is 541 # being packaged. 542 function kube::release::create_tarball() { 543 kube::build::ensure_tar 544 545 local tarfile=$1 546 local stagingdir=$2 547 548 "${TAR}" czf "${tarfile}" -C "${stagingdir}" kubernetes --owner=0 --group=0 549 }