├── 001-watch-pods-ceph.sh ├── 000-watch-pods-all.sh ├── 002-watch-pods-openstack.sh ├── 041-deploy-mon.sh ├── adminrc ├── 098-cleanup-openstack.sh ├── 030-install-armada.sh ├── 099-cleanup-all.sh ├── 010-init-env.sh ├── 097-remove-os-resources.sh ├── 040-deploy-openstack.sh ├── 050-create-os-resources.sh ├── README.md ├── 020-install-k8s.sh └── LICENSE /001-watch-pods-ceph.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | watch kubectl get -n ceph pods 4 | -------------------------------------------------------------------------------- /000-watch-pods-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | watch kubectl get --all-namespaces pods 4 | -------------------------------------------------------------------------------- /002-watch-pods-openstack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | watch kubectl get pods -n openstack 4 | -------------------------------------------------------------------------------- /041-deploy-mon.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | (( EUID )) && echo You need to be root. && exit 1 3 | set -ex 4 | armada apply ~/apps/armada-manifests/taco-mon-manifest.yaml 5 | -------------------------------------------------------------------------------- /adminrc: -------------------------------------------------------------------------------- 1 | export LC_ALL="en_US.UTF-8" 2 | export OS_PROJECT_DOMAIN_NAME=default 3 | export OS_USER_DOMAIN_NAME=default 4 | export OS_PROJECT_NAME=admin 5 | export OS_USERNAME=admin 6 | export OS_PASSWORD=password 7 | export OS_AUTH_URL=http://keystone-api.openstack.svc.cluster.local:35357/v3 8 | export OS_IDENTITY_API_VERSION=3 9 | export OS_IMAGE_API_VERSION=2 10 | -------------------------------------------------------------------------------- /098-cleanup-openstack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | for NS in ceph openstack ; do 5 | kubectl delete --force=true --grace-period=1 --ignore-not-found=true ns $NS 6 | end=$(expr $(date +%s) + 20) 7 | while true; do 8 | RELEASES_CNT=$(helm list -a -q --namespace $NS | wc -l) 9 | [ $RELEASES_CNT -ne 0 ] && break || true 10 | sleep 5 11 | now=$(date +%s) 12 | [ $now -gt $end ] && echo can not find $NS releases. && break 13 | done 14 | RELEASES=$(helm list -a -q --namespace $NS) 15 | for RELEASE in $RELEASES ; do 16 | helm delete --purge --no-hooks $RELEASE 17 | sleep 1 18 | done 19 | done 20 | kubectl delete pv --all 21 | 22 | rm -rf /var/lib/openstack-helm /var/lib/neutron /var/lib/nova /var/lib/libvirt /var/lib/openvswitch /run/openvswitch* /run/libvirt* 23 | -------------------------------------------------------------------------------- /030-install-armada.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | (( EUID )) && echo You need to be root. && exit 1 3 | set -ex 4 | 5 | ARMADA_DIR=~/apps/armada 6 | if [ -d $ARMADA_DIR ]; then 7 | rm -rf $ARMADA_DIR 8 | fi 9 | 10 | cd ~/apps 11 | git clone http://github.com/sktelecom-oslab/armada.git && cd armada 12 | OS_DISTRO=$(cat /etc/os-release | grep "PRETTY_NAME" | sed 's/PRETTY_NAME=//g' | sed 's/["]//g' | awk '{print $1}') 13 | if [ $OS_DISTRO == Red ]; then 14 | yum -y install https://rhel7.iuscommunity.org/ius-release.rpm 15 | yum -y install python36u python36u-devel 16 | yum install -y python36u-pip 17 | pip3.6 install . 18 | elif [ $OS_DISTRO == CentOS ]; then 19 | yum -y install https://centos7.iuscommunity.org/ius-release.rpm 20 | yum -y install python36u python36u-devel 21 | yum install -y python36u-pip 22 | pip3.6 install . 23 | elif [ $OS_DISTRO == Ubuntu ]; then 24 | apt-get install -y python3-pip 25 | pip3 install --upgrade pip==9.0.3 26 | pip3 install . 27 | else 28 | echo "This Linux Distribution is NOT supported" 29 | fi 30 | -------------------------------------------------------------------------------- /099-cleanup-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -ex 3 | 4 | for NS in ceph openstack ; do 5 | kubectl delete --force=true --grace-period=1 --ignore-not-found=true ns $NS 6 | end=$(expr $(date +%s) + 10) 7 | while true; do 8 | RELEASES_CNT=$(helm list -a -q --namespace $NS | wc -l) 9 | [ $RELEASES_CNT -ne 0 ] && break || true 10 | sleep 2 11 | now=$(date +%s) 12 | [ $now -gt $end ] && echo can not find $NS releases. && break 13 | done 14 | RELEASES=$(helm list -a -q --namespace $NS) 15 | for RELEASE in $RELEASES ; do 16 | helm delete --purge --no-hooks $RELEASE 17 | sleep 1 18 | done 19 | done 20 | kubectl delete pv --all 21 | 22 | OS_DISTRO=$(cat /etc/os-release | grep "PRETTY_NAME" | sed 's/PRETTY_NAME=//g' | sed 's/["]//g' | awk '{print $1}') 23 | if [ $OS_DISTRO == Red ]; then 24 | pip3.6 uninstall -y armada || true 25 | elif [ $OS_DISTRO == CentOS ]; then 26 | pip3.6 uninstall -y armada || true 27 | elif [ $OS_DISTRO == Ubuntu ]; then 28 | pip3 uninstall -y armada || true 29 | else 30 | echo "This Linux Distribution is NOT supported" 31 | fi 32 | 33 | sed -i 7,18d ~/apps/kubespray/reset.yml 34 | ansible-playbook -u root -b -i ~/apps/kubespray/inventory/taco-aio.cfg ~/apps/kubespray/reset.yml 35 | 36 | docker rm -f $(docker ps -a -q) || true 37 | docker rmi -f $(docker images -a -q) || true 38 | docker system prune -a -f || true 39 | 40 | ip addr delete 10.123.123.1/24 dev br-ex || true 41 | ip link set br-ex down || true 42 | EXNIC=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $5}') 43 | iptables -t nat -D POSTROUTING -o $EXNIC -j MASQUERADE || true 44 | 45 | sed -i '/taco/d' /etc/hosts 46 | 47 | rm -rf /var/lib/openstack-helm /var/lib/neutron /var/lib/nova /var/lib/libvirt /var/lib/openvswitch /run/openvswitch* /run/libvirt* 48 | -------------------------------------------------------------------------------- /010-init-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | (( EUID )) && echo You need to be root. && exit 1 3 | set -ex 4 | 5 | export LC_ALL="en_US.UTF-8" 6 | export PATH=$PATH:/usr/local/bin 7 | 8 | # To prevent locale error during the installation. Added locale settings. 9 | echo LANG=en_US.utf-8 >> /etc/environment 10 | echo LC_ALL=en_US.utf-8 >> /etc/environment 11 | echo export LANG=en_US.utf-8 >> ~/.bashrc 12 | echo export LC_ALL=en_US.utf-8 >> ~/.bashrc 13 | 14 | 15 | EXIP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}') 16 | echo $EXIP 'taco-aio' >> /etc/hosts 17 | 18 | OS_DISTRO=$(cat /etc/os-release | grep "PRETTY_NAME" | sed 's/PRETTY_NAME=//g' | sed 's/["]//g' | awk '{print $1}') 19 | if [ $OS_DISTRO == Red ]; then 20 | yum update -y 21 | yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E '%{rhel}').noarch.rpm 22 | yum install -y yum-utils python-pip python-devel 23 | yum groupinstall -y 'development tools' 24 | yum -y install ceph-common git jq nmap bridge-utils net-tools 25 | 26 | setenforce 0 27 | elif [ $OS_DISTRO == CentOS ]; then 28 | yum update -y 29 | yum install -y epel-release 30 | yum install -y yum-utils python-pip python-devel 31 | yum groupinstall -y 'development tools' 32 | yum -y install ceph-common git jq nmap bridge-utils net-tools 33 | 34 | setenforce 0 35 | systemctl stop firewalld 36 | # TODO Don't leave firewall disabled permanently, use only for TACO-AIO 37 | systemctl disable firewalld 38 | elif [ $OS_DISTRO == Ubuntu ]; then 39 | apt-get update 40 | apt-get -y upgrade 41 | apt install -y python python-pip 42 | apt install -y ceph-common git jq nmap bridge-utils ipcalc 43 | else 44 | echo "This Linux Distribution is NOT supported" 45 | fi 46 | pip install --upgrade pip==9.0.3 47 | pip install 'pyOpenSSL==16.2.0' 48 | pip install 'python-openstackclient' 49 | 50 | swapoff -a 51 | sed -i '/swap/s/^/#/g' /etc/fstab 52 | modprobe rbd 53 | ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N "" 54 | -------------------------------------------------------------------------------- /097-remove-os-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | (( EUID )) && echo You need to be root. && exit 1 3 | 4 | export LC_ALL="en_US.UTF-8" 5 | export OS_PROJECT_DOMAIN_NAME=default 6 | export OS_USER_DOMAIN_NAME=default 7 | export OS_PROJECT_NAME=admin 8 | export OS_USERNAME=admin 9 | export OS_PASSWORD=password 10 | export OS_AUTH_URL=http://keystone-api.openstack.svc.cluster.local:35357/v3 11 | export OS_IDENTITY_API_VERSION=3 12 | export OS_IMAGE_API_VERSION=2 13 | 14 | echo "Deleting virtual machine..." 15 | SERVERS=$(openstack server list | grep -v ID | grep -e '[a-z0-9]' | awk '{print $2}') 16 | for server in $SERVERS 17 | do 18 | openstack server delete $server --wait 19 | done 20 | echo "Done" 21 | 22 | echo "Deleting secutiry group rule for ssh" 23 | SEC_GROUP_RULES=$(openstack security group rule list | grep -E 'tcp|icmp' | awk '{print $2}') 24 | for sec_rule in $SEC_GROUP_RULES 25 | do 26 | openstack security group rule delete $sec_rule 27 | done 28 | echo "Done" 29 | 30 | echo "Deleting private key" 31 | openstack keypair delete taco-key 32 | echo "Done" 33 | 34 | echo "Deleting floating ip..." 35 | FLOATING_IPS=$(openstack floating ip list | grep 192 | awk '{print $4}') 36 | for floating_ip in $FLOATING_IPS 37 | do 38 | openstack floating ip delete $floating_ip 39 | done 40 | echo "Done" 41 | 42 | echo "Deleting glance image..." 43 | IMAGES=$(openstack image list | grep -v ID | grep -e '[a-z0-9]' | grep -v 'Cirros 0.3.5 64-bit' | awk '{print $2}') 44 | for image in $IMAGES 45 | do 46 | openstack image delete $image 47 | done 48 | echo "Done" 49 | 50 | echo "Deleting router..." 51 | openstack router remove subnet admin-router private-subnet 52 | openstack router unset admin-router 53 | openstack router delete admin-router 54 | echo "Done" 55 | 56 | echo "Deleting public network..." 57 | openstack network delete public-net 58 | ip addr delete 10.123.123.1/24 dev br-ex 59 | ip link set br-ex down 60 | EXNIC=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $5}') 61 | iptables -t nat -D POSTROUTING -o $EXNIC -j MASQUERADE 62 | echo "Done" 63 | 64 | echo "Deleting private network..." 65 | openstack subnet delete private-subnet 66 | openstack network delete private-net 67 | echo "Done" 68 | 69 | -------------------------------------------------------------------------------- /040-deploy-openstack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | (( EUID )) && echo You need to be root. && exit 1 3 | set -ex 4 | # compare kernel version using float and string; return 0 when greather or equal 5 | isge () { 6 | lestr=$(echo $(printf "$1\n$2" | sort -V) | awk '{print $1}') 7 | if [[ $1 == $2 ]]; then 8 | return 0 9 | elif [[ $1 == $lestr ]]; then 10 | return 1 11 | else 12 | return 0 13 | fi 14 | } 15 | 16 | EXIP=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $7}') 17 | EXGW=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $3}') 18 | EXNIC=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $5}') 19 | FSID=$(uuidgen) 20 | 21 | KVER=$(uname -r | egrep '^[0-9]*\.[0-9]*' -o | head -n 1) 22 | if isge $KVER 4.5; then 23 | CRUSH_TUNABLES=jewel 24 | elif isge $KVER 4.1; then 25 | CRUSH_TUNABLES=hammer 26 | elif isge $KVER 3.15; then 27 | CRUSH_TUNABLES=firefly 28 | elif isge $KVER 3.9; then 29 | CRUSH_TUNABLES=bobtail 30 | elif isge $KVER 3.6; then 31 | CRUSH_TUNABLES=argonaut 32 | else 33 | CRUSH_TUNABLES=default 34 | fi 35 | 36 | OS_DISTRO=$(cat /etc/os-release | grep "PRETTY_NAME" | sed 's/PRETTY_NAME=//g' | sed 's/["]//g' | awk '{print $1}') 37 | if [ $OS_DISTRO == Red ]; then 38 | MASK=$(ifconfig $EXNIC | awk '/netmask /{ print $4;}') 39 | CIDR=$(ipcalc -n $EXIP $MASK | cut -d'=' -f2)/$(ipcalc -p $EXIP $MASK | cut -d'=' -f2) 40 | elif [ $OS_DISTRO == CentOS ]; then 41 | MASK=$(ifconfig $EXNIC | awk '/netmask /{ print $4;}') 42 | CIDR=$(ipcalc -n $EXIP $MASK | cut -d'=' -f2)/$(ipcalc -p $EXIP $MASK | cut -d'=' -f2) 43 | elif [ $OS_DISTRO == Ubuntu ]; then 44 | CIDR=$(ipcalc -n $EXIP $EXGW | awk /'Network:'/'{print $2}') 45 | fi 46 | ARMADA_MANIFEST_DIR=~/apps/armada-manifests 47 | if [ -d $ARMADA_MANIFEST_DIR ]; then 48 | rm -rf $ARMADA_MANIFEST_DIR 49 | fi 50 | 51 | cd ~/apps 52 | git clone https://github.com/sktelecom-oslab/armada-manifests.git 53 | 54 | armada apply ~/apps/armada-manifests/taco-aio-manifest.yaml \ 55 | --set chart:ceph:values.conf.ceph.global.fsid=$FSID \ 56 | --set chart:ceph:values.conf.pool.crush.tunables=$CRUSH_TUNABLES \ 57 | --set chart:ceph:values.network.public=$CIDR \ 58 | --set chart:ceph:values.network.cluster=$CIDR \ 59 | --set chart:neutron:values.network.interface.tunnel=$EXNIC 60 | -------------------------------------------------------------------------------- /050-create-os-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | (( EUID )) && echo You need to be root. && exit 1 3 | 4 | export LC_ALL="en_US.UTF-8" 5 | export OS_PROJECT_DOMAIN_NAME=default 6 | export OS_USER_DOMAIN_NAME=default 7 | export OS_PROJECT_NAME=admin 8 | export OS_USERNAME=admin 9 | export OS_PASSWORD=password 10 | export OS_AUTH_URL=http://keystone-api.openstack.svc.cluster.local:35357/v3 11 | export OS_IDENTITY_API_VERSION=3 12 | export OS_IMAGE_API_VERSION=2 13 | 14 | echo """nameserver 10.96.0.10 15 | nameserver 8.8.8.8 16 | nameserver 8.8.4.4 17 | search openstack.svc.cluster.local svc.cluster.local cluster.local 18 | options ndots:5""" > /etc/resolv.conf 19 | 20 | echo "Create private network..." 21 | PRIVATE_NAME_TEMP=$(openstack network list | grep private-net | awk '{print $4}') 22 | if [ "x${PRIVATE_NAME_TEMP}" != "xprivate-net" ]; then 23 | openstack network create --internal --share --project admin --provider-network-type vxlan private-net 24 | openstack subnet create --ip-version 4 --network private-net --subnet-range 172.30.1.0/24 --dns-nameserver 8.8.8.8 private-subnet 25 | fi 26 | echo "Done" 27 | 28 | echo "Create public network..." 29 | PUBLIC_NAME_TEMP=$(openstack network list | grep public-net | awk '{print $4}') 30 | if [ "x${PUBLIC_NAME_TEMP}" != "xpublic-net" ]; then 31 | openstack network create --external --share --provider-network-type flat --provider-physical-network external public-net 32 | openstack subnet create --network public-net --subnet-range 10.123.123.0/24 --no-dhcp --gateway 10.123.123.1 \ 33 | --ip-version 4 public-subnet 34 | fi 35 | ip addr add 10.123.123.1/24 dev br-ex 36 | ip link set br-ex up 37 | EXNIC=$(ip route get 8.8.8.8 | awk '/8.8.8.8/ {print $5}') 38 | iptables -t nat -A POSTROUTING -o $EXNIC -j MASQUERADE 39 | echo "Done" 40 | 41 | echo "Create router..." 42 | ADMIN_ROUTER_TEMP=$(openstack router list | grep admin-router | awk '{print $4}') 43 | if [ "x${ADMIN_ROUTER_TEMP}" != "xadmin-router" ]; then 44 | openstack router create admin-router 45 | openstack router add subnet admin-router private-subnet 46 | openstack router set --external-gateway public-net admin-router 47 | openstack router show admin-router 48 | fi 49 | echo "Done" 50 | 51 | echo "Add security group for ssh" 52 | SEC_GROUPS=$(openstack security group list --project admin | grep default | awk '{print $2}') 53 | for sec_var in $SEC_GROUPS 54 | do 55 | SEC_RULE=$(openstack security group rule list $SEC_GROUPS | grep 1:65535 | awk '{print $8}') 56 | if [ "x${SEC_RULE}" != "x1:65535" ]; then 57 | openstack security group rule create --proto tcp --remote-ip 0.0.0.0/0 --dst-port 1:65535 --ingress $sec_var 58 | openstack security group rule create --protocol icmp --remote-ip 0.0.0.0/0 $sec_var 59 | openstack security group rule create --protocol icmp --remote-ip 0.0.0.0/0 --egress $sec_var 60 | fi 61 | done 62 | echo "Done" 63 | 64 | echo "Create private key" 65 | openstack keypair create --public-key ~/.ssh/id_rsa.pub taco-key 66 | echo "Done" 67 | 68 | IMAGE=$(openstack image show 'Cirros 0.3.5 64-bit' | grep id | awk '{print $4}') 69 | FLAVOR=$(openstack flavor list | grep m1.tiny | awk '{print $2}') 70 | NETWORK=$(openstack network list | grep private-net | awk '{print $2}') 71 | 72 | echo "Create virtual machine..." 73 | openstack server create --image $IMAGE --flavor $FLAVOR --nic net-id=$NETWORK --key-name taco-key test --wait 74 | echo "Done" 75 | 76 | echo "Add public ip to vm..." 77 | openstack floating ip create public-net 78 | FLOATING_IP=$(openstack floating ip list | grep 10 | awk '{print $4}') 79 | SERVER=$(openstack server list | grep test | awk '{print $2}') 80 | 81 | sleep 10 82 | 83 | openstack server add floating ip $SERVER $FLOATING_IP 84 | openstack server list 85 | echo "Done" 86 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## This repository is deprecated. We moved everything to the following repo 2 | 3 | https://github.com/openinfradev 4 | 5 | --- 6 | 7 | # TACO Installation Scripts 8 | 9 | This set of scripts let anyone install TACO AIO (All-In-One) on a single machine. 10 | 11 | * Kubernetes v1.9.2 12 | * Helm v2.8.2 13 | * OpenStack Ocata release 14 | * Ceph Luminous Version 15 | * Weave Scope 16 | * Armada 17 | 18 | Minimum Hardware (VM) Requirements 19 | * Spec: 4 CPU / 16G MEMORY / 100G DISK / 1 NIC 20 | * OS: Ubuntu 16.04.3 or CentOS 7.4 or REHL 7.4 21 | 22 | 23 | ## TACO (SKT All Container OpenStack) 24 | 25 | TACO is OpenStack solution developed by SK Telecom, fully leveraging [OpenStack-Helm] project. 26 | * 100% Community based Open Source SW with Continuous Integration / Delivery System 27 | * Enhanced OpenStack Lifecycle Management: Self-Healing, Upgrade w/o Service Interruption, Simple and Easy Deployment, Highly Flexible Customization 28 | * TACO Version Info: TACO v1.x = Newton / TACO v2.x = Ocata 29 | 30 | 31 | ## Quick Start Guide 32 | 33 | ### Download TACO Installation Scripts 34 | 35 | $ git clone https://github.com/sktelecom-oslab/taco-scripts.git 36 | $ cd taco-scripts 37 | 38 | > Just for the simplicity purpose, it assumes that you execute these scripts as "root" user. 39 | 40 | ### Before install TACO AIO, initialize environment and install all related packages using: 41 | 42 | $ ./010-init-env.sh 43 | 44 | ### Deploy kubernetes cluster at your single machine: 45 | 46 | $ ./020-install-k8s.sh 47 | 48 | This step contains all about deploying kubernetes using kubespray 49 | * download kubespray and setting TACO's configurations 50 | * deploy all-in-one kubernetes cluster 51 | * label nodes for deploying OpenStack pods 52 | * make some necessary clusterrolebindings 53 | 54 | ### Install [Armada] client to deploy OpenStack on Kubernetes: 55 | 56 | $ ./030-install-armada.sh 57 | 58 | > Armada is a tool for managing multiple helm charts with dependencies by centralizing all configurations in a single Armada yaml and providing lifecycle hooks for all helm releases. 59 | 60 | ### Deploy OpenStack: 61 | 62 | $ ./040-deploy-openstack.sh 63 | 64 | ### Deploy LMA (Logging Monitoring Alerting): 65 | 66 | $ ./041-deploy-lma.sh 67 | 68 | Logging dashboard(KIBANA) 69 | * localhost:30001 70 | * taco / password 71 | 72 | Monitoring dashboard(Prometheus) 73 | * localhost:30008 74 | * admin / password 75 | 76 | ### Initialize OpenStack and Launch an instance (Virtual Machine) 77 | 78 | $ ./050-create-os-resources.sh 79 | 80 | First, populate environment variables with the location of the Identity service and the admin project and user credentials. This script also creates all the necessary resources to launch an instances and access it. 81 | 82 | * Create private network 83 | * Create public network 84 | * Create router 85 | * Add security group for ssh 86 | * Create private key 87 | * Create virtual machine 88 | * Add public ip to vm 89 | 90 | ### Delete All Openstack Resources 91 | 92 | $ ./097-remove-os-resources.sh 93 | 94 | ### Clean Up Openstack Services with Ceph 95 | 96 | $ ./098-cleanup-openstack.sh 97 | 98 | ### Clean Up Openstack Services, Kubernetes Services and Armada 99 | 100 | $ ./099-cleanup-all.sh 101 | 102 | ---- 103 | ## Appendix 104 | 105 | ### TACO v2.0 Release Document 106 | 107 | https://tde.sktelecom.com/wiki/pages/viewpage.action?pageId=146290186& 108 | * please contact Jaesuk Ahn (jay.ahn@sk.com) to get an access to the release document. 109 | 110 | ### Acknowledgement 111 | 112 | This is fully inspired by OpenStack-Helm project workshop at [OpenStack Sydney Workshop]. 113 | 114 | 115 | [OpenStack-Helm]: https://github.com/openstack/openstack-helm 116 | [OpenStack-Helm Document]: https://docs.openstack.org/openstack-helm/latest/readme.html 117 | [OpenStack Sydney Workshop]: https://github.com/portdirect/sydney-workshop 118 | [Armada]: http://armada-helm.readthedocs.io/en/latest/readme.html# 119 | -------------------------------------------------------------------------------- /020-install-k8s.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | (( EUID )) && echo You need to be root. && exit 1 3 | set -ex 4 | export PATH=$PATH:/usr/local/bin 5 | cd ~/ 6 | mkdir -p ~/apps 7 | TACO_KUBESPRAY_DIR=~/apps/taco-kubespray 8 | if [ -d $TACO_KUBESPRAY_DIR ]; then 9 | rm -rf $TACO_KUBESPRAY_DIR 10 | fi 11 | UPSTREAM_KUBESPRAY_DIR=~/apps/upstream-kubespray 12 | if [ -d $UPSTREAM_KUBESPRAY_DIR ]; then 13 | rm -rf $UPSTREAM_KUBESPRAY_DIR 14 | fi 15 | KUBESPRAY_DIR=~/apps/kubespray 16 | if [ -d $KUBESPRAY_DIR ]; then 17 | rm -rf $KUBESPRAY_DIR 18 | fi 19 | CACHE_FILE=/tmp/taco-aio 20 | if [ -f $CACHE_FILE ]; then 21 | rm -f $CACHE_FILE 22 | fi 23 | cd ~/apps 24 | git clone https://github.com/kubernetes-incubator/kubespray.git upstream-kubespray && cd upstream-kubespray 25 | git checkout -b v2.4.0 tags/v2.4.0 26 | pip install -r requirements.txt 27 | 28 | cd ~/apps 29 | git clone https://github.com/sktelecom-oslab/taco-kubespray.git && cd taco-kubespray 30 | git checkout -b v2.4.0 tags/v2.4.0 31 | 32 | cd ~/apps 33 | cp -R upstream-kubespray kubespray && cp -R taco-kubespray/* kubespray/. && cd kubespray 34 | echo """taco-aio ansible_connection=local local_release_dir={{ansible_env.HOME}}/releases 35 | [kube-master] 36 | taco-aio 37 | [etcd] 38 | taco-aio 39 | [kube-node] 40 | taco-aio 41 | [k8s-cluster:children] 42 | kube-node 43 | kube-master""" > inventory/taco-aio.cfg 44 | 45 | ansible-playbook -u root -b -i ~/apps/kubespray/inventory/taco-aio.cfg ~/apps/kubespray/cluster.yml 46 | 47 | ansible-playbook -u root -b -i ~/apps/kubespray/inventory/taco-aio.cfg ~/apps/kubespray/weavescope.yml 48 | 49 | curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | cat > /tmp/helm_script.sh \ 50 | && chmod 755 /tmp/helm_script.sh && /tmp/helm_script.sh --version v2.8.2 51 | 52 | helm init --upgrade 53 | 54 | kubectl label nodes openstack-control-plane=enabled --all --namespace=openstack --overwrite 55 | kubectl label nodes openvswitch=enabled --all --namespace=openstack --overwrite 56 | kubectl label nodes openstack-compute-node=enabled --all --namespace=openstack --overwrite 57 | kubectl label nodes kubernetes-control-plane=enabled --all --overwrite 58 | kubectl label nodes ceph-mds=enabled --all --overwrite 59 | kubectl label nodes ceph-mon=enabled --all --overwrite 60 | kubectl label nodes ceph-osd=enabled --all --overwrite 61 | kubectl label nodes ceph-rgw=enabled --all --overwrite 62 | kubectl label nodes ceph-mgr=enabled --all --overwrite 63 | 64 | kubectl create clusterrolebinding openstack \ 65 | --clusterrole=cluster-admin \ 66 | --serviceaccount=openstack:default 67 | 68 | kubectl create clusterrolebinding ceph \ 69 | --clusterrole=cluster-admin \ 70 | --serviceaccount=ceph:default 71 | 72 | echo """nameserver 10.96.0.10 73 | nameserver 8.8.8.8 74 | nameserver 8.8.4.4 75 | search openstack.svc.cluster.local svc.cluster.local cluster.local 76 | options ndots:5""" > /etc/resolv.conf 77 | 78 | set -e 79 | 80 | # From Kolla-Kubernetes, orginal authors Kevin Fox & Serguei Bezverkhi 81 | # Default wait timeout is 600 seconds 82 | end=$(expr $(date +%s) + 600) 83 | while true; do 84 | kubectl get pods --namespace=kube-system -o json | jq -r \ 85 | '.items[].status.phase' | grep Pending > /dev/null && \ 86 | PENDING=True || PENDING=False 87 | query='.items[]|select(.status.phase=="Running")' 88 | query="$query|.status.containerStatuses[].ready" 89 | kubectl get pods --namespace=kube-system -o json | jq -r "$query" | \ 90 | grep false > /dev/null && READY="False" || READY="True" 91 | kubectl get jobs -o json --namespace=kube-system | jq -r \ 92 | '.items[] | .spec.completions == .status.succeeded' | \ 93 | grep false > /dev/null && JOBR="False" || JOBR="True" 94 | [ $PENDING == "False" -a $READY == "True" -a $JOBR == "True" ] && \ 95 | break || true 96 | sleep 5 97 | now=$(date +%s) 98 | [ $now -gt $end ] && echo containers failed to start. && \ 99 | kubectl get pods --namespace kube-system -o wide && exit -1 100 | done 101 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------