projectatomic / vagrant-service-manager

To provide the user a CLI to configure the ADB/CDK for different use cases and to provide glue between ADB/CDK and the user's developer environment.
GNU General Public License v2.0
18 stars 16 forks source link

Fix #350: Add support of 'install-cli' command for kubernetes #369

Closed coolbrg closed 8 years ago

coolbrg commented 8 years ago

Fix #350

Also includes:

For quick test at local one can use bundle exec rake test rubocop features.

My logs:

➜  vagrant-service-manager git:(fix-350) ✗ bundle exec rake test rubocop features
Run options: --seed 11468

# Running:

.....................................

Finished in 14.060475s, 2.6315 runs/s, 5.6897 assertions/s.

37 runs, 80 assertions, 0 failures, 0 errors, 0 skips
Running RuboCop...
Inspecting 46 files
..............................................

46 files inspected, no offenses detected
\Using existing ADB box (version 2.2.2) in /home/budhram/redhat/vagrant-service-manager/.boxes
|/home/budhram/.rvm/rubies/ruby-2.1.2/bin/ruby -S bundle exec cucumber
Using the default and html profiles...
---------------...............---------------.-------------------------------------------------------------------------------.........................-------------------------.-----------------------------------...........-----------.----------................--------------..........-------------------------------------------------------------...................................-----------------------------------.----------------------------------

24 scenarios (18 skipped, 6 passed)
450 steps (334 skipped, 116 passed)
13m8.380s
bexelbie commented 8 years ago

I've left two comments inline that can be turned into issues and should not block this PR.

However, I don't see the code that creates the config file for kubectl as referenced in https://gist.github.com/praveenkumar/90704a42fe857e1146f3dae2fcae69ef

Am I missing it?

bexelbie commented 8 years ago

@budhrg you mentioned in IRC that kube config creation is part of a separate PR. Where is that PR? I believe this code needs to be dependent on kubectl working once downloaded/installed.

coolbrg commented 8 years ago

@bexelbie It is not dependent on the other PR since its an individual feature in itself.

bexelbie commented 8 years ago

@budhrg I agree it is not dependent in a technical sense. However, from a user perspective we either need to tell them how to build their own config file in documentation or we need to add the code that generates the config and installs it for them. I am suggesting the dependency is usability based.

coolbrg commented 8 years ago

@bexelbie , @navidshaikh : I have updated the PR with another commit to configure kube config and showing its path through env kubernetes.

Note: To verify this patch, one need to use this patched box.

User workflow would be :

eval "$(vagrant service-manager env kubernetes)"
eval "$(VAGRANT_NO_COLOR=1 vagrant service-manager install-cli kubernetes | tr -d '\r')"
kubectl version

Below is my end-to-end kubernetes workflow logs

Click Here ``` $ cat Vagrantfile - Vagrantfile # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure('2') do |config| config.vm.box = 'adb-patched-build' # box downloaded from above mentioned patched box config.registration.skip = true config.servicemanager.services = 'kubernetes' end $ vagrant service-manager env kubernetes # kubernetes env: # Set the following environment variables to enable access to the # kubernetes server running inside of the vagrant virtual machine: export KUBECONFIG=/home/budhram/.vagrant.d/data/service-manager/kubeconfig # run following command to configure your shell: # eval "$(vagrant service-manager env kubernetes)" $ export KUBECONFIG=/home/budhram/.vagrant.d/data/service-manager/kubeconfig $ vagrant service-manager install-cli kubernetes # Binary now available at /home/budhram/.vagrant.d/data/service-manager/bin/kubernetes/1.2.0/kubectl # run binary as: # kubectl export PATH=/home/budhram/.vagrant.d/data/service-manager/bin/kubernetes/1.2.0:$PATH # run following command to configure your shell: # eval "$(VAGRANT_NO_COLOR=1 vagrant service-manager install-cli kubernetes | tr -d '\r')" $ export PATH=/home/budhram/.vagrant.d/data/service-manager/bin/kubernetes/1.2.0:$PATH $ kubectl get nodes NAME STATUS AGE 127.0.0.1 Ready 6m $ vagrant service-manager env --script-readable DOCKER_HOST=tcp://172.28.128.3:2376 DOCKER_CERT_PATH='/home/budhram/redhat/vagrant-service-manager/.vagrant/machines/default/virtualbox/docker' DOCKER_TLS_VERIFY=1 DOCKER_API_VERSION=1.22 KUBECONFIG=/home/budhram/.vagrant.d/data/service-manager/kubeconfig ```
coolbrg commented 8 years ago

retest this please

bexelbie commented 8 years ago

The code visually reviews well. I do not have time to test it today, unfortunately. @navidshaikh @tkral or @praveenkumar can you get to it today/your tomorrow morning?

praveenkumar commented 8 years ago

@budhrg I tested with latest CDK and kubeconf generated as expected and also binary was installed without any issue. LGTM

Let's wait for @navidshaikh test.

coolbrg commented 8 years ago

Working in Windows 10 too.

navidshaikh commented 8 years ago

Working for Mac and Linux too.

navidshaikh commented 8 years ago

LGTM

praveenkumar commented 8 years ago

@navidshaikh / @bexelbie Can you merge it if that is working as expected?