azure arm template for oneclick deploy
[logging-analytics.git] / deploy / azure / oom_deployment.sh
1 #!/bin/bash
2 #############################################################################
3 #
4 # Copyright © 2018 Amdocs. All rights reserved.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #        http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 #############################################################################
18 #
19 # This installation is for a rancher managed install of kubernetes
20 # after this run the standard oom install
21 # this installation can be run on amy ubuntu 16.04 VM or physical host
22 # https://wiki.onap.org/display/DW/ONAP+on+Kubernetes
23 # source from https://jira.onap.org/browse/OOM-715
24 # Michael O'Brien
25 # Amsterdam
26 #     Rancher 1.6.10, Kubernetes 1.7.7, Kubectl 1.7.7, Helm 2.3.0, Docker 1.12
27 # master
28 #     Rancher 1.6.14, Kubernetes 1.8.6, Kubectl 1.8.6, Helm 2.6.1, Docker 17.03
29 # run as root - because of the logout that would be required after the docker user set
30 usage() {
31 cat <<EOF
32 Usage: $0 [PARAMs]
33 -u                  : Display usage
34 -b [branch]         : branch = master or amsterdam (required)
35 -s [server]         : server = IP or DNS name (required)
36 -e [environment]    : use the default (onap)
37 -r [resourcegroup]  : ARM resource group name
38 -t [template]       : ARM template file
39 -p [parameters]     : ARM parameters file
40 EOF
41 }
42
43 install_onap() {
44   az group delete --name $RESOURCE_GROUP -y
45   az group create --name $RESOURCE_GROUP --location eastus2
46   az group deployment create --resource-group $RESOURCE_GROUP --template-file $TEMPLATE --parameters @$PARAMETERS 
47 }
48
49
50 BRANCH=
51 SERVER=
52 ENVIRON=
53 RESOURCE_GROUP=
54 TEMPLATE=
55 PARAMETERS=
56 while getopts ":b:s:e:r:t:p:u:" PARAM; do
57   case $PARAM in
58     u)
59       usage
60       exit 1
61       ;;
62     b)
63       BRANCH=${OPTARG}
64       ;;
65     e)
66       ENVIRON=${OPTARG}
67       ;;
68     s)
69       SERVER=${OPTARG}
70       ;;
71     r)
72       RESOURCE_GROUP=${OPTARG}
73       ;;
74     t)
75       TEMPLATE=${OPTARG}
76       ;;
77     p)
78       PARAMETERS=${OPTARG}
79       ;;
80     ?)
81       usage
82       exit
83       ;;
84     esac
85 done
86
87 if [[ -z $BRANCH ]]; then
88   usage
89   exit 1
90 fi
91
92 install_onap $RESOURCE_GROUP $TEMPLATE $BRANCH $SERVER $ENVIRON $PARAMETERS