diff options
author | 2017-10-17 13:33:32 -0700 | |
---|---|---|
committer | 2017-10-17 14:05:47 -0700 | |
commit | 68950cfed4850a7b1089ee2956f106ecd8ff132e (patch) | |
tree | 6fa2384ce59ddade3a53819314927269c54ca68a /tools | |
parent | b2c252cd8913ef15a00d63a391da1c8a8a17d739 (diff) |
Testing merged cloud-native models code
JIRA: MODELS-23
Cleaned trailing whitespace.
Fixed bugs with Rancher etc setup:
- ssh -o where needed in demo_deploy.sh
- Comment out Rancher-managed Grafana deploy
- Pull dashboards direct from clone
Change-Id: I02707488563a1db4262ebcdf735331707e36fa61
Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/docker/demo_deploy.sh | 10 | ||||
-rw-r--r-- | tools/docker/docker-cluster.sh | 20 | ||||
-rw-r--r-- | tools/kubernetes/demo_deploy.sh | 25 | ||||
-rw-r--r-- | tools/kubernetes/k8s-cluster.sh | 30 | ||||
-rw-r--r-- | tools/maas/deploy.sh | 8 | ||||
-rw-r--r-- | tools/prometheus/prometheus-tools.sh | 16 | ||||
-rw-r--r-- | tools/rancher/demo_deploy.sh | 14 | ||||
-rw-r--r-- | tools/rancher/rancher-cluster.sh | 60 | ||||
-rw-r--r-- | tools/traffic.sh | 4 |
9 files changed, 94 insertions, 93 deletions
diff --git a/tools/docker/demo_deploy.sh b/tools/docker/demo_deploy.sh index cbfe949..9454c0e 100644 --- a/tools/docker/demo_deploy.sh +++ b/tools/docker/demo_deploy.sh @@ -1,12 +1,12 @@ #!/bin/bash # Copyright 2017 AT&T Intellectual Property, Inc -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ #. - prometheus + grafana for cluster monitoring/stats #. Prometheus dashboard: http://<master_public_ip>:9090 #. Grafana dashboard: http://<master_public_ip>:3000 -#. +#. #. Prerequisites: #. - Ubuntu server for cluster nodes (admin/master and worker nodes) #. - MAAS server as cluster admin for Rancher master/worker nodes @@ -47,7 +47,7 @@ ssh-add $key echo "Setting up Docker..." bash ~/models/tools/docker/docker-cluster.sh all $master "$workers" # TODO: Figure this out... Have to break the setup into two steps as something -# causes the ssh session to end before the prometheus setup, if both scripts +# causes the ssh session to end before the prometheus setup, if both scripts # (k8s-cluster and prometheus-tools) are in the same ssh session echo "Setting up Prometheus..." scp -o StrictHostKeyChecking=no $key ubuntu@$master:/home/ubuntu/$key diff --git a/tools/docker/docker-cluster.sh b/tools/docker/docker-cluster.sh index 8c0aa69..7404e4a 100644 --- a/tools/docker/docker-cluster.sh +++ b/tools/docker/docker-cluster.sh @@ -1,20 +1,20 @@ #!/bin/bash # Copyright 2017 AT&T Intellectual Property, Inc -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # -#. What this is: Deployment script for a mult-node docker-ce cluster. -#. Prerequisites: +#. What this is: Deployment script for a mult-node docker-ce cluster. +#. Prerequisites: #. - Ubuntu server for master and worker nodes #. Usage: #. $ git clone https://gerrit.opnfv.org/gerrit/models ~/models @@ -28,12 +28,12 @@ #. $ bash docker_cluster.sh setup <master> "<workers>" #. Installs and starts master and worker nodes. #. $ bash docker_cluster.sh create <service> -#. <service>: Demo service name to start. +#. <service>: Demo service name to start. #. Currently supported: nginx #. $ bash docker_cluster.sh delete <service> #. <service>: Service name to delete. #. $ bash docker_cluster.sh clean [<node>] -#. <node>: optional IP address of node to clean. +#. <node>: optional IP address of node to clean. #. By default, cleans the entire cluster. #. @@ -113,7 +113,7 @@ function create_service() { ;; *) echo "${FUNCNAME[0]}: service $1 not setup for use with this script" - esac + esac if ! curl -X POST http://$master:4243/services/create -d @$1.json ; then echo "${FUNCNAME[0]}: service creation failed" @@ -142,8 +142,8 @@ function check_service() { echo "${FUNCNAME[0]}: service is not yet active, waiting 10 seconds" sleep 10 done - curl -s -o /tmp/resp http://$node:$port - if [[ $(grep -c "$match" /tmp/resp) == 0 ]]; then + curl -s -o /tmp/resp http://$node:$port + if [[ $(grep -c "$match" /tmp/resp) == 0 ]]; then not="NOT" fi echo "$service service is $not active at address http://$node:$port" diff --git a/tools/kubernetes/demo_deploy.sh b/tools/kubernetes/demo_deploy.sh index b3d165b..b7935de 100644 --- a/tools/kubernetes/demo_deploy.sh +++ b/tools/kubernetes/demo_deploy.sh @@ -1,12 +1,12 @@ #!/bin/bash # Copyright 2017 AT&T Intellectual Property, Inc -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,14 +22,14 @@ #. will be setup with: #. Prometheus dashboard: http://<admin_public_ip>:9090 #. Grafana dashboard: http://<admin_public_ip>:3000 -#. +#. #. Prerequisites: #. - Ubuntu server for kubernetes cluster nodes (admin/master and agent nodes) #. - MAAS server as cluster admin for kubernetes master/agent nodes #. - Password-less ssh key provided for node setup #. Usage: on the MAAS server #. $ git clone https://gerrit.opnfv.org/gerrit/models ~/models -#. $ bash ~/models/tools/kubernetes/demo_deploy.sh <key> "<hosts>" <admin ip> +#. $ bash ~/models/tools/kubernetes/demo_deploy.sh <key> "<hosts>" <admin ip> #. "<agent ips>" <pub-net> <priv-net> [<extras>] #. <key>: name of private key for cluster node ssh (in current folder) #. <hosts>: space separated list of hostnames managed by MAAS @@ -51,24 +51,25 @@ ssh-add $key if [[ "x$extras" != "x" ]]; then source $extras; fi scp -o StrictHostKeyChecking=no $key ubuntu@$admin_ip:/home/ubuntu/$key echo "Setting up kubernetes..." -ssh -x ubuntu@$admin_ip <<EOF +ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip <<EOF exec ssh-agent bash ssh-add $key git clone https://gerrit.opnfv.org/gerrit/models bash models/tools/kubernetes/k8s-cluster.sh all "$agent_ips" $priv_net $pub_net EOF # TODO: Figure this out... Have to break the setup into two steps as something -# causes the ssh session to end before the prometheus setup, if both scripts +# causes the ssh session to end before the prometheus setup, if both scripts # (k8s-cluster and prometheus-tools) are in the same ssh session echo "Setting up prometheus..." -ssh -x ubuntu@$admin_ip <<EOF +ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip <<EOF exec ssh-agent bash ssh-add $key bash models/tools/prometheus/prometheus-tools.sh all "$agent_ips" EOF echo "Setting up cloudify..." -scp models/tools/cloudify/k8s-cloudify.sh ubuntu@$admin_ip:/home/ubuntu/. -ssh -x ubuntu@$admin_ip bash k8s-cloudify.sh prereqs -ssh -x ubuntu@$admin_ip bash k8s-cloudify.sh setup -ssh -x ubuntu@$admin_ip bash k8s-cloudify.sh demo +scp -o StrictHostKeyChecking=no ~/models/tools/cloudify/k8s-cloudify.sh \ + ubuntu@$admin_ip:/home/ubuntu/. +ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip bash k8s-cloudify.sh prereqs +ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip bash k8s-cloudify.sh setup +ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip bash k8s-cloudify.sh demo echo "All done!" diff --git a/tools/kubernetes/k8s-cluster.sh b/tools/kubernetes/k8s-cluster.sh index 6a91cdb..3d896bf 100644 --- a/tools/kubernetes/k8s-cluster.sh +++ b/tools/kubernetes/k8s-cluster.sh @@ -1,12 +1,12 @@ #!/bin/bash # Copyright 2017 AT&T Intellectual Property, Inc -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -14,7 +14,7 @@ # limitations under the License. # #. What this is: script to setup a kubernetes cluster with calico as sni -#. Prerequisites: +#. Prerequisites: #. - Ubuntu xenial server for master and agent nodes #. - key-based auth setup for ssh/scp between master and agent nodes #. - 192.168.0.0/16 should not be used on your server network interface subnets @@ -75,7 +75,7 @@ function setup_k8s_master() { echo "${FUNCNAME[0]}: Setting up kubernetes master" setup_prereqs - # Install master + # Install master bash /tmp/prereqs.sh master # per https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/ # If the following command fails, run "kubeadm reset" before trying again @@ -104,11 +104,11 @@ function setup_k8s_agents() { kubedns=$(kubectl get pods --all-namespaces | grep kube-dns | awk '{print $4}') while [[ "$kubedns" != "Running" ]]; do - echo "${FUNCNAME[0]}: kube-dns status is $kubedns. Waiting 60 seconds for it to be 'Running'" + echo "${FUNCNAME[0]}: kube-dns status is $kubedns. Waiting 60 seconds for it to be 'Running'" sleep 60 kubedns=$(kubectl get pods --all-namespaces | grep kube-dns | awk '{print $4}') done - echo "${FUNCNAME[0]}: kube-dns status is $kubedns" + echo "${FUNCNAME[0]}: kube-dns status is $kubedns" for agent in $agents; do echo "${FUNCNAME[0]}: Install agent at $agent" @@ -144,13 +144,13 @@ sudo apt update sudo apt-get install -y ntp ceph ceph-deploy EOF done - + # per http://docs.ceph.com/docs/master/start/quick-ceph-deploy/ # also https://upcommons.upc.edu/bitstream/handle/2117/101816/Degree_Thesis_Nabil_El_Alami.pdf#vote +1 echo "${FUNCNAME[0]}: Create ceph config folder ~/ceph-cluster" mkdir ~/ceph-cluster cd ~/ceph-cluster - + echo "${FUNCNAME[0]}: Create new cluster with $HOSTNAME as initial ceph-mon node" ceph-deploy new --cluster-network $cluster_net --public-network $public_net --no-ssh-copykey $HOSTNAME # Update conf per recommendations of http://docs.ceph.com/docs/jewel/rados/configuration/filesystem-recommendations/ @@ -180,7 +180,7 @@ EOF ceph-deploy osd activate ceph-osd$n:/ceph ((n++)) done - else + else echo "${FUNCNAME[0]}: Deploy OSDs" for node_ip in $node_ips; do echo "${FUNCNAME[0]}: Create ceph osd on $node_ip using $ceph_dev" @@ -204,7 +204,7 @@ EOF fi mgr=$(kubectl get pods --all-namespaces | grep kube-controller-manager | awk '{print $4}') while [[ "$mgr" != "Running" ]]; do - echo "${FUNCNAME[0]}: kube-controller-manager status is $mgr. Waiting 60 seconds for it to be 'Running'" + echo "${FUNCNAME[0]}: kube-controller-manager status is $mgr. Waiting 60 seconds for it to be 'Running'" sleep 60 mgr=$(kubectl get pods --all-namespaces | grep kube-controller-manager | awk '{print $4}') done @@ -274,7 +274,7 @@ EOF kubectl create -f /tmp/ceph-pvc.yaml while [[ "x$(kubectl get pvc -o jsonpath='{.status.phase}' claim1)" != "xBound" ]]; do echo "${FUNCNAME[0]}: Waiting for pvc claim1 to be 'Bound'" - kubectl describe pvc + kubectl describe pvc sleep 10 done echo "${FUNCNAME[0]}: pvc claim1 successfully bound to $(kubectl get pvc -o jsonpath='{.spec.volumeName}' claim1)" @@ -367,9 +367,9 @@ function demo_chart() { ;; *) echo "${FUNCNAME[0]}: demo not implemented for $1" - esac + esac # extra useful commands -# kubectl describe pvc +# kubectl describe pvc # kubectl get pvc # kubectl describe pods # kubectl get pods --namespace default @@ -396,7 +396,7 @@ function setup_helm() { # Wait till tiller is running tiller_deploy=$(kubectl get pods --all-namespaces | grep tiller-deploy | awk '{print $4}') while [[ "$tiller_deploy" != "Running" ]]; do - echo "${FUNCNAME[0]}: tiller-deploy status is $tiller_deploy. Waiting 60 seconds for it to be 'Running'" + echo "${FUNCNAME[0]}: tiller-deploy status is $tiller_deploy. Waiting 60 seconds for it to be 'Running'" sleep 60 tiller_deploy=$(kubectl get pods --all-namespaces | grep tiller-deploy | awk '{print $4}') done diff --git a/tools/maas/deploy.sh b/tools/maas/deploy.sh index ae89893..18373cc 100644 --- a/tools/maas/deploy.sh +++ b/tools/maas/deploy.sh @@ -1,12 +1,12 @@ #!/bin/bash # Copyright 2017 AT&T Intellectual Property, Inc -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,7 +15,7 @@ # #. What this is: Scripted deployment of servers using MAAS. Currently it deploys #. the default host OS as configured in MAAS. -#. +#. #. Prerequisites: #. - MAAS server configured to admin a set of servers #. - Password-less ssh key provided for node setup diff --git a/tools/prometheus/prometheus-tools.sh b/tools/prometheus/prometheus-tools.sh index ed6eb22..5c7a884 100644 --- a/tools/prometheus/prometheus-tools.sh +++ b/tools/prometheus/prometheus-tools.sh @@ -1,12 +1,12 @@ #!/bin/bash # Copyright 2017 AT&T Intellectual Property, Inc -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -14,9 +14,9 @@ # limitations under the License. # #. What this is: Functions for testing with Prometheus and Grafana. Sets up -#. Prometheus and Grafana on a master node (e.g. for kubernetes, docker, +#. Prometheus and Grafana on a master node (e.g. for kubernetes, docker, #. rancher, openstack) and agent nodes (where applications run). -#. Prerequisites: +#. Prerequisites: #. - Ubuntu server for master and agent nodes #. - Docker installed #. Usage: @@ -56,8 +56,6 @@ function setup_prometheus() { echo "${FUNCNAME[0]}: Setting up prometheus master" if [[ -d ~/prometheus ]]; then rm -rf ~/prometheus; fi mkdir ~/prometheus - mkdir ~/prometheus/dashboards - cp -r dashboards/* ~/prometheus/dashboards cd ~/prometheus wget https://github.com/prometheus/prometheus/releases/download/v2.0.0-beta.2/prometheus-2.0.0-beta.2.linux-amd64.tar.gz tar xvfz prometheus-*.tar.gz @@ -156,7 +154,7 @@ EOF -H "Content-type: application/json" \ -d @datasources.json http://admin:admin@$grafana_ip:3000/api/datasources - if [[ "$(jq -r '.message' /tmp/json)" != "Datasource added" ]]; then + if [[ "$(jq -r '.message' /tmp/json)" != "Datasource added" ]]; then fail "Datasource creation failed" fi echo "${FUNCNAME[0]}: Prometheus datasource for Grafana added" @@ -167,7 +165,7 @@ EOF # To add additional dashboards, browse the URL above and import the dashboard via the id displayed for the dashboard # Select the home icon (upper left), Dashboards / Import, enter the id, select load, and select the Prometheus datasource - cd ~/prometheus/dashboards + cd ~/models/tools/prometheus/dashboards boards=$(ls) for board in $boards; do curl -X POST -u admin:admin -H "Accept: application/json" -H "Content-type: application/json" -d @${board} http://$grafana_ip:3000/api/dashboards/db diff --git a/tools/rancher/demo_deploy.sh b/tools/rancher/demo_deploy.sh index 981b421..7daa80e 100644 --- a/tools/rancher/demo_deploy.sh +++ b/tools/rancher/demo_deploy.sh @@ -1,12 +1,12 @@ #!/bin/bash # Copyright 2017 AT&T Intellectual Property, Inc -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ #. - prometheus + grafana for cluster monitoring/stats #. Prometheus dashboard: http://<master_public_ip>:9090 #. Grafana dashboard: http://<master_public_ip>:3000 -#. +#. #. Prerequisites: #. - Ubuntu server for Rancher cluster nodes (admin/master and agent nodes) #. - MAAS server as cluster admin for Rancher master/agent nodes @@ -47,17 +47,17 @@ ssh-add $key if [[ "x$extras" != "x" ]]; then source $extras; fi scp -o StrictHostKeyChecking=no $key ubuntu@$admin_ip:/home/ubuntu/$key echo "Setting up Rancher..." -ssh -x ubuntu@$admin_ip <<EOF +ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip <<EOF exec ssh-agent bash ssh-add $key git clone https://gerrit.opnfv.org/gerrit/models bash models/tools/rancher/rancher-cluster.sh all "$agent_ips" EOF # TODO: Figure this out... Have to break the setup into two steps as something -# causes the ssh session to end before the prometheus setup, if both scripts +# causes the ssh session to end before the prometheus setup, if both scripts # (k8s-cluster and prometheus-tools) are in the same ssh session echo "Setting up Prometheus..." -ssh -x ubuntu@$admin_ip <<EOF +ssh -x -o StrictHostKeyChecking=no ubuntu@$admin_ip <<EOF exec ssh-agent bash ssh-add $key bash models/tools/prometheus/prometheus-tools.sh all "$agent_ips" diff --git a/tools/rancher/rancher-cluster.sh b/tools/rancher/rancher-cluster.sh index 42b3c58..041aaef 100644 --- a/tools/rancher/rancher-cluster.sh +++ b/tools/rancher/rancher-cluster.sh @@ -1,20 +1,20 @@ #!/bin/bash # Copyright 2017 AT&T Intellectual Property, Inc -# +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # -#. What this is: Functions for testing with rancher. -#. Prerequisites: +#. What this is: Functions for testing with rancher. +#. Prerequisites: #. - Ubuntu server for master and agent nodes #. Usage: #. $ git clone https://gerrit.opnfv.org/gerrit/models ~/models @@ -36,7 +36,7 @@ #. Removes Rancher and installed blueprints from the master and agent nodes. #. #. To call the procedures, directly, e.g. public_endpoint nginx/lb -#. $ source rancher-cluster.sh +#. $ source rancher-cluster.sh #. See below for function-specific usage #. @@ -82,9 +82,9 @@ function setup_master() { done echo "${FUNCNAME[0]}: rancher server is up after $delay seconds" - rm -rf ~/rancher - mkdir ~/rancher -} + rm -rf ~/rancher + mkdir ~/rancher +} # Install rancher CLI tools # Usage example: install_cli_tools 172.16.0.2 @@ -121,15 +121,15 @@ $RANCHER_URL $RANCHER_ACCESS_KEY $RANCHER_SECRET_KEY EOF - - master=$(rancher config --print | jq -r '.url' | cut -d '/' -f 3) + + master=$(rancher config --print | jq -r '.url' | cut -d '/' -f 3) echo "${FUNCNAME[0]}: Create registration token" # added sleep to allow server time to be ready to create registration tokens (otherwise error is returned) sleep 5 - curl -s -o /tmp/token -X POST -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"name":"master"}' http://$master/v1/registrationtokens + curl -s -o /tmp/token -X POST -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"name":"master"}' http://$master/v1/registrationtokens while [[ $(jq -r ".type" /tmp/token) != "registrationToken" ]]; do sleep 5 - curl -s -o /tmp/token -X POST -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"name":"master"}' http://$master/v1/registrationtokens + curl -s -o /tmp/token -X POST -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"name":"master"}' http://$master/v1/registrationtokens done id=$(jq -r ".id" /tmp/token) echo "${FUNCNAME[0]}: registration token id=$id" @@ -179,14 +179,14 @@ function setup_agent() { let delay=$delay+10 state=$(rancher inspect $id | jq -r '.state') done - echo "${FUNCNAME[0]}: agent $2 state is $state after $delay seconds" + echo "${FUNCNAME[0]}: agent $2 state is $state after $delay seconds" } # Delete an agent host # Usage example: delete_host 172.16.0.7 function stop_agent() { echo "${FUNCNAME[0]}: deleting host $1" - rancher rm --stop $(rancher hosts | awk "/$1/{print \$1}") + rancher rm --stop $(rancher hosts | awk "/$1/{print \$1}") } # Test service at access points @@ -240,7 +240,7 @@ function start_simple_service() { # is the external port) ports=$3 scale=$4 - + echo "${FUNCNAME[0]}: creating service folder ~/rancher/$service" mkdir ~/rancher/$service cd ~/rancher/$service @@ -282,7 +282,7 @@ function lb_service() { service=$1 lbport=$2 port=$3 - + cd ~/rancher/$service echo "${FUNCNAME[0]}: creating docker-compose-lb.yml" # Define lb service via docker-compose.yml @@ -371,7 +371,7 @@ function start_stack() { function delete_stack() { id=$(rancher stacks | grep "$1" | awk "{print \$1}") echo "${FUNCNAME[0]}: deleting stack $1 with id $id" - rancher rm --stop $id + rancher rm --stop $id } # Delete a service @@ -379,7 +379,7 @@ function delete_stack() { function delete_service() { id=$(rancher ps | grep "$1" | awk "{print \$1}") echo "${FUNCNAME[0]}: deleting service $1 with id $id" - rancher rm --stop $id + rancher rm --stop $id } # Start a complex service, i.e. with yaml file customizations @@ -391,7 +391,7 @@ function start_complex_service() { # is the external port) ports=$2 scale=$3 - + echo "${FUNCNAME[0]}: creating service folder ~/rancher/$service" mkdir ~/rancher/$service cd ~/rancher/$service @@ -410,7 +410,7 @@ grafana: GF_SECURITY_SECRET_KEY: $(uuidgen) EOF ;; - + *) esac @@ -441,15 +441,16 @@ function demo() { lb_service dokuwiki 8002 80 check_service dokuwiki/lb http "This topic does not exist yet" # Grafana server, accessible on one machine at port 3000 - start_complex_service grafana 3000:3000 1 - id=$(rancher ps | grep " grafana/grafana " | awk "{print \$1}") - source ~/models/tools/prometheus/prometheus-tools.sh setup "$agents" - grafana_ip=$(rancher inspect $id | jq -r ".publicEndpoints[0].ipAddress") - prometheus_ip=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') - connect_grafana $prometheus_ip $grafana_ip + # Grafana is setup via prometheus-toold.sh for now +# start_complex_service grafana 3000:3000 1 +# id=$(rancher ps | grep " grafana/grafana " | awk "{print \$1}") +# source ~/models/tools/prometheus/prometheus-tools.sh setup "$agents" +# grafana_ip=$(rancher inspect $id | jq -r ".publicEndpoints[0].ipAddress") +# prometheus_ip=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') +# connect_grafana $prometheus_ip $grafana_ip public_endpoint nginx/lb public_endpoint dokuwiki/lb - public_endpoint grafana/grafana +# public_endpoint grafana/grafana end=`date +%s` runtime=$((end-start)) @@ -519,7 +520,8 @@ case "$1" in demo "$2" check_service nginx/lb check_service dokuwiki/lb - check_service grafana/grafana +# Grafana is setup via prometheus-toold.sh for now +# check_service grafana/grafana ;; clean) clean "$2" diff --git a/tools/traffic.sh b/tools/traffic.sh index c020b6c..b488c40 100644 --- a/tools/traffic.sh +++ b/tools/traffic.sh @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# What this is: semi-random request generator for a web service +# What this is: semi-random request generator for a web service #. #. How to use: -#. $ git clone https://gerrit.opnfv.org/gerrit/models +#. $ git clone https://gerrit.opnfv.org/gerrit/models # $ bash models/tools/traffic <url> # <url>: address of the web service |