An orchestrator for managing a collection of Kubernetes Helm charts.
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.

controller.sh 1.3KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. clean_container(){
  3. echo "Destroying $1 container..."
  4. docker stop $1 >/dev/null
  5. docker rm $1 >/dev/null
  6. echo "...container destroyed"
  7. }
  8. readlink(){
  9. (
  10. cd $(dirname $1)
  11. echo $PWD/$(basename $1)
  12. )
  13. }
  14. # Check to see if the aramada container exists
  15. if [ -n "$( sudo docker ps -a | grep quay.io/airshipit/armada )" ]; then
  16. echo "Armada container already exists..."
  17. clean_container armada
  18. fi
  19. # Check to see if the user is trying to apply a chart
  20. if [ $1 = "apply" ]; then
  21. # TODO Handle erroneous or missing inputs
  22. # Bring up a new armada container with passed in yaml mounted to the container
  23. echo "Creating an Armada container..."
  24. docker run -d --net host -p 8000:8000 --name armada -v $(readlink $(dirname $2)):$(readlink $(dirname $2)) -v ~/.kube/config:/armada/.kube/config -v ~/.kube/plugins/armada/examples/:/examples quay.io/airshipit/armada:latest
  25. docker exec armada armada apply $(readlink $2)
  26. else
  27. # For any other command the chart does not need to be mounted to the container
  28. # Bring up a new armada container
  29. echo "Creating an Armada container..."
  30. docker run -d --net host -p 8000:8000 --name armada -v ~/.kube/config:/armada/.kube/config -v ~/.kube/plugins/armada/examples/:/examples quay.io/airshipit/armada:latest
  31. docker exec armada armada "$@"
  32. fi
  33. clean_container armada