kubeadm.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env bash
  2. # Copyright 2016 The Kubernetes Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. set -o errexit
  16. set -o nounset
  17. set -o pipefail
  18. KUBE_ROOT=${KUBE_ROOT:-$(dirname "${BASH_SOURCE[0]}")/..}
  19. source "${KUBE_ROOT}/cluster/clientbin.sh"
  20. # If KUBEADM_PATH isn't set, gather up the list of likely places and use ls
  21. # to find the latest one.
  22. if [[ -z "${KUBEADM_PATH:-}" ]]; then
  23. kubeadm=$( get_bin "kubeadm" "cmd/kubeadm" )
  24. if [[ ! -x "$kubeadm" ]]; then
  25. print_error "kubeadm"
  26. exit 1
  27. fi
  28. elif [[ ! -x "${KUBEADM_PATH}" ]]; then
  29. {
  30. echo "KUBEADM_PATH environment variable set to '${KUBEADM_PATH}', but "
  31. echo "this doesn't seem to be a valid executable."
  32. } >&2
  33. exit 1
  34. fi
  35. kubeadm="${KUBEADM_PATH:-${kubeadm}}"
  36. "${kubeadm}" "${@+$@}"