Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

READY FOR REVIEW - Fix #2741. Add support for alternate Vagrant providers: ... #6983

Merged
merged 1 commit into from
Apr 17, 2015
Merged

READY FOR REVIEW - Fix #2741. Add support for alternate Vagrant providers: ... #6983

merged 1 commit into from
Apr 17, 2015

Conversation

posita
Copy link
Contributor

@posita posita commented Apr 17, 2015

...VMWare Fusion, VMWare Workstation, and Parallels. (Replaces #6879. Tagging #2741. Cc: @erictune, @derekwaynecarr, @jameskyle.)

I tried to mirror the Vagrant philosophy and do the right thing in most cases without tweaking configuration (unless you really wanted to override something). The fall-back order is:

If any of these are installed properly (including any required Vagrant plugins), KUBERNETES_PROVIDER=vagrant .../cluster/kube-up.sh should just work. 😁 _CAVEAT__: I do not have a license to VMWare Fusion. I'm pretty sure it will function, but I have only tested Parallels._

To override, you can set VAGRANT_DEFAULT_PROVIDER (e.g., if you have both VMWare and Parallels installed, but want to use Parallels):

export KUBERNETES_PROVIDER=vagrant
export VAGRANT_DEFAULT_PROVIDER=parallels
.../cluster/kube-up.sh

You can override the box (by name):

export KUBERNETES_PROVIDER=vagrant
export VAGRANT_DEFAULT_PROVIDER=parallels
export KUBERNETES_BOX_NAME=rickard-von-essen/opscode_fedora-20 # will fetch from atlas
.../cluster/kube-up.sh

And even specify a version:

export KUBERNETES_PROVIDER=vagrant
export VAGRANT_DEFAULT_PROVIDER=parallels
export KUBERNETES_BOX_NAME=rickard-von-essen/opscode_fedora-20 # will fetch from atlas...
export KUBERNETES_BOX_VERSION=0.3.0 # ...with this version
.../cluster/kube-up.sh

Or specify a URL for the box itself, in which case you now must provide your own name:

export KUBERNETES_PROVIDER=vagrant
export VAGRANT_DEFAULT_PROVIDER=parallels
export KUBERNETES_BOX_NAME=rickard-von-essen-fedora20 # will set the name to this value (with version 0)...
export KUBERNETES_BOX_URL=https://atlas.hashicorp.com/rickard-von-essen/boxes/opscode_fedora-20/versions/0.4.0/providers/parallels.box # ...and download the box from here
.../cluster/kube-up.sh

WARNING: This breaks the existing behavior of KUBERNETES_BOX_URL, which is now ignored unless KUBERNETES_BOX_NAME is also set. Previously that name was fixed for everything (default or specified by URL) as fedora20, irrespective of underlying OS/version. Now if a default box is used, the name is set internally (currently only kube-fedora20), but users who specify their own box URL are now forced to name it. To avoid clashes or confusion, it is recommended (but not enforced) that the name distinguish the box from the defaults (e.g., posita-fedora21, kickass-custom-centos, etc.).

This PR also introduces the ability to set the master memory size independently of the minions (it is included with this PR instead of a separate one because memory configuration is Vagrant provider-specific; see, e.g., this vs. this):

export KUBERNETES_PROVIDER=vagrant
export KUBERNETES_MASTER_MEMORY=1024
export KUBERNETES_MINION_MEMORY=2048
.../cluster/kube-up.sh

KUBERNETES_MEMORY is maintained for backward compatibility. The following are equivalent to the previous example:

export KUBERNETES_PROVIDER=vagrant
export KUBERNETES_MEMORY=1024 # sets both
export KUBERNETES_MINION_MEMORY=2048 # overrides minion
.../cluster/kube-up.sh
export KUBERNETES_PROVIDER=vagrant
export KUBERNETES_MEMORY=2048 # sets both
export KUBERNETES_MASTER_MEMORY=1024 # overrides master
.../cluster/kube-up.sh

@@ -116,6 +167,9 @@ function create-provision-scripts {
}

function verify-cluster {
# TODO: How does the user know the difference between "tak[ing] some
# time" and "loop[ing] forever"? Can we give more specific feedback on
# whether "an error" has occurred?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a common problem with all the Salt based providers (including GCE, AWS, Azure). I will say that the move to do more as pods and less in Salt may make this better over time, and less of a concern.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. Please let me know if I should remove the comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is fine. I too am annoyed when loop forever occurs.

@derekwaynecarr
Copy link
Member

Thanks for the pull request. Testing this now to ensure it does not regress VirtualBox.

@derekwaynecarr
Copy link
Member

The cluster comes up, but I am getting this in the terminal output when invoking cluster/kube-up at start

Starting cluster using provider: vagrant
... calling verify-prereqs
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

  -n, --quiet, --silent
                 suppress automatic printing of pattern space
  -e script, --expression=script
                 add the script to the commands to be executed
  -f script-file, --file=script-file
                 add the contents of script-file to the commands to be executed
  --follow-symlinks
                 follow symlinks when processing in place
  -i[SUFFIX], --in-place[=SUFFIX]
                 edit files in place (makes backup if SUFFIX supplied)
  -c, --copy
                 use copy instead of rename when shuffling files in -i mode
  -b, --binary
                 does nothing; for compatibility with WIN32/CYGWIN/MSDOS/EMX (
                 open files in binary mode (CR+LFs are not treated specially))
  -l N, --line-length=N
                 specify the desired line-wrap length for the `l' command
  --posix
                 disable all GNU extensions.
  -r, --regexp-extended
                 use extended regular expressions in the script.
  -s, --separate
                 consider files as separate rather than as a single continuous
                 long stream.
  -u, --unbuffered
                 load minimal amounts of data from the input files and flush
                 the output buffers more often
  -z, --null-data
                 separate lines by NUL characters
  --help
                 display this help and exit
  --version
                 output version information and exit

If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret.  All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
which: no vmrun in (/home/decarr/google-cloud-sdk/bin:/home/decarr/go/src/github.com/openshift/origin/_output/local/go/bin:/home/decarr/go/bin:/home/decarr/.rbenv/shims:/home/decarr/.rbenv/bin:/home/decarr/google-cloud-sdk/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/go/bin:/usr/local/sbin:/usr/sbin:/home/decarr/.local/bin:/home/decarr/bin:/home/decarr/.rvm/bin:/home/decarr/.rvm/bin)
which: no vmrun in (/home/decarr/google-cloud-sdk/bin:/home/decarr/go/src/github.com/openshift/origin/_output/local/go/bin:/home/decarr/go/bin:/home/decarr/.rbenv/shims:/home/decarr/.rbenv/bin:/home/decarr/google-cloud-sdk/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/go/bin:/usr/local/sbin:/usr/sbin:/home/decarr/.local/bin:/home/decarr/bin:/home/decarr/.rvm/bin:/home/decarr/.rvm/bin)
which: no prlctl in (/home/decarr/google-cloud-sdk/bin:/home/decarr/go/src/github.com/openshift/origin/_output/local/go/bin:/home/decarr/go/bin:/home/decarr/.rbenv/shims:/home/decarr/.rbenv/bin:/home/decarr/google-cloud-sdk/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/go/bin:/usr/local/sbin:/usr/sbin:/home/decarr/.local/bin:/home/decarr/bin:/home/decarr/.rvm/bin:/home/decarr/.rvm/bin)
... calling kube-up

Not sure where this is coming from in your branch, but noting so I can remember to look in more detail.

@posita
Copy link
Contributor Author

posita commented Apr 17, 2015

The cluster comes up, but I am getting this in the terminal output when invoking cluster/kube-up at start ... Not sure where this is coming from in your branch, but noting so I can remember to look in more detail.

I'm pretty sure it's this. I should have remembered that some platforms' seds don't support the -E option (meaning extended regular expressions). I will fix this right now.

customize_vm minion
minion_vm_name = "minion-#{n+1}"
minion_prefix = ENV['INSTANCE_PREFIX'] || 'kubernetes' # must mirror default in cluster/vagrant/config-default.sh
minion_hostname = "#{minion_prefix}#{minion_vm_name}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minion_hostname changes with this change from kubernetes-minion-1 to kubernetesminion-1.

Please address.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed in a05dafc. Will squash once all problems are addressed.

@derekwaynecarr
Copy link
Member

A few issues noted in the PR. Please resolve, squash commits, and I will then merge.

fi

if ([ -z "${provider_bin}" ] \
|| which "${provider_bin}" >/dev/null) \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following:

which: no vmrun in (/home/decarr/google-cloud-sdk/bin:/home/decarr/go/src/github.com/openshift/origin/_output/local/go/bin:/home/decarr/go/bin:/home/decarr/.rbenv/shims:/home/decarr/.rbenv/bin:/home/decarr/google-cloud-sdk/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/go/bin:/usr/local/sbin:/usr/sbin:/home/decarr/.local/bin:/home/decarr/bin:/home/decarr/.rvm/bin:/home/decarr/.rvm/bin)
which: no vmrun in (/home/decarr/google-cloud-sdk/bin:/home/decarr/go/src/github.com/openshift/origin/_output/local/go/bin:/home/decarr/go/bin:/home/decarr/.rbenv/shims:/home/decarr/.rbenv/bin:/home/decarr/google-cloud-sdk/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/go/bin:/usr/local/sbin:/usr/sbin:/home/decarr/.local/bin:/home/decarr/bin:/home/decarr/.rvm/bin:/home/decarr/.rvm/bin)
which: no prlctl in (/home/decarr/google-cloud-sdk/bin:/home/decarr/go/src/github.com/openshift/origin/_output/local/go/bin:/home/decarr/go/bin:/home/decarr/.rbenv/shims:/home/decarr/.rbenv/bin:/home/decarr/google-cloud-sdk/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/go/bin:/usr/local/sbin:/usr/sbin:/home/decarr/.local/bin:/home/decarr/bin:/home/decarr/.rvm/bin:/home/decarr/.rvm/bin)

can we change to do the following:

which "${provider_bin}" &>/dev/null

That is the last issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops! 😮 Thanks for catching that! Believe it or not, I had intended to do that originally. This is just not my week. 😞

Addressed in e8672e2. I noticed that elsewhere in the file, the older >/dev/null 2>&1 is used (even though &> is supported as of bash 4). I followed the existing convention for consistency, but can change it if desired.

@derekwaynecarr
Copy link
Member

LGTM - thanks!

@derekwaynecarr derekwaynecarr added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 17, 2015
derekwaynecarr added a commit that referenced this pull request Apr 17, 2015
READY FOR REVIEW - Fix #2741. Add support for alternate Vagrant providers: ...
@derekwaynecarr derekwaynecarr merged commit 40d0e55 into kubernetes:master Apr 17, 2015
@posita posita deleted the vagrant-provider-support-2741 branch April 17, 2015 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants