2 #############################################################################
4 # Copyright © 2018 Amdocs.
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
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.
17 #############################################################################
19 # Amazon AWS specific EFS/NFS share and rancher host join script for each cluster node
20 # https://wiki.onap.org/display/DW/Cloud+Native+Deployment
21 # source from https://jira.onap.org/browse/OOM-320
23 # LOG-806 upgrade for Rancher 1.6.22, kubernetes 1.11
24 # master/dublin - LOG-895
25 # Rancher 1.6.25, Kubernetes 1.11.3, kubectl 1.11.3, Helm 2.9.2, Docker 17.03
33 sudo ./cluster.sh -n false -s cl.onap.info -e fs-00c0f00 -r us-east-2
35 sudo ./cluster.sh -n true -s cl.onap.info -e fs-00c0f00 -r us-east-2 -t 23D4:15:qQ -c false -a host1.onap.info -v true
36 sudo ./oom_cluster_host_install.sh -n true -s cd.onap.cloud -e 1 -r us-east-2 -t token -c false -a 104.209.158.156 -v true
38 You must create an EFS (NFS wrapper) on AWS
41 -n [true|false] : is node (non master)
42 -s [master server] : target server (ip or FQDN only)
43 -e [AWS efs id] : AWS Elastic File System ID prefix
44 -r [AWS region prefix] : AWS Region prefix
45 -t [token] : registration token
46 -h [agent ver] : agent version (default 1.2.10 for 1.6.18
47 -c [true/false] : use computed client address
48 -a [IP address] : client address ip - no FQDN
49 -v [validate true/false]: optional
55 DOCKERDATA_NFS=dockerdata-nfs
60 if [[ "$IS_NODE" != false ]]; then
61 sudo curl https://releases.rancher.com/install-docker/$DOCKER_VER.sh | sh
62 sudo usermod -aG docker $USERNAME
64 sudo apt-get install nfs-common -y
65 sudo mkdir /$DOCKERDATA_NFS
66 sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $AWS_EFS.efs.$AWS_REGION.amazonaws.com:/ /$DOCKERDATA_NFS
67 if [[ "$IS_NODE" != false ]]; then
68 echo "Running agent docker..."
69 if [[ "$COMPUTEADDRESS" != false ]]; then
70 echo "sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v$AGENT_VER http://$MASTER:$PORT/v1/scripts/$TOKEN"
71 sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v$AGENT_VER http://$MASTER:$PORT/v1/scripts/$TOKEN
73 echo "sudo docker run -e CATTLE_AGENT_IP=\"$ADDRESS\" --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v$AGENT_VER http://$MASTER:$PORT/v1/scripts/$TOKEN"
74 sudo docker run -e CATTLE_AGENT_IP="$ADDRESS" --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v$AGENT_VER http://$MASTER:$PORT/v1/scripts/$TOKEN
88 while getopts ":u:n:s:e:r:t:h:c:a:v" PARAM; do
113 COMPUTEADDRESS=${OPTARG}
128 if [ -z $MASTER ]; then
133 register_node $IS_NODE $MASTER $AWS_EFS $AWS_REGION $TOKEN $AGENT_VER $COMPUTEADDRESS $ADDRESS $VALIDATE
134 echo "check dockerdata-nfs"
135 sudo ls /dockerdata-nfs
136 echo "if you get http://$MASTER:8880/v1 is not accessible (The requested URL returned error: 404 Not Found) - check your token"
137 printf "**** Success: Done ****\n"