GitOps for k8s
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

e2e-flux-chart.sh 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/usr/bin/env bash
  2. set -o errexit
  3. export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
  4. REPO_ROOT=$(git rev-parse --show-toplevel)
  5. KNOWN_HOSTS=$(cat ${REPO_ROOT}/test/e2e/known_hosts)
  6. echo ">>> Loading $(docker/image-tag) into the cluster"
  7. kind load docker-image "docker.io/weaveworks/flux:$(docker/image-tag)"
  8. kind load docker-image "docker.io/weaveworks/helm-operator:$(docker/image-tag)"
  9. echo ">>> Installing Flux with Helm"
  10. helm install --name flux --wait \
  11. --namespace flux \
  12. --set image.tag=$(docker/image-tag) \
  13. --set git.url=ssh://git@gitsrv/git-server/repos/cluster.git \
  14. --set git.secretName=ssh-git \
  15. --set git.pollInterval=30s \
  16. --set helmOperator.tag=$(docker/image-tag) \
  17. --set helmOperator.create=true \
  18. --set helmOperator.createCRD=true \
  19. --set helmOperator.git.secretName=ssh-git \
  20. --set registry.excludeImage=* \
  21. --set-string ssh.known_hosts="${KNOWN_HOSTS}" \
  22. ${REPO_ROOT}/chart/flux
  23. echo '>>> Waiting for namespace demo'
  24. retries=12
  25. count=0
  26. ok=false
  27. until ${ok}; do
  28. kubectl describe ns/demo && ok=true || ok=false
  29. sleep 10
  30. count=$(($count + 1))
  31. if [[ ${count} -eq ${retries} ]]; then
  32. kubectl -n flux logs deployment/flux
  33. echo "No more retries left"
  34. exit 1
  35. fi
  36. done
  37. echo '>>> Waiting for workload podinfo'
  38. retries=12
  39. count=0
  40. ok=false
  41. until ${ok}; do
  42. kubectl -n demo describe deployment/podinfo && ok=true || ok=false
  43. sleep 10
  44. count=$(($count + 1))
  45. if [[ ${count} -eq ${retries} ]]; then
  46. kubectl -n flux logs deployment/flux
  47. echo "No more retries left"
  48. exit 1
  49. fi
  50. done
  51. echo '>>> Waiting for Helm release mongodb'
  52. retries=12
  53. count=0
  54. ok=false
  55. until ${ok}; do
  56. kubectl -n demo describe deployment/mongodb && ok=true || ok=false
  57. sleep 10
  58. count=$(($count + 1))
  59. if [[ ${count} -eq ${retries} ]]; then
  60. kubectl -n flux logs deployment/flux
  61. kubectl -n flux logs deployment/flux-helm-operator
  62. echo "No more retries left"
  63. exit 1
  64. fi
  65. done
  66. echo ">>> Flux logs"
  67. kubectl -n flux logs deployment/flux
  68. echo ">>> Helm Operator logs"
  69. kubectl -n flux logs deployment/flux-helm-operator
  70. echo ">>> List pods"
  71. kubectl -n demo get pods
  72. echo ">>> Check workload"
  73. kubectl -n demo rollout status deployment/podinfo
  74. echo ">>> Check Helm release"
  75. kubectl -n demo rollout status deployment/mongodb