Add express Vagrant setup with README update.

This commit is contained in:
Maciej Kwiek 2016-04-22 11:41:23 +02:00
parent 78b1d08a19
commit 9138f86056
7 changed files with 126 additions and 29 deletions

View File

@ -2,31 +2,15 @@ This repository contains resources for configuring kubernetes with calico networ
Recommended solar version is `git checkout 1a33a7306d1485f503de967531c87a3b3aff5fcb`.
Vagrant setup:
Express Vagrant setup:
1. Clone [solar](https://github.com/openstack/solar)
2. Copy Vagrantfile_solar from this repo to solar Vagrantfile
3. Add fc23 vagrant box:
1. Clone this repo and cd to it
2. Add fc23 vagrant box:
* libvirt: `vagrant box add fc23 Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-libvirt.box --provider libvirt --force`
* virtualbox: `vagrant box add fc23 Fedora-Cloud-Base-Vagrant-23-20151030.x86_64.vagrant-virtualbox.box --provider virtualbox --force`
4. ensure that vagrant-settings.yaml contains these values:(slave count 2)
* slaves_count: 2
* master_image: solar-master
* master_image_version: null
* slaves_image: fc23
* slaves_image_version: null
5. vagrant up
6. Copy, link or clone this repo to solar-dev VM into k8s folder
8. solar repo import -l k8s
9. cp config.yaml.sample config.yaml
10. ./setup-k8s.py deploy
11. solar changes stage
12. solar changes process
13. solar orch run-once
14. watch solar orch report
15. vagrant ssh solar-dev1
16. kubectl get pods (it works!)
3. `./deploy/kube-up.sh`
4. `vagrant ssh solar-dev1`
5. `kubectl get pods`
In config.yaml you can set:
- login data for kubernetes master
@ -38,7 +22,7 @@ In config.yaml you can set:
Kubernetes version change:
1. log in to solar master node
1. log in to solar master node (`vagrant ssh`)
2. solar resource update kube-config k8s_version=v1.2.1
3. solar changes stage
4. solar changes process

View File

@ -50,19 +50,19 @@ SOLAR_DB_BACKEND = cfg.fetch('solar_db_backend', 'riak')
require_relative 'bootstrap/vagrant_plugins/noop' unless PREPROVISIONED
def ansible_playbook_command(filename, args=[])
"ansible-playbook -v -i \"localhost,\" -c local /vagrant/bootstrap/playbooks/#{filename} #{args.join ' '}"
"ansible-playbook -v -i \"localhost,\" -c local /vagrant/deploy/solar/bootstrap/playbooks/#{filename} #{args.join ' '}"
end
def shell_script(filename, env=[], args=[])
"/bin/bash -c \"#{env.join ' '} #{filename} #{args.join ' '} 2>/dev/null\""
"/bin/bash -c \"#{env.join ' '} #{filename} #{args.join ' '} \""
end
solar_script = ansible_playbook_command("solar.yaml")
solar_agent_script = ansible_playbook_command("solar-agent.yaml")
# NOTE(bogdando) w/a for a centos7 issue
fix_six = shell_script("/vagrant/bootstrap/playbooks/fix_centos7_six.sh")
fix_six = shell_script("/vagrant/deploy/solar/bootstrap/playbooks/fix_centos7_six.sh")
master_pxe = ansible_playbook_command("pxe.yaml")
get_solar = shell_script("/vagrant/deploy/get-solar.sh")
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
@ -70,6 +70,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = MASTER_IMAGE
config.vm.box_version = MASTER_IMAGE_VERSION
config.vm.provision "shell", inline: get_solar
config.vm.provision "shell", inline: fix_six, privileged: true
config.vm.provision "shell", inline: solar_script, privileged: true, env: {"SOLAR_DB_BACKEND": SOLAR_DB_BACKEND}
config.vm.provision "shell", inline: master_pxe, privileged: true unless PREPROVISIONED
@ -127,8 +128,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.host_name = "solar-dev#{index}"
if PREPROVISIONED
# config.vm.provision "shell", inline: fix_six, privileged: true
# config.vm.provision "shell", inline: solar_agent_script, privileged: true
#TODO(bogdando) figure out how to configure multiple interfaces when was not PREPROVISIONED
ind = 0
SLAVES_IPS.each do |ip|

11
deploy/deploy.sh Executable file
View File

@ -0,0 +1,11 @@
#! /bin/bash
export SOLAR_CONFIG_OVERRIDE="/.solar_config_override"
sudo pip install netaddr
pushd /vagrant
solar repo import -l . --name k8s
cp config.yaml.sample config.yaml
./setup_k8s.py deploy
solar changes stage
solar changes process
solar orch run-once -w 1200

9
deploy/get-solar.sh Executable file
View File

@ -0,0 +1,9 @@
#! /bin/bash
pushd /vagrant/deploy
rm -rf solar
rm -rf solar-resources
git clone https://github.com/openstack/solar.git
pushd solar/bootstrap/playbooks
find . -type f -print0 | xargs -0 perl -pi -e 's;(?<!(home|/tmp))/vagrant;/vagrant/deploy/solar;g'
perl -pi -e 's;pip install -e .;pip install -e /vagrant/deploy/solar;g' solar.yaml

4
deploy/kube-up.sh Executable file
View File

@ -0,0 +1,4 @@
#! /bin/bash
vagrant up
vagrant ssh -c /vagrant/deploy/deploy.sh

45
vagrant-settings.yaml Normal file
View File

@ -0,0 +1,45 @@
# copy it to vagrant-settings.yaml then Vagrantfile
# will use values from this file
slaves_count: 2
slaves_ram: 1024
master_image: solar-master
master_image_version: null
slaves_image: fc23
slaves_image_version: null
docker_master_image: solar-project/solar-master
docker_slaves_image: solar-project/solar-master
docker_cmd: "/sbin/init"
master_ram: 1024
master_cpus: 1
master_ips:
- 10.0.0.2
- 10.1.0.2
- 10.2.0.2
slaves_cpus: 1
slaves_ips:
- 10.0.0.
- 10.1.0.
- 10.2.0.
# if you have virtualbox 5.x then enable it
# if will speedup things a lot
# paravirtprovider: kvm
# By default Virtualbox shared folder is used which is very slow
# Uncomment following option to change it.
# Possible options are: rsync, nfs
# sync_type: nfs
# Use vagrant image in order to perform provisioning
preprovisioned: true
# Use pxe bootstrap in order to bootstrap nodes
# it should be used in order to provision nodes
# by solar
# preprovisioned: false
# needed for starting / preparing db server
# you can choose from riak | postgresql
solar_db_backend: riak

View File

@ -0,0 +1,45 @@
# copy it to vagrant-settings.yaml then Vagrantfile
# will use values from this file
slaves_count: 0
slaves_ram: 1024
master_image: solar-master
master_image_version: null
slaves_image: fc23
slaves_image_version: null
docker_master_image: solar-project/solar-master
docker_slaves_image: solar-project/solar-master
docker_cmd: "/sbin/init"
master_ram: 1024
master_cpus: 1
master_ips:
- 10.0.0.2
- 10.1.0.2
- 10.2.0.2
slaves_cpus: 1
slaves_ips:
- 10.0.0.
- 10.1.0.
- 10.2.0.
# if you have virtualbox 5.x then enable it
# if will speedup things a lot
# paravirtprovider: kvm
# By default Virtualbox shared folder is used which is very slow
# Uncomment following option to change it.
# Possible options are: rsync, nfs
# sync_type: nfs
# Use vagrant image in order to perform provisioning
preprovisioned: true
# Use pxe bootstrap in order to bootstrap nodes
# it should be used in order to provision nodes
# by solar
# preprovisioned: false
# needed for starting / preparing db server
# you can choose from riak | postgresql
solar_db_backend: riak