@@ -51,6 +51,8 @@ def __init__(
51
51
image_name ,
52
52
git_credentials = None ,
53
53
push_secret = None ,
54
+ cpu_limit = 0 ,
55
+ cpu_request = 0 ,
54
56
memory_limit = 0 ,
55
57
memory_request = 0 ,
56
58
node_selector = None ,
@@ -95,6 +97,18 @@ def __init__(
95
97
https://git-scm.com/docs/gitcredentials for more information.
96
98
push_secret : str
97
99
Kubernetes secret containing credentials to push docker image to registry.
100
+ cpu_limit
101
+ CPU limit for the docker build process. Can be an integer (1), fraction (0.5) or
102
+ millicore specification (100m). Value should adhere to K8s specification
103
+ for CPU meaning. See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu
104
+ for more information
105
+ cpu_request
106
+ CPU request of the build pod. The actual building happens in the
107
+ docker daemon, but setting request in the build pod makes sure that
108
+ cpu is reserved for the docker build in the node by the kubernetes
109
+ scheduler. Value should adhere to K8s specification for CPU meaning.
110
+ See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu
111
+ for more information
98
112
memory_limit
99
113
Memory limit for the docker build process. Can be an integer in
100
114
bytes, or a byte specification (like 6M).
@@ -129,6 +143,8 @@ def __init__(
129
143
self .push_secret = push_secret
130
144
self .build_image = build_image
131
145
self .main_loop = IOLoop .current ()
146
+ self .cpu_limit = cpu_limit
147
+ self .cpu_request = cpu_request
132
148
self .memory_limit = memory_limit
133
149
self .memory_request = memory_request
134
150
self .docker_host = docker_host
@@ -343,8 +359,8 @@ def submit(self):
343
359
args = self .get_cmd (),
344
360
volume_mounts = volume_mounts ,
345
361
resources = client .V1ResourceRequirements (
346
- limits = {'memory' : self .memory_limit },
347
- requests = {'memory' : self .memory_request },
362
+ limits = {'memory' : self .memory_limit , 'cpu' : self . cpu_limit },
363
+ requests = {'memory' : self .memory_request , 'cpu' : self . cpu_request },
348
364
),
349
365
env = env
350
366
)
0 commit comments