Merge "Add config option to limit ephemeral storage on K8s Pod labels"
This commit is contained in:
commit
67c4ee1b29
@ -135,6 +135,15 @@ Selecting the kubernetes driver adds the following options to the
|
||||
:attr:`providers.[kubernetes].pools.labels.memory` for all labels of
|
||||
this pool that do not set their own value.
|
||||
|
||||
.. attr:: default-label-storage
|
||||
:type: int
|
||||
|
||||
Only used by the
|
||||
:value:`providers.[kubernetes].pools.labels.type.pod` label type;
|
||||
specifies a default value in MB for
|
||||
:attr:`providers.[kubernetes].pools.labels.storage` for all labels of
|
||||
this pool that do not set their own value.
|
||||
|
||||
.. attr:: labels
|
||||
:type: list
|
||||
|
||||
@ -218,6 +227,13 @@ Selecting the kubernetes driver adds the following options to the
|
||||
:value:`providers.[kubernetes].pools.labels.type.pod` label type;
|
||||
specifies the amount of memory in MiB to request for the pod.
|
||||
|
||||
.. attr:: storage
|
||||
:type: int
|
||||
|
||||
Only used by the
|
||||
:value:`providers.[kubernetes].pools.labels.type.pod` label type;
|
||||
specifies the amount of ephemeral-storage in MB to request for the pod.
|
||||
|
||||
.. attr:: env
|
||||
:type: list
|
||||
:default: []
|
||||
|
@ -41,6 +41,7 @@ class KubernetesPool(ConfigPool):
|
||||
self.max_ram = pool_config.get('max-ram')
|
||||
self.default_label_cpu = pool_config.get('default-label-cpu')
|
||||
self.default_label_memory = pool_config.get('default-label-memory')
|
||||
self.default_label_storage = pool_config.get('default-label-storage')
|
||||
self.labels = {}
|
||||
for label in pool_config.get('labels', []):
|
||||
pl = KubernetesLabel()
|
||||
@ -52,6 +53,7 @@ class KubernetesPool(ConfigPool):
|
||||
pl.shell_type = label.get('shell-type')
|
||||
pl.cpu = label.get('cpu', self.default_label_cpu)
|
||||
pl.memory = label.get('memory', self.default_label_memory)
|
||||
pl.storage = label.get('storage', self.default_label_storage)
|
||||
pl.env = label.get('env', [])
|
||||
pl.node_selector = label.get('node-selector')
|
||||
pl.pool = self
|
||||
@ -97,6 +99,7 @@ class KubernetesProviderConfig(ProviderConfig):
|
||||
'shell-type': str,
|
||||
'cpu': int,
|
||||
'memory': int,
|
||||
'storage': int,
|
||||
'env': [env_var],
|
||||
'node-selector': dict,
|
||||
}
|
||||
@ -109,6 +112,7 @@ class KubernetesProviderConfig(ProviderConfig):
|
||||
v.Optional('max-ram'): int,
|
||||
v.Optional('default-label-cpu'): int,
|
||||
v.Optional('default-label-memory'): int,
|
||||
v.Optional('default-label-storage'): int,
|
||||
})
|
||||
|
||||
provider = {
|
||||
|
@ -276,6 +276,8 @@ class KubernetesProvider(Provider, QuotaSupport):
|
||||
rbody['cpu'] = int(label.cpu)
|
||||
if label.memory:
|
||||
rbody['memory'] = '%dMi' % int(label.memory)
|
||||
if label.storage:
|
||||
rbody['ephemeral-storage'] = '%dM' % int(label.storage)
|
||||
container_body['resources'][rtype] = rbody
|
||||
|
||||
spec_body = {
|
||||
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
A new configuration option for K8s Pod type labels was added to limit the
|
||||
amount of ephemeral storage allocatable in a container (cf. `K8s Local
|
||||
ephemeral storage resource documentation`
|
||||
<https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#local-ephemeral-storage`__)
|
||||
This limit can be set via the integer value of
|
||||
|
||||
:attr:`providers.[kubernetes].pools.labels.storage`
|
||||
|
||||
and is treated as Megabytes. Also, a pool-scoped default value can be
|
||||
specified via
|
||||
|
||||
:attr:`providers.[kubernetes].pools.default-label-storage`
|
Loading…
x
Reference in New Issue
Block a user