Commit graph

296 commits

Author SHA1 Message Date
Dimitri Tischenko
aaee741b79
Merge 45461bdd44 into 99056f7bf1 2026-01-21 04:16:33 +00:00
Mahima Singh
76eb62577b
Merge pull request #690 from puppetlabs/P4DEVOPS-9434
Some checks failed
Security / Mend Scanning (push) Has been cancelled
Add rate limiting and input validation security enhancements
2025-12-26 15:44:39 +05:30
Mahima Singh
7c9568466f
Merge branch 'main' into P4DEVOPS-8570 2025-12-26 15:31:29 +05:30
Mahima Singh
d0020becb3 Add rate limiting and input validation security enhancements 2025-12-24 17:43:36 +05:30
Mahima Singh
fe9f98e281 Fix test expectations for metrics in pool_manager_spec 2025-12-24 14:58:15 +05:30
Mahima Singh
46e77010f6 Prevent VM allocation for already-deleted request-ids 2025-12-24 14:11:30 +05:30
Mahima Singh
7b657edd0d Add Phase 2 optimizations: status API caching and improved Redis pipelining
- Add in-memory cache for /status endpoint with 30s TTL
- Cache keyed by view parameters to handle different query patterns
- Add cache clearing for tests to prevent interference
- Optimize get_queue_metrics to use single pipeline for all Redis calls
  - Previously made 7+ separate pipeline calls
  - Now combines all queue metrics into one pipeline (7n+2 operations)
  - Reduces Redis round trips and improves API response time
- Update unit tests to match new pipelining behavior
- All 866 tests passing
2025-12-24 13:55:24 +05:30
Mahima Singh
c24fe28d6d
Merge branch 'main' into P4DEVOPS-8567 2025-12-19 14:26:43 +05:30
Mahima Singh
a83916a0a4 Fix queue reliability test failures
- Add skip_metrics parameter to move_to_dlq to avoid double-counting when called from purge
- Fix purge_pending_queue to only increment count when not in dry-run mode
- Add nil check for config redis before accessing data_ttl
- Update health check tests to allow all gauge calls before checking specific metrics
- Reorder push_health_metrics to emit error/queue/task metrics before status

All 851 tests now pass including 40 queue reliability tests.
2025-12-19 13:29:34 +05:30
Mahima Singh
b3be210f99 Add DLQ, auto-purge, and health checks for Redis queues
- Implement dead-letter queue (DLQ) to capture failed VM operations
- Implement auto-purge to clean up stale queue entries
- Implement health checks to monitor queue health
- Add comprehensive tests and documentation

Features:
- DLQ captures failures from pending, clone, and ready queues
- Auto-purge removes stale VMs with configurable thresholds
- Health checks expose metrics for monitoring and alerting
- All features opt-in via configuration (backward compatible)
2025-12-19 13:17:02 +05:30
Mahima Singh
8372ea824f Fixed spec tests 2025-12-04 16:19:34 +05:30
Mahima Singh
f290c6806e Implement request cancellation handling to prevent unnecessary VM spin-up 2025-12-04 16:05:07 +05:30
isaac-hammes
f6af7cd2a6 (P4DEVOPS-6096) Include VMs that have been requested but not moved to pending when getting queue metrics 2025-05-08 11:45:31 -07:00
Dimitri Tischenko
45461bdd44 remove references to provider 2023-09-19 13:20:50 +01:00
Dimitri Tischenko
3ac0a25557 fix rubocop and spec issues 2023-09-19 12:46:35 +01:00
isaac-hammes
ef7000dafc (maint) Fix spec test to catch unexpected logging in fail_pending_vm. 2023-08-24 06:24:13 -07:00
isaac-hammes
eee7c4082a (maint) Raise error when ip address is not given to vm after clone. 2023-08-22 13:36:33 -07:00
isaac-hammes
17a1831952 (POD-8) Add timeout_notification config to log warning before vm is destroyed. 2023-08-22 12:09:17 -07:00
Jake Spain
fdbb0f3a77
Add ability to use bind_as with a service account 2023-08-21 07:17:47 -04:00
isaac-hammes
43f085352b (POD-10) Log reason for failed VM checks. 2023-08-17 13:41:15 -07:00
isaac-hammes
46156fd85f Convert Times to strings when being added to redis. 2023-08-08 11:05:55 -07:00
isaac-hammes
30820ec115 (RE-15162) Update Redis gem to version 5 2023-08-07 08:37:17 -07:00
Jake Spain
528e9635d1
exit application if domain setting is used 2023-03-27 21:27:45 -04:00
Jake Spain
93201756a0
Add v3 api and remove v2 2023-03-27 21:27:43 -04:00
Jake Spain
1df7ab6d34
Fix tests based on new dns config 2023-03-27 21:27:41 -04:00
Jake Spain
91248fe23a
Added spec tests for Vmpooler::Dns 2023-03-27 21:27:40 -04:00
Jake Spain
fb80d989c8
Removed api/v1 spec tests 2023-03-27 21:27:39 -04:00
Jake Spain
0119126cd1
Update hostname_shorten and callers 2023-03-27 21:27:36 -04:00
Jake Spain
b1e20a2fc0
Get zone from config and add dns/base_spec 2023-03-27 21:27:30 -04:00
Jake Spain
ac96550f57
Stub out dns provider usage 2023-03-27 21:27:15 -04:00
Samuel Beaulieu
9a9dfce316
adding an api endpoint to print the current full config 2022-03-31 13:16:02 -05:00
Samuel Beaulieu
2e608b7196
spec test domain set at the config and provider levels 2022-03-31 13:15:58 -05:00
Samuel Beaulieu
a2d613782a
remove 'last minute' tcp vm_ready check from the api for pooled vms
the vm_ready methods should be implemented per provider and checking in the api
creates issues since provider code is not available. Removing this for the V2 api
2022-03-31 13:15:56 -05:00
Samuel Beaulieu
dd375b20c3
document the new provider configuration skip_dns_check_before_creating_vm 2022-03-31 13:15:55 -05:00
Samuel Beaulieu
66eb598e4e
tabling this PR for the next sprint 2022-03-31 13:15:54 -05:00
Samuel Beaulieu
e5c477254f
initial review 2022-03-31 13:15:53 -05:00
6b9eb2369f
Connect domain settings to pools, create v2 API 2022-03-31 13:15:52 -05:00
Samuel Beaulieu
c225bafc4a
fix spec tests to include pipelined 2022-03-30 15:52:29 -05:00
Samuel Beaulieu
23efcc4cc0
(maint) Fix EXTRA_CONFIG merge behavior
Before this change if an extra config file had new keys they would get
merged to the main config but if it contained an existing key, like
'providers' it would overwrite the original config.
Adding a library 'deep_merge' to do a more natural merge, where existing keys
get sub-elements added together and arrays are combined like for the
pool configuration.
Adding spec tests around EXTRA_CONFIG as they were missing, by adding
and testing two new extra_config.yaml fixture files
2021-12-23 13:34:33 -06:00
45378d46b9
Ensure all configured providers are loaded
Prior to this, providers that should have been loaded per the
provider_class key of the providers hash were not actually loaded.
2021-12-10 21:05:54 -05:00
7872bfe8fc
Merge pull request #469 from puppetlabs/tag_vm_user
(maint) Adding a provider method tag_vm_user
2021-12-09 13:41:30 -05:00
Samuel Beaulieu
daea25b1d1
(maint) Adding a provider method tag_vm_user
This method should be called only once, when the VM is moved to a running state
which is when the data for the user (if using tokens) is available. In vmpooler
base provider it is a noop method, but the various providers can implement it
to tag or label a running VM with the name of the user who checked it out
2021-12-09 11:13:03 -06:00
Samuel
ea86c2645a
Update lib/vmpooler/providers/base.rb
Co-authored-by: Gene Liverman <gene.liverman+06301990@puppet.com>
2021-12-09 09:32:04 -06:00
Samuel Beaulieu
f6bbef4245
Move vsphere specific methods out of vmpooler
vmpooler has the vsphere provider taken out, moving some vsphere related
methods to the provider:
1) pool_folders
2) get_base_folders
At the same time renaming some configuration and code items
to remove harmful terminology.
purge_unconfigured_folders DEPRECATED, use purge_unconfigured_resources
folder_whitelist DEPRECATED, use resources_allowlist
the above configuration items are still supported but will be removed in
the next major version.
base class method purge_unconfigured_folders was renamed to purge_unconfigured_resources
and requires the equivalent change in the provider classes

abc
2021-12-08 13:02:34 -06:00
bc0a369602
Move vsphere provider to its own gem 2021-12-03 09:41:29 -05:00
a0caa41a54
(DIO-2675) Undo pool size template overrides
This implements a delete method for pooltemplate and poolsize. The API
removes the override from Redis and then adds an entry in Redis that
causes the pool manager to wake up and process the removal of the
override.

To facilitate this, a new variable has been created in lib/vmpooler.rb
to hold a copy of the original / pre-override config. This supplemental
copy of the pools is then indexed for use as a reference.

When pool manager wakes up to process an override removal, it looks up
the pre-override value from the config via the new variables mentioned
above.

Just as with entering overrides, no restart is needed. Template and pool
size changes are logged so that anyone watching or reviewing the logs
can see what happened when. The new API endpoints also return values for
both the pre-revert and post-revert value.
2021-11-04 14:03:06 -04:00
5cd7658ab4
(DIO-2621) Make LDAP encryption configurable
Prior to this, the encryption settings for LDAP auth were hard coded to
start_tls on port 389 with TLSv1. These are still the defaults, as
insecure as they are, so as to not break existing users. This change
facilitates replacing the defaults so that simple_tls over port 636 via
TLS1.2 can be used.
2021-09-14 16:35:32 -04:00
Jake Spain
c88f5d8b5a
Fix missing function when moving metrics from pool_manager to api/v1
Fix dependency function component_to_test for jenkins metrics that was not copied from pool_manager to api/v1 in https://github.com/puppetlabs/vmpooler/pull/455
2021-08-25 09:27:45 -04:00
Jake Spain
c06cfc28f7
Add operation label to user metric and move from manager to api
This adds an "operation" label to the user metrics and moves incrementing from the manager to api, so that the user metrics show when resources are allocated, as well as destroyed. Previously, user metrics were only updated upon destroying a resource.

I think its better suited to increment the metric as part of the api instead of the pool_manger, because it's expected to do so when a user successfully checks out or deletes a VM, but can be problematic when doing so in the provider since it can clone VMs before actually being checked out by a user.
2021-08-13 11:23:10 -04:00
7a1fc24685
Fix regex for ondemand instances
It appears we renamed `/ondemand/` to `/ondemandvm/` at some point and,
as a result, have not been stripping hostnames from that endpoint's
metrics. This has caused issues with metrics collection due a very high
cardinality.
2021-02-02 11:11:17 -05:00