kube-util.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. # Copyright 2014 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. # This script will source the default skeleton helper functions, then sources
  16. # cluster/${KUBERNETES_PROVIDER}/util.sh where KUBERNETES_PROVIDER, if unset,
  17. # will use its default value (gce).
  18. KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
  19. source "${KUBE_ROOT}/cluster/skeleton/util.sh"
  20. if [[ "${KUBERNETES_PROVIDER:-}" != "kubernetes-anywhere" ]]; then
  21. if [[ -n "${KUBERNETES_CONFORMANCE_TEST:-}" ]]; then
  22. KUBERNETES_PROVIDER=""
  23. else
  24. KUBERNETES_PROVIDER="${KUBERNETES_PROVIDER:-gce}"
  25. fi
  26. fi
  27. # PROVIDER_VARS is a list of cloud provider specific variables. Note:
  28. # this is a list of the _names_ of the variables, not the value of the
  29. # variables. Providers can add variables to be appended to kube-env.
  30. # (see `build-kube-env`).
  31. PROVIDER_UTILS="${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
  32. if [ -f "${PROVIDER_UTILS}" ]; then
  33. source "${PROVIDER_UTILS}"
  34. fi