Commit graph

1031 commits

Author SHA1 Message Date
kirby@puppetlabs.com
7623058ae7 Update entrypoint in dockerfile for vmpooler gem
This commit updates dockerfile entrypoint to remove the explicit
vmpooler executable path. Additionally, CMD is added to run a default
command when runtime parameters are not passed in by the user. Without
this change the vmpooler executable path is hardcoded into a directory
that will not exist.
2018-07-17 16:01:22 -07:00
Jenkins
d226a8e9fa (GEM) update vmpooler version to 0.1.0 2018-07-17 22:40:15 +00:00
Jenkins
6c9280ff25 (GEM) update vmpooler version to 0.0.2 2018-07-17 22:34:55 +00:00
kirby@puppetlabs.com
36771e65bc (MAINT) release 0.1.0 2018-07-17 14:48:38 -07:00
Spencer McElmurry
67eb05c2f3
Merge pull request #285 from mattkirby/add_changelog
(doc) Add changelog and contributing guidlines
2018-07-17 14:26:07 -07:00
Spencer McElmurry
c1a8cee16d
Merge pull request #286 from mattkirby/remove_2_2
(maint) Remove ruby 2.2.10 from travis config
2018-07-17 14:24:02 -07:00
Spencer McElmurry
b4fb94aec8
Merge pull request #287 from mattkirby/require_updates
(maint) Fix vmpooler require in bin/vmpooler
2018-07-17 14:23:39 -07:00
kirby@puppetlabs.com
f425996768 (maint) Fix vmpooler require in bin/vmpooler
During a rebase the vmpooler require was mixed up and still specified
lib/vmpooler. This commit removes this as well as the rubygems
requirement. Without this change vmpooler fails to work when built
because it cannot load lib/vmpooler.
2018-07-16 17:16:17 -07:00
kirby@puppetlabs.com
dd6af73abd (maint) Remove ruby 2.2.10 from travis config
This commit removes ruby 2.2.10 from travis configuration. Without this change travis tests fail since vmpooler has dropped ruby 2.2.10 support.
2018-07-16 17:11:30 -07:00
kirby@puppetlabs.com
afd5f87ed6 (doc) Add changelog and contributing guidlines
This commit adds a changelog and contributing guidelines to vmpooler. Without this change vmpooler offers no specific contributing guidelines or changelog.
2018-07-16 16:46:03 -07:00
mattkirby
95d9c83479
Merge pull request #281 from mattkirby/pooler_109
(POOLER-109) Allow API to run independently
2018-07-16 16:41:37 -07:00
Spencer McElmurry
5ca85beb18
Merge pull request #283 from mattkirby/remove_find_pool
(MAINT) Remove find_pool and update pending tests
2018-07-16 10:25:16 -07:00
kirby@puppetlabs.com
4788693749 Update gemspec in preparation for vmpooler release
This commit updates gemspec and Gemfile in preparation of a vmpooler release. To support this change the vmpooler executable is placed into a bin directory for inclusion in the gem. The license in gemspec is updated to Apache 2.0 to reflect the vmpooler project license.
2018-07-14 15:49:58 -07:00
kirby@puppetlabs.com
fcb3880852 Configure vmpooler to run from bin/vmpooler 2018-07-14 15:49:58 -07:00
kirby@puppetlabs.com
ff1d288b53 (MAINT) Remove find_pool and update pending tests
This commit removes find_pool, which is no longer used. Additionally, tests which are listed as pending and have been resolved are removed from pending tests. Lastly, a folder check that doesn't make sense given the change in method for finding objects is removed.
2018-07-13 12:42:09 -07:00
kirby@puppetlabs.com
d9e1feadea Add documentation for new parameters to example configuration files 2018-07-13 12:24:55 -07:00
kirby@puppetlabs.com
c64a8afc3f Get whitelist from provider_config 2018-07-13 12:09:28 -07:00
kirby@puppetlabs.com
a34c8dd11b (POOLER-66) Purge vms and folders no longer configured
This commit enables optional purging for vms and folders when they are
not configured in the vmpooler provided configuration. Base folders are
determined from folders specified in the pool configuration. Then,
anything not configured in that folder for that provider and is not a
whitelisted folder title will be destroyed. Without this change vmpooler
will leave unconfigured vms and folders behind and any vms will be left
running forever without manual intervention. Additionally, any
associated redis data will never be expired.
2018-07-13 12:09:28 -07:00
mattkirby
070199e877 Eliminate duplicate VM object lookups where possible (#269)
* Minimize duplicate checking of VMs

This commit updates check_pool pending, running and ready methods to greatly reduce instances in which the VM object is retrieved. Without this change get_vm is run for each of these check_pool steps even though the VM is already validated as being in inventory being running the check. This is left for checking running VMs when the VM is no longer ready. Without this change there is an unnecessarily large volume of VM object checks.

* Make hostname mismatch checking optional

This commit makes hostname mismatch checking optional on a pool and global config level. The default behavior of checking this is preserved. When disabled _check_ready_vm will not run get_vm, which allows for ready VMs to be checked without retrieving an object from vsphere and waiting for a free provider connection. Without this change it is not possible to disable VM object retrieval in _check_vm_ready.

* Check if a hostname return is empty string

This commit checks whether a hostname returned is an empty string.
Without this change a VM that returns a hostname with a empty string
will report as having a hostname mismatch, which may happen before all
VM data is updated.

* Only check hostname for mismatch after time since ready has past

Configure hostname checking so it is not checked until a VM has been
ready for greater than one minute. Without this change hostname checking
will often fail because the configured value has not propogated to the
VM on some platforms before this check is run.
2018-07-13 12:06:44 -05:00
kirby@puppetlabs.com
1e63d25b2b Allow vmpooler to run without specifying a configuration file 2018-07-13 09:36:43 -07:00
kirby@puppetlabs.com
b4bae80eeb Set config via env for dashboard spec 2018-07-13 09:35:18 -07:00
kirby@puppetlabs.com
528020fec7 (POOLER-109) Allow API to run independently
This commit updates vmpooler to allow the API component and dashboard to
run separately from pool_manager. Without this change vmpooler does not
offer a mechanism to run only the API, or pool_manager components.

Two instances of hardcoded puma environment settings are removed. This
is still set in the init script explicitly as well as via an environment
variable in the dockerfile.

To extend the mechanism of running the API or pool_manager components to
instances running in docker an entrypoint is added in the dockerfile.
The entrypoint allows a user to specify whether to run the API or
pool_manager components when running the application. The default
behavior is preserved where both components are run.

To support these changes vmpooler.rb is updated to allow more of the
configuration to be specified via individual environment variables. It
was already possible to specify the entire config block as an
environment variable, but this is more difficult to manage and less of a
standard implementation than specifying individual parameters. Where
specified environment variable options will override a value configured
via the configuration file or environment.

The running pool configuration when starting pool_manager is loaded to
redis at pool_manager start time. This allows the API to load the
running pool configuration from redis and be able to run without
requiring the pool configuration.

Lastly, the dockerfile leveraging entrypoint will no longer start
vmpooler with the init script or write logs to a file. Instead, LOGFILE
is set to /dev/stdout and the vmpooler application is started directly.
This behavior is preferred because the log file writes to disk are an
unnecessary overhead. Without this change the docker installation will
attempt to daemonize the vmpooler application and always requires puma.
2018-07-13 09:35:18 -07:00
mattkirby
7e5ef2f4e5
Merge pull request #264 from logicminds/gemspec
Adds a gemspec file
2018-07-13 09:23:11 -07:00
Spencer McElmurry
12bba418d1 (POOLER-81) Add time remaining information (#280)
* (POOLER-81) Add time_remaining information

Before, the only time calculation displayed for a given VM was the
lifetime parameter. Added the remaining parameter which will
display time until the VM is destroyed as a float.

Additionally, start_time and end_time were added to api to return
as UTC based times (e.g. 2018-07-10 11:01:03 -0700).

* Remove abs eval from GET, rework spec tests to check each field.
This allows us to account for "flakiness" of the remaining return.

* Change datetime to RFC3339 for start_time and end_time
2018-07-12 09:40:22 -07:00
Spencer McElmurry
84065dd059 Revert "(POOLER-81) Add time_remaining information" (#279)
* Revert "(POOLER-34) Ship clone request to ready time to metrics (#277)"

This reverts commit a865e6bd2f.

* Revert "(POOLER-81) Add time_remaining information (#276)"

This reverts commit 1910cffaf7.
2018-07-10 09:00:12 -07:00
Spencer McElmurry
a865e6bd2f (POOLER-34) Ship clone request to ready time to metrics (#277)
* (POOLER-34) Ship clone request to ready time to metrics

Before, we were already capturing this metric but we failed to ship
it anywhere. This ships the appropriate metric as `time_to_ready_state`
Dashboards can be found in grafana.

* Add spec test to ensure metric is being shipped properly on
move_pending_vm_to_ready call.
2018-07-09 16:22:49 -07:00
Spencer McElmurry
1910cffaf7 (POOLER-81) Add time_remaining information (#276)
* (POOLER-81) Add time_remaining information

Before, the only time calculation displayed for a given VM was the
lifetime parameter. Added the time_remaining parameter which will
display time until the VM is destroyed in hours, minutes, seconds.

Additionally, updated the running parameter to display in a similar
fashion as time_remaining.

* Add spec testing for testing time_remaining stat
2018-07-09 16:22:05 -07:00
Spencer McElmurry
f27e2c1301
Merge pull request #278 from mattkirby/fix_folder_test
(MAINT) Fix test reference to find_vm
2018-07-09 15:04:24 -07:00
kirby@puppetlabs.com
9ddd3c21b7 (MAINT) Fix test reference to find_vm
This commit updates a test reference to find_vm. This method has been renamed find_vm_folder, so this commit updates usage to reflect the new title and reduced arguments required. Without this change tests fail on master.
2018-07-09 14:57:07 -07:00
mchllweeks
6f4f3cc4e7
Merge pull request #273 from mattkirby/pooler_124
(POOLER-124) Fix evaluation of max_tries
2018-07-09 12:50:34 -07:00
mchllweeks
afc5a33d8f
Merge pull request #272 from mattkirby/pooler_40
(POOLER-40) Do not return folders with get_pool_vms
2018-07-09 12:50:00 -07:00
mchllweeks
2f98b1bd7a
Merge pull request #271 from mattkirby/less_delta_disks
Ensure template deltas are created once
2018-07-09 12:49:08 -07:00
mchllweeks
69f8b21ca8
Merge pull request #270 from mattkirby/no_duplicate_vms_in_pool
Do not run duplicate instances of inventory check for a pool
2018-07-09 12:48:41 -07:00
mchllweeks
a72012b754
Merge pull request #268 from mattkirby/reduce_object_lookups
Reduce object lookups for finding folders
2018-07-09 12:46:17 -07:00
Samuel
596af14918
Merge pull request #275 from mattkirby/jruby_92
Add jruby 9.2 to travis testing
2018-07-06 17:45:08 -05:00
kirby@puppetlabs.com
bc4bf32638 Add jruby 9.2 to travis testing
This commit adds jruby 9.2 to travis testing. Without this change vmpooler is not tested against jruby 9.2.
2018-07-05 17:17:24 -07:00
kirby@puppetlabs.com
faaec4f9bc (POOLER-124) Fix evaluation of max_tries
This commit updates usage of max_tries to ensure that the increment of the try value happens after evaluation of whether max_tries has been exceeded. Without this change max_tries doesn't work as advertised. Additionally, checking looks to see if try is greater than or equal to so the try count exceeding max_tries would also be detected.
2018-07-03 11:24:05 -07:00
kirby@puppetlabs.com
bd0ae2e192 (POOLER-40) Do not return folders with get_pool_vms
This commit updates get_pool_vms to only return if the object is a VirtualMachine. Without this change a folder wtihin a VM target folder can be discovered and destroyed as though it were a VM.
2018-07-03 11:09:07 -07:00
kirby@puppetlabs.com
170d2090f8 Add some documentation to get_vm_hash 2018-07-03 09:12:05 -07:00
kirby@puppetlabs.com
70156ba7f7 Do not prepare template when config_template is set 2018-07-02 14:12:17 -07:00
kirby@puppetlabs.com
1b17cceb01 Ensure template deltas are created once
This commit updates how template delta disk creation is evaluated. Without this change template deltas are created for every template on each applicatoin startup. This change updates this behavior to instead run template delta disk creation only once per template configured for a pool. Without this change it is possible to get a template to a state where the XML depth is too great to be read with default settings and the template requires a new clone to resolve.
2018-07-02 09:53:41 -07:00
mchllweeks
0ce66eb763
Merge pull request #266 from mattkirby/pooler_31
(POOLER-31) Expire redis vm key when clone fails
2018-06-29 16:43:04 -07:00
kirby@puppetlabs.com
df89617fdc Do not run duplicate instances of inventory check for a pool
This commit updates check_pool inventory check to prevent multiple instances from running at once. Without this change the inventory check may run in multiple threads simultaneously.
2018-06-28 20:32:44 -07:00
kirby@puppetlabs.com
a6c2ef7bf3 Rename find_folder to find_vm_folder
This commit renames find_folder to find_vm_folder to clarify its intent to retrieve folders from the VM hierarchy. Without this change find_folder implies it may find folders that are not within the VM hierarchy.
2018-06-28 15:26:09 -07:00
kirby@puppetlabs.com
5c857f50f1 Replace find_folder with searchindex inventorypath
This commit replaces find_folder to use information already known about folders to determine their location and quickly fail when it does not exist without traversing the hierarchy. Without this change find_folder is very inneficient and can take a long time to return depending on how deep in the folder tree the folder exists.
2018-06-28 15:25:51 -07:00
kirby@puppetlabs.com
8840ef4a5c Reduce object lookups for get_vm
This commit reduces object lookups used for get_vm. Without this change get_vm looks up the VM folder, which is already used and known to find the vm with find_vm.
2018-06-28 15:25:25 -07:00
mchllweeks
8be578493a
Merge pull request #267 from mattkirby/multiple_ldap_search
(POOLER-113) Add support for multiple LDAP search bases
2018-06-27 15:26:49 -07:00
kirby@puppetlabs.com
4fa54c8008 Move net/ldap require into vmpooler.rb
This commit moves net/ldap require from authenticate_ldap in api/helpers to vmpooler.rb. Without this change net/ldap and rubygems are required again every time authenticate_ldap is run.
2018-06-27 15:21:15 -07:00
kirby@puppetlabs.com
cbd4567454 Provide valid configuration for auth
This commit removes a additional authenticate method that is defined in the token_spec tests. Instead, authenticate is used from api/helpers. To support this change the config provided is updated to specify a dummy provider. Without this change authenticate cannot be tested along with token_spec because token_spec redefines authenticate.
2018-06-27 14:41:27 -07:00
kirby@puppetlabs.com
9fa27af8e5 (POOLER-113) Add support for multiple LDAP search bases
This commit updates vmpooler to support setting an array of search bases
in addition to a single base provided as a string. Without this change
it is not possible to specify multiple search bases to use with the LDAP
authentication provider. Additionally, test coverage is added to
the authentication helper method.
2018-06-25 21:37:22 -07:00