Mike Elliott | d17accd | 2017-08-14 16:21:40 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | usage() { |
| 4 | cat <<EOF |
| 5 | Usage: $0 [PARAMs] |
| 6 | -u : Display usage |
| 7 | -n [NAMESPACE] : Kubernetes namespace (required) |
| 8 | EOF |
| 9 | } |
| 10 | |
| 11 | create_namespace() { |
| 12 | kubectl create namespace $1 |
| 13 | } |
| 14 | |
| 15 | create_configuration() { |
| 16 | create_namespace $1 |
| 17 | kubectl --namespace $1 create -f pod-config-init.yaml |
| 18 | } |
| 19 | |
| 20 | #MAINs |
| 21 | NS= |
| 22 | |
| 23 | while getopts ":n:u:" PARAM; do |
| 24 | case $PARAM in |
| 25 | u) |
| 26 | usage |
| 27 | exit 1 |
| 28 | ;; |
| 29 | n) |
| 30 | NS=${OPTARG} |
| 31 | ;; |
| 32 | ?) |
| 33 | usage |
| 34 | exit |
| 35 | ;; |
| 36 | esac |
| 37 | done |
| 38 | |
| 39 | if [[ -z $NS ]]; then |
| 40 | usage |
| 41 | exit 1 |
| 42 | fi |
| 43 | |
| 44 | printf "\n**** Creating configuration for ONAP instance: $NS\n" |
| 45 | create_configuration $NS |
| 46 | |
| 47 | printf "**** Done ****\n" |