vtgate-up.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # Copyright 2015 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 is an example script that starts a vtgate replicationcontroller.
  16. set -e
  17. script_root=`dirname "${BASH_SOURCE}"`
  18. source $script_root/env.sh
  19. VTGATE_REPLICAS=${VTGATE_REPLICAS:-3}
  20. VTGATE_TEMPLATE=${VTGATE_TEMPLATE:-'vtgate-controller-template.yaml'}
  21. replicas=$VTGATE_REPLICAS
  22. echo "Creating vtgate service..."
  23. $KUBECTL create -f vtgate-service.yaml
  24. sed_script=""
  25. for var in replicas; do
  26. sed_script+="s,{{$var}},${!var},g;"
  27. done
  28. echo "Creating vtgate replicationcontroller..."
  29. cat $VTGATE_TEMPLATE | sed -e "$sed_script" | $KUBECTL create -f -