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
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
7 changes: 2 additions & 5 deletions cmd/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,8 @@ func TestReadAndParseConfig(t *testing.T) {
},
Resources: corev1.ResourceRequirements{
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"),
Comment on lines 84 to +86
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!

},
},
},
Expand Down
6 changes: 2 additions & 4 deletions examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,5 @@ pod-spec-patch:
key: github-token
resources:
requests:
cpu: 100m
mem: 50Mi
limits:
mem: 1Gi
cpu: 1000m # one core
mem: 4Gi