├── .gitignore ├── .gitmodules ├── LICENSE ├── OWNERS ├── README.md ├── Vagrantfile ├── config.rb ├── get-k8s-creds.sh └── setup-halcyon.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # The Usual Suspects: 2 | .DS_Store 3 | .vagrant/ 4 | kube-deploy/kube-deploy.retry 5 | ubuntu-xenial-16.04-cloudimg-console.log 6 | 7 | # Directories we don't really need: 8 | kube-deploy/roles/deploy-docker 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "halcyon-kubernetes"] 2 | path = halcyon-kubernetes 3 | url = https://github.com/att-comdev/halcyon-kubernetes.git 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | reviewers: 2 | - v1k0d3n 3 | - aric49 4 | - intlabs 5 | - alanmeadows 6 | - wilkers-steve 7 | - larryrensing 8 | approvers: 9 | - v1k0d3n 10 | - aric49 11 | - intlabs 12 | - alanmeadows 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # halcyon-vagrant-kubernetes 2 | 3 | Please see [release notes](https://github.com/att-comdev/halcyon-vagrant-kubernetes/releases) for current and planned features. 4 | 5 | A Vagrant deployment of [halcyon-kubernetes](https://github.com/att-comdev/halcyon-kubernetes) -- Ansible playbooks for a kubadm-based kubernetes deployment, supporting any cloud and any kubeadm-enabled OS. 6 | 7 | ## Requirements 8 | 9 | * Virtualbox 5.0 (5.2 will not work with Vagrant) 10 | * Virtualbox Extensions for 5.0 11 | * Ansible (version 2.1.1 and up tested) 12 | * Vagrant (1.8.4 or higher, but **not 1.9 as there are known issues**) 13 | - Following Vagrant Plugins (installed for you during first deploy): 14 | * vagrant-env 15 | * vagrant-git 16 | * vagrant-openstack-provider 17 | * vagrant-persistent-storage 18 | * GNU sed (MacOS ships with BSD sed) 19 | - [Homebrew](http://brew.sh) 20 | * `brew install gnu-sed` 21 | 22 | Please see /docs/README.md for more information about SDN providers, plugins, and other useful information. Pull requests are welcome! 23 | 24 | ## Instructions 25 | 26 | To use this project, simply use vagrant to bring up your environment: 27 | 28 | ``` 29 | $ git clone https://github.com/att-comdev/halcyon-vagrant-kubernetes.git 30 | $ cd halcyon-vagrant-kubernetes 31 | $ git submodule init 32 | $ git submodule update 33 | $ cd halcyon-kubernetes; make; source venv/bin/activate; cd - 34 | $ vagrant up 35 | ``` 36 | 37 | ### Configuration Helper 38 | 39 | A helper script is provided to set up basic common configuration options, it can 40 | be used to change the guest OS and Kubernetes version. It also supports changing 41 | between the default halcyon-kubernetes config and one optimized for OpenStack 42 | Kolla-Kubernetes development. For example, to setup a Kolla development environment 43 | running CentOS and Kubernetes v1.4.6 can simply be achieved by running: 44 | 45 | ``` 46 | $ ./setup-halcyon.sh --guest-os centos --k8s-config kolla --k8s-version v1.4.6 47 | ``` 48 | 49 | ### Deploy directly to Openstack: 50 | 51 | When you want to use Openstack, edit the options in `./config.rb` to match your Openstack project, and deploy with the `--provider=openstack` flag: 52 | 53 | ``` 54 | $ vagrant up --provider=openstack 55 | ``` 56 | 57 | ### Deploy using Libvirt: 58 | 59 | If you would like to use libvirt rather than virtualbox, install the follow vagrant plugin and deploy with the `--provider=libvirt` flag: 60 | 61 | ``` 62 | $ vagrant plugin install vagrant-libvirt 63 | $ vagrant up --provider=libvirt 64 | ``` 65 | 66 | NOTE: Please look over the options in `config.rb` for modifying number of nodes, subnet, and other information and if you want to make any modifications to the Ansible deployment, make changes to the `./kube-deploy/group_vars/all.yml` file. 67 | 68 | ### Accessing the cluster: 69 | 70 | To access the deployed cluster either log in to the node `kube1`: 71 | 72 | ``` 73 | $ vagrant ssh kube1 74 | ``` 75 | or if kubectl is installed locally on the development host, you can alternatively use the provided helper-script to access the cluster: 76 | ``` 77 | $ ./get-k8s-creds.sh 78 | ``` 79 | 80 | ### Ubuntu Deployment Issues: 81 | 82 | If you are deploying project on a Ubuntu 16.04+ host, you may need to install the following dependencies to ensure that the Vagrant plugins get installed properly: 83 | 84 | `sudo apt-get install ruby-dev zlib1g-dev libgmp-dev libxml2-dev libssl-dev openssl libffi-dev` 85 | 86 | NOTE: On Ubuntu 16.10, you may have to install libvirt-dev package to ensure the vagrant-libvirt plugin installs properly: 87 | 88 | `sudo apt-get install libvirt-dev` 89 | 90 | # TODO 91 | 92 | * Add conditionals for various deployments (using vagrant --provider flags; such as AWS provider). 93 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # Copyright 2016, AT&T, and it's Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # -*- mode: ruby -*- 16 | # vi: set ft=ruby : 17 | # NOTE: Variable overrides are in ./config.rb 18 | require "yaml" 19 | require "fileutils" 20 | 21 | # Use a variable file for overrides: 22 | CONFIG = File.expand_path("config.rb") 23 | if File.exist?(CONFIG) 24 | require CONFIG 25 | end 26 | 27 | # Force best practices for this environment: 28 | if $kube_memory < 512 29 | puts "WARNING: Your machine should have at least 512 MB of memory" 30 | end 31 | 32 | if $kube_disk < 10 33 | puts "WARNING: Your machine disk size should be at least 10 GB" 34 | end 35 | 36 | # Install any Required Plugins 37 | missing_plugins_installed = false 38 | required_plugins = %w(vagrant-env vagrant-git vagrant-openstack-provider vagrant-proxyconf vagrant-persistent-storage) 39 | 40 | required_plugins.each do |plugin| 41 | if !Vagrant.has_plugin? plugin 42 | system "vagrant plugin install #{plugin}" 43 | missing_plugins_installed = true 44 | end 45 | end 46 | 47 | # If any plugins were missing and have been installed, re-run vagrant 48 | if missing_plugins_installed 49 | exec "vagrant #{ARGV.join(" ")}" 50 | end 51 | 52 | # Use plugins after install / re-run 53 | require "vagrant-openstack-provider" 54 | 55 | # Vagrantfile API/sytax version. Don’t touch unless you know what you’re doing! 56 | VAGRANTFILE_API_VERSION = "2" 57 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 58 | 59 | # UNCOMMENT FOLLOWING LINES FOR OPENSTACK PROVIDER: 60 | #if provider == "openstack" 61 | # config.ssh.username = $ssh_user 62 | # config.ssh.private_key_path = $ssh_keypath 63 | #end 64 | # DO NOT ADD YET!!! 65 | # config.ssh.username = $ssh_user 66 | # config.ssh.private_key_path = $ssh_keypath 67 | 68 | # Guest Definitions: 69 | # ------------------------ 70 | # 71 | # START: Kube Definition(s) 72 | (1..$kube_count).each do |kb| 73 | ip = "#{$subnet}.#{kb}" 74 | 75 | config.vm.define vm_name = "kube#{kb}" do |kube| 76 | 77 | kube.vm.box = $kube_version 78 | kube.vm.hostname = "kube#{kb}" 79 | # NETWORK-SETTINGS: eth1 configured in using the $subnet variable: 80 | kube.vm.network "private_network", ip: "172.16.35.1#{kb}", auto_config: true 81 | # kube.vm.network "public_network", ip: "#{$subnet}.#{kb}" 82 | if $proxy_enable 83 | config.proxy.http = $proxy_http 84 | config.proxy.https = $proxy_https 85 | config.proxy.no_proxy = $proxy_no 86 | end 87 | 88 | if $expose_docker_tcp 89 | kube.vm.network "forwarded_port", guest: 2375, host: ($expose_docker_tcp + i - 1), auto_correct: true 90 | end 91 | $forwarded_ports.each do |guest, host| 92 | kube.vm.network "forwarded_port", guest: guest, host: host, auto_correct: true 93 | end 94 | # Virtualbox Provider (Default --provider=virtualbox): 95 | kube.vm.provider "virtualbox" do |vb| 96 | vb.name = "kube#{kb}" 97 | vb.customize ["modifyvm", :id, "--memory", $kube_memory] 98 | vb.customize ["modifyvm", :id, "--cpus", $kube_vcpus] 99 | if $kube_disk > 10 #Attach additional disk 100 | kube.persistent_storage.enabled = $disk_enabled 101 | kube.persistent_storage.location = $disk_location+"kube#{kb}."+$disk_image_file 102 | kube.persistent_storage.size = $kube_disk * 1024 - 10240 103 | end 104 | end 105 | # Libvirt Provider (Optional --provider=libvirt) 106 | kube.vm.provider "libvirt" do |lv| 107 | lv.driver = "kvm" 108 | lv.memory = $kube_memory 109 | lv.cpus = $kube_vcpus 110 | lv.machine_virtual_size = $kube_disk 111 | end 112 | # Openstack Provider (Optional --provider=openstack): 113 | kube.vm.provider "openstack" do |os| 114 | # Openstack Authentication Information: 115 | os.openstack_auth_url = $os_auth_url 116 | os.username = $os_username 117 | os.password = $os_password 118 | os.tenant_name = $os_tenant 119 | # Openstack Instance Information: 120 | os.server_name = "kube#{kb}" 121 | os.flavor = $os_flavor 122 | os.image = $os_image 123 | os.floating_ip_pool = $os_floatnet 124 | os.networks = $os_fixednet 125 | os.keypair_name = $os_keypair 126 | os.security_groups = $os_secgroups 127 | end 128 | # We only want Ansible to run after after all servers are deployed: 129 | if kb == $kube_count 130 | kube.vm.provision :ansible do |ansible| 131 | ansible.sudo = true 132 | ansible.limit = $ansible_limit 133 | ansible.playbook = $ansible_playbook 134 | ansible.host_key_checking = false 135 | ansible.groups = { 136 | # Kube-Master hosts (currently kubeadm limitations to kube1): 137 | "kube-masters" => [$kube_masters], 138 | # Kube-Worker hosts (all): 139 | "kube-workers" => [$kube_workers], 140 | # Kube-Control is your primary `kubectl` host: 141 | "kube-control" => [$kube_control], 142 | "kube-cluster:children" => ["kube-masters", "kube-workers"], 143 | } 144 | ansible.extra_vars = { 145 | "public_iface" => $public_iface, 146 | "proxy_enable" => $proxy_enable, 147 | "proxy_http" => $proxy_http, 148 | "proxy_https" => $proxy_https, 149 | "proxy_no" => $proxy_no 150 | } 151 | # Additional Ansible tools for debugging: 152 | #ansible.inventory_path = $ansible_inventory 153 | #ansible.verbose = "-vvvv" 154 | #ansible.raw_ssh_args = ANSIBLE_RAW_SSH_ARGS 155 | end 156 | end 157 | end 158 | end 159 | end 160 | -------------------------------------------------------------------------------- /config.rb: -------------------------------------------------------------------------------- 1 | # Copyright 2016, AT&T, and it's Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Kubernetes Details: Instances 16 | $kube_version = "ubuntu/xenial64" 17 | $kube_memory = 1024 18 | $kube_disk = 10 19 | $kube_vcpus = 1 20 | $kube_count = 3 21 | $git_commit = "6a7308d" 22 | $subnet = "192.168.236" 23 | $public_iface = "enp0s8" 24 | $forwarded_ports = {} 25 | 26 | # Virtualbox instance additional disk properties: 27 | $disk_enabled = true 28 | $disk_location = "~/VirtualBox VMs/" 29 | $disk_image_file = "vmdk" 30 | #$disk_mountname = "xfs" 31 | #$disk_mountpoint = "/mnt/xfs" 32 | 33 | # Ansible Declarations: 34 | #$number_etcd = "kube[1:2]" 35 | #$number_master = "kube[1:2]" 36 | #$number_worker = "kube[1:3]" 37 | $kube_masters = "kube1" 38 | $kube_workers = "kube[2:3]" 39 | $kube_control = "kube1" 40 | 41 | # Virtualbox leave / Openstack change to OS default username: 42 | $ssh_user = "ubuntu" 43 | $ssh_keypath = "~/.ssh/id_rsa" 44 | $ssh_port = 22 45 | 46 | # Ansible Details: 47 | $ansible_limit = "all" 48 | $ansible_playbook = "halcyon-kubernetes/kube-deploy/kube-deploy.yml" 49 | $ansible_inventory = ".vagrant/provisioners/ansible/inventory_override" 50 | 51 | # Openstack Authentication Information: 52 | $os_auth_url = "http://your.openstack.url:5000/v2.0" 53 | $os_username = "user" 54 | $os_password = "password" 55 | $os_tenant = "tenant" 56 | 57 | # Openstack Instance Information: 58 | $os_flavor = "m1.small" 59 | $os_image = "ubuntu-trusty-16.04" 60 | $os_floatnet = "public" 61 | $os_fixednet = ['vagrant-net'] 62 | $os_keypair = "your_ssh_keypair" 63 | $os_secgroups = ["default"] 64 | 65 | # Proxy Configuration (only use if deploying behind a proxy): 66 | $proxy_enable = false 67 | $proxy_http = "http://proxy:8080" 68 | $proxy_https = "https://proxy:8080" 69 | $proxy_no = "localhost,127.0.0.1" 70 | -------------------------------------------------------------------------------- /get-k8s-creds.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2016, AT&T, and it's Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 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 | set -e 18 | # Setting up kubectl creds 19 | mkdir -p ${HOME}/.kube 20 | if [ -f ${HOME}/.kube/config ]; then 21 | echo "Previous kube config found, backing it up" 22 | mv -v ${HOME}/.kube/config ${HOME}/.kube/config.$(date "+%F-%T") 23 | fi 24 | echo "Getting kubeconfig from kube1" 25 | vagrant ssh kube1 -c "sudo cat /etc/kubernetes/admin.conf" > ${HOME}/.kube/config 26 | 27 | # Setting up helm client if present 28 | if which helm 2>/dev/null; then 29 | helm init --client-only 30 | fi 31 | 32 | echo "clients should now be ready to access the Kubernetes cluster" 33 | -------------------------------------------------------------------------------- /setup-halcyon.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | # This script simply sets up the basic defaults for a number of development 4 | # senarios, it is written not to be elegant, but to be portable across a wide 5 | # number of platforms with no addtional requirements other than bash. 6 | 7 | : ${HALCYON_GROUP_VARS:="./halcyon-kubernetes/kube-deploy/group_vars/all.yml"} 8 | : ${VAGRANT_VARS:="./config.rb"} 9 | : ${BOOTSTRAP_OS:="ubuntu"} 10 | : ${KUBERNETES_CONFIG:="default"} 11 | : ${KUBERNETES_VERSION:="v1.5.4"} 12 | 13 | set +e 14 | if [[ "$OSTYPE" == "darwin"* ]]; then 15 | SED=`which gsed` 16 | if [[ -z "$SED" ]]; then 17 | echo "No suitable sed installed, please install gsed" 18 | exit 1 19 | fi 20 | else 21 | SED=`which sed` 22 | fi 23 | set -e 24 | 25 | usage(){ 26 | cat <<'EOT' 27 | Call this script with... 28 | --k8s-config (-c) [default|kolla] 29 | --guest-os (-g) [ubuntu|centos] 30 | --k8s-version (-v) [kubernetes version] 31 | EOT 32 | exit 0; 33 | } 34 | 35 | # exit if there are no arguments 36 | [ $# -eq 0 ] && usage 37 | 38 | # $# is the number of arguments 39 | while [ $# -gt 0 ] 40 | do 41 | case "$1" in 42 | -g|--guest-os) BOOTSTRAP_OS="$2"; shift;; 43 | -c|--k8s-config) KUBERNETES_CONFIG="$2"; shift;; 44 | -v|--k8s-version) KUBERNETES_VERSION="$2"; shift;; 45 | -h| --help) usage;; 46 | --) shift;break;; 47 | *) break;; 48 | esac 49 | shift 50 | done 51 | 52 | cleanup_before_exit () { 53 | echo -e "Running cleanup code and exiting" 54 | } 55 | trap cleanup_before_exit EXIT 56 | 57 | 58 | set_yml_value () { 59 | VARIABLE=$1 60 | VALUE=$2 61 | FILE=$3 62 | $SED -i "/^${VARIABLE}/c\\${VARIABLE}: ${VALUE}" ${FILE} 63 | } 64 | 65 | set_rb_value () { 66 | VARIABLE=$1 67 | VALUE=$2 68 | FILE=$3 69 | $SED -i "/^\$${VARIABLE}/c\\\$${VARIABLE} = ${VALUE}" ${FILE} 70 | } 71 | 72 | set_kolla_options () { 73 | BOOL_VALUE=$1 74 | for VARIABLE in docker_shared_mounts setup_host_kube_dns setup_host_ceph patch_kube_ceph 75 | do 76 | set_yml_value ${VARIABLE} ${BOOL_VALUE} ${HALCYON_GROUP_VARS} 77 | done 78 | } 79 | 80 | echo "Setting up halcyon for: ${BOOTSTRAP_OS} with kubernetes ${KUBERNETES_VERSION} ($KUBERNETES_CONFIG)" 81 | 82 | if [[ "$BOOTSTRAP_OS" = "centos" ]]; then 83 | set_rb_value kube_version \"centos/7\" ${VAGRANT_VARS} 84 | set_yml_value bootstrap_os centos ${HALCYON_GROUP_VARS} 85 | 86 | set_rb_value public_iface \"eth1\" ${VAGRANT_VARS} 87 | set_yml_value public_iface eth0 ${HALCYON_GROUP_VARS} 88 | set_yml_value nat_iface eth0 ${HALCYON_GROUP_VARS} 89 | 90 | set_rb_value ssh_user \"centos\" ${VAGRANT_VARS} 91 | 92 | set_rb_value os_image \"centos-7.2\" ${VAGRANT_VARS} 93 | 94 | elif [[ "$BOOTSTRAP_OS" = "ubuntu" ]]; then 95 | set_rb_value kube_version \"ubuntu/xenial64\" ${VAGRANT_VARS} 96 | set_yml_value bootstrap_os ubuntu ${HALCYON_GROUP_VARS} 97 | 98 | set_rb_value public_iface \"enp0s8\" ${VAGRANT_VARS} 99 | set_yml_value public_iface enp0s3 ${HALCYON_GROUP_VARS} 100 | set_yml_value nat_iface enp0s3 ${HALCYON_GROUP_VARS} 101 | 102 | set_rb_value ssh_user \"ubuntu\" ${VAGRANT_VARS} 103 | 104 | set_rb_value os_image \"ubuntu-trusty-16.04\" ${VAGRANT_VARS} 105 | 106 | fi 107 | 108 | 109 | if [[ "$KUBERNETES_CONFIG" = "default" ]]; then 110 | set_kolla_options "false" 111 | 112 | set_rb_value kube_memory 1024 ${VAGRANT_VARS} 113 | set_rb_value kube_vcpus 1 ${VAGRANT_VARS} 114 | 115 | set_rb_value kube_count 3 ${VAGRANT_VARS} 116 | set_rb_value kube_workers \"kube[2:3]\" ${VAGRANT_VARS} 117 | 118 | elif [[ "$KUBERNETES_CONFIG" = "kolla" ]]; then 119 | set_kolla_options "true" 120 | 121 | set_rb_value kube_memory 2048 ${VAGRANT_VARS} 122 | set_rb_value kube_vcpus 2 ${VAGRANT_VARS} 123 | 124 | set_rb_value kube_count 4 ${VAGRANT_VARS} 125 | set_rb_value kube_workers \"kube[2:4]\" ${VAGRANT_VARS} 126 | 127 | fi 128 | 129 | set_yml_value kube_version ${KUBERNETES_VERSION} ${HALCYON_GROUP_VARS} 130 | --------------------------------------------------------------------------------