@@ -51,6 +51,8 @@ def __init__(
5151 image_name ,
5252 git_credentials = None ,
5353 push_secret = None ,
54+ cpu_limit = 0 ,
55+ cpu_request = 0 ,
5456 memory_limit = 0 ,
5557 memory_request = 0 ,
5658 node_selector = None ,
@@ -95,6 +97,18 @@ def __init__(
9597 https://git-scm.com/docs/gitcredentials for more information.
9698 push_secret : str
9799 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
98112 memory_limit
99113 Memory limit for the docker build process. Can be an integer in
100114 bytes, or a byte specification (like 6M).
@@ -129,6 +143,8 @@ def __init__(
129143 self .push_secret = push_secret
130144 self .build_image = build_image
131145 self .main_loop = IOLoop .current ()
146+ self .cpu_limit = cpu_limit
147+ self .cpu_request = cpu_request
132148 self .memory_limit = memory_limit
133149 self .memory_request = memory_request
134150 self .docker_host = docker_host
@@ -343,8 +359,8 @@ def submit(self):
343359 args = self .get_cmd (),
344360 volume_mounts = volume_mounts ,
345361 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 },
348364 ),
349365 env = env
350366 )
0 commit comments