startall.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. ##############################################################################
  3. #
  4. # HPCC SYSTEMS software Copyright (C) 2020 HPCC Systems®.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. ##############################################################################
  18. # Utility script for starting a local cluster corresponding to current git branch
  19. # Usage startup.sh [<image.version>] [<helm-install-options>]
  20. DOCKER_REPO=hpccsystems
  21. scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
  22. restArgs=()
  23. CMD="install"
  24. while [ "$#" -gt 0 ]; do
  25. arg=$1
  26. if [[ ${arg:0:1} == '-' ]]; then
  27. case "${arg:1:1}" in
  28. l) shift
  29. LABEL=$1
  30. ;;
  31. d) shift;
  32. INPUT_DOCKER_REPO=$1
  33. ;;
  34. u) CMD="upgrade"
  35. ;;
  36. p) shift
  37. PERSIST=$1
  38. ;;
  39. h) echo "Usage: startall.sh [options]"
  40. echo " -d <docker-repo> Docker repository to fetch images from"
  41. echo " -l Build image label to use"
  42. echo " -u Use "upgrade" rather than "install"
  43. echo " -p <location> Use local persistent data
  44. exit
  45. ;;
  46. *) restArgs+=(${arg})
  47. ;;
  48. esac
  49. else
  50. restArgs+=(${arg})
  51. fi
  52. shift
  53. done
  54. [[ -n ${INPUT_DOCKER_REPO} ]] && DOCKER_REPO=${INPUT_DOCKER_REPO}
  55. [[ -z ${LABEL} ]] && LABEL=$(docker image ls | fgrep "${DOCKER_REPO}/platform-core" | head -n 1 | awk '{print $2}')
  56. if [[ -n ${PERSIST} ]] ; then
  57. mkdir -p ${PERSIST}/dlls
  58. mkdir -p ${PERSIST}/dali
  59. mkdir -p ${PERSIST}/data
  60. helm ${CMD} localfile $scriptdir/../helm/examples/local/hpcc-localfile --set common.hostpath=${PERSIST} | grep -A100 storage > localstorage.yaml && \
  61. helm ${CMD} mycluster $scriptdir/../helm/hpcc/ --set global.image.root="${DOCKER_REPO}" --set global.image.version=$LABEL --set global.privileged=true -f localstorage.yaml ${restArgs[@]}
  62. else
  63. helm ${CMD} mycluster $scriptdir/../helm/hpcc/ --set global.image.root="${DOCKER_REPO}" --set global.image.version=$LABEL --set global.privileged=true ${restArgs[@]}
  64. fi
  65. sleep 1
  66. kubectl get pods