summaryrefslogtreecommitdiffstats
path: root/kubernetes/config/createConfig.sh
blob: 154bad58ca7a79d31050546829c770a6abc86ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

usage() {
  cat <<EOF
Usage: $0 [PARAMs]
-u                  : Display usage
-n [NAMESPACE]      : Kubernetes namespace (required)
EOF
}

create_namespace() {
  kubectl create namespace $1
}

create_configuration() {
  create_namespace $1
  helm install . --name "$1-config" --namespace $1 --set nsPrefix=$1
}

#MAINs
NS=

while getopts ":n:u:" PARAM; do
  case $PARAM in
    u)
      usage
      exit 1
      ;;
    n)
      NS=${OPTARG}
      ;;
    ?)
      usage
      exit
      ;;
  esac
done

if [[ -z $NS ]]; then
  usage
  exit 1
fi

printf "\n**** Creating configuration for ONAP instance: $NS\n"
create_configuration $NS

printf "**** Done ****\n"