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

Adjust defaults for container0 (build container) as it is too frugal #361

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

wolfeidau
Copy link
Contributor

@wolfeidau wolfeidau commented Aug 2, 2024

As discovered while debugging some build issues, we could probably be a bit more generous with CPU and memory. Locally release builds are taking ~20 seconds, in this container they are taking over ~5 minutes threshold for jobs..

Currently the build container only has 1/10th of a CPU and 50mb of RAM.

Comment on lines 84 to +86
Requests: corev1.ResourceList{
"cpu": resource.MustParse("100m"),
"mem": resource.MustParse("50Mi"),
},
Limits: corev1.ResourceList{
"mem": resource.MustParse("1Gi"),
"cpu": resource.MustParse("1000m"),
"mem": resource.MustParse("4Gi"),
Copy link
Contributor

@zhming0 zhming0 Aug 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During CI, we run our test controller in the same k8s cluster with our production k8s controller (for bk). So setting a limit on RAM might be wise.

Setting namespace resource limit is another option, I don't think I've set it when I create the namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am only modifying the podspec for container 0, sadly this isn't visible in the test diff or YAML diff...

# This will be applied to the job's podSpec as a strategic merge patch
# See https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch
pod-spec-patch:
  serviceAccountName: buildkite-agent-sa
  automountServiceAccountToken: true
  containers:
    - name: container-0
      env:
        - name: GITHUB_TOKEN
          valueFrom:
            secretKeyRef:
              name: github-secrets
              key: github-token
      resources:
        requests:
          cpu: 1000m # one core
          mem: 4Gi

Copy link
Contributor

@zhming0 zhming0 Aug 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I see it's container-0 being changed. I may have confused you in my comment I think (sorry). What I mean is that it might be safer to do this on container-0 spec:

resources: 
  requests: 
    cpu: 1000m # one core 
    mem: 4Gi
  limits: 
    mem: 4Gi # This will prevent one bad test case impacting other tenants on the cluster

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhming0 yeah I am definitely going to dig into how this works 🙏🏻

So very good raising these sorts of questions!

@wolfeidau wolfeidau merged commit 8c8c89b into main Aug 5, 2024
1 check passed
@wolfeidau wolfeidau deleted the fix_for_slow_builds branch August 5, 2024 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants