util.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env bash
  2. # Copyright 2017 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 contains the helper functions that each provider hosting
  16. # Kubermark must implement to use test/kubemark/start-kubemark.sh and
  17. # test/kubemark/stop-kubemark.sh scripts.
  18. # This function should authenticate docker to be able to read/write to
  19. # the right container registry (needed for pushing kubemark image).
  20. function authenticate-docker {
  21. echo "Configuring registry authentication" 1>&2
  22. }
  23. # This function should create kubemark master and write kubeconfig to
  24. # "${RESOURCE_DIRECTORY}/kubeconfig.kubemark".
  25. # If a cluster uses private master IP, create-kubemark-master might also write
  26. # a second kubeconfig to "${RESOURCE_DIRECTORY}/kubeconfig-internal.kubemark".
  27. # The difference between these two kubeconfigs is that the internal one uses
  28. # private master IP, which might be better suited for setting up hollow nodes.
  29. function create-kubemark-master {
  30. echo "Creating cluster..."
  31. }
  32. # This function should delete kubemark master.
  33. function delete-kubemark-master {
  34. echo "Deleting cluster..."
  35. }
  36. # This function should return node labels.
  37. function calculate-node-labels {
  38. echo ""
  39. }
  40. # Common colors used throughout the kubemark scripts
  41. if [[ -z "${color_start-}" ]]; then
  42. declare -r color_start="\033["
  43. # shellcheck disable=SC2034
  44. declare -r color_red="${color_start}0;31m"
  45. # shellcheck disable=SC2034
  46. declare -r color_yellow="${color_start}0;33m"
  47. # shellcheck disable=SC2034
  48. declare -r color_green="${color_start}0;32m"
  49. # shellcheck disable=SC2034
  50. declare -r color_blue="${color_start}1;34m"
  51. # shellcheck disable=SC2034
  52. declare -r color_cyan="${color_start}1;36m"
  53. # shellcheck disable=SC2034
  54. declare -r color_norm="${color_start}0m"
  55. fi