Merge "Fix ignore_provider_quota in statemachine drivers"
This commit is contained in:
commit
1a3c3d984d
@ -861,6 +861,7 @@ class ConfigPool(ConfigValue, metaclass=abc.ABCMeta):
|
|||||||
self.max_servers = math.inf
|
self.max_servers = math.inf
|
||||||
self.node_attributes = None
|
self.node_attributes = None
|
||||||
self.priority = None
|
self.priority = None
|
||||||
|
self.ignore_provider_quota = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getCommonSchemaDict(self):
|
def getCommonSchemaDict(self):
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Copyright 2019 Red Hat
|
# Copyright 2019 Red Hat
|
||||||
# Copyright 2021 Acme Gating, LLC
|
# Copyright 2021-2022 Acme Gating, LLC
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -374,13 +374,15 @@ class StateMachineHandler(NodeRequestHandler):
|
|||||||
needed_quota.add(
|
needed_quota.add(
|
||||||
self.manager.quotaNeededByLabel(ntype, self.pool))
|
self.manager.quotaNeededByLabel(ntype, self.pool))
|
||||||
|
|
||||||
|
ignore = False
|
||||||
if hasattr(self.pool, 'ignore_provider_quota'):
|
if hasattr(self.pool, 'ignore_provider_quota'):
|
||||||
if not self.pool.ignore_provider_quota:
|
ignore = self.pool.ignore_provider_quota
|
||||||
cloud_quota = self.manager.estimatedNodepoolQuota()
|
if not ignore:
|
||||||
cloud_quota.subtract(needed_quota)
|
cloud_quota = self.manager.estimatedNodepoolQuota()
|
||||||
|
cloud_quota.subtract(needed_quota)
|
||||||
|
|
||||||
if not cloud_quota.non_negative():
|
if not cloud_quota.non_negative():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Now calculate pool specific quota. Values indicating no quota default
|
# Now calculate pool specific quota. Values indicating no quota default
|
||||||
# to math.inf representing infinity that can be calculated with.
|
# to math.inf representing infinity that can be calculated with.
|
||||||
|
@ -296,14 +296,15 @@ class QuotaSupport:
|
|||||||
|
|
||||||
def estimatedNodepoolQuota(self):
|
def estimatedNodepoolQuota(self):
|
||||||
'''
|
'''
|
||||||
Determine how much quota is available for nodepool managed resources.
|
Determine how much quota is available for nodepool managed
|
||||||
This needs to take into account the quota of the tenant, resources
|
resources. This needs to take into account the quota of the
|
||||||
used outside of nodepool and the currently used resources by nodepool,
|
tenant, resources used outside of nodepool, and the max
|
||||||
max settings in nodepool config. This is cached for MAX_QUOTA_AGE
|
settings in nodepool config. This is cached for MAX_QUOTA_AGE
|
||||||
seconds.
|
seconds.
|
||||||
|
|
||||||
:return: Total amount of resources available which is currently
|
:return: Total amount of resources available which is currently
|
||||||
available to nodepool including currently existing nodes.
|
available to nodepool including currently existing nodes.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if self._current_nodepool_quota:
|
if self._current_nodepool_quota:
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
The AWS, Azure, and IBMVPC drivers now check provider quota before
|
||||||
|
accepting requests. This allows them to decline requests which
|
||||||
|
can not possibly be satisfied given provider quota constraints.
|
Loading…
Reference in New Issue
Block a user