Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add resource requests and limits to ci-operator pods #1690

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| go-fmt),?(\s+|$))
- agent: kubernetes
Expand All @@ -57,7 +61,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| golint),?(\s+|$))
- agent: kubernetes
Expand All @@ -83,7 +91,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| go-vet),?(\s+|$))
- agent: kubernetes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| go-fmt),?(\s+|$))
- agent: kubernetes
Expand All @@ -49,7 +53,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| golint),?(\s+|$))
- agent: kubernetes
Expand All @@ -75,7 +83,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| go-vet),?(\s+|$))
- agent: kubernetes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| go-fmt),?(\s+|$))
- agent: kubernetes
Expand All @@ -251,7 +255,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| golint),?(\s+|$))
- agent: kubernetes
Expand All @@ -277,7 +285,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| go-vet),?(\s+|$))
- agent: kubernetes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| go-fmt),?(\s+|$))
- agent: kubernetes
Expand All @@ -57,7 +61,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| golint),?(\s+|$))
- agent: kubernetes
Expand All @@ -83,7 +91,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
serviceAccountName: ci-operator
trigger: ((?m)^/test(all| go-vet),?(\s+|$))
- agent: kubernetes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ presubmits:
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources: {}
resources:
limits:
cpu: 500m
requests:
cpu: 10m
volumeMounts:
- mountPath: /usr/local/e2e-aws
name: job-definition
Expand Down
24 changes: 23 additions & 1 deletion hack/validate-prow-job-semantics.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def main():
if not failed:
with open(path) as f:
data = yaml.load(f)
for check in [validate_job_repo, validate_names, validate_sharding, validate_access, validate_pod_name]:
for check in [validate_job_repo, validate_names, validate_sharding, validate_access, validate_pod_name, validate_resources]:
check(path, data)

if failed:
Expand Down Expand Up @@ -211,4 +211,26 @@ def validate_image_pull(path, data):

return out

def validate_resources(path, data):
out = True
for job_type in data:
if job_type == "periodics":
continue

for repo in data[job_type]:
for job in data[job_type][repo]:
if job["agent"] != "kubernetes":
continue

if job["spec"]["containers"][0]["command"][0] != "ci-operator":
continue

resources = {"limits":{"cpu":"500m"},"requests":{"cpu":"10m"}}
if "resources" not in job["spec"]["containers"][0] or job["spec"]["containers"][0]["resources"] != resources:
print("[ERROR] {}: ci-operator job {} should set the pod's CPU resources to {}".format(path, job["name"], resources))
out = False
continue

return out

main()