Skip to content

fix: apply clientConnection QPS/burst to the manager client#3432

Open
abhijeet-dhumal wants to merge 4 commits intokubeflow:masterfrom
abhijeet-dhumal:fix/wire-client-connection-qps-burst
Open

fix: apply clientConnection QPS/burst to the manager client#3432
abhijeet-dhumal wants to merge 4 commits intokubeflow:masterfrom
abhijeet-dhumal:fix/wire-client-connection-qps-burst

Conversation

@abhijeet-dhumal
Copy link
Copy Markdown
Member

What this PR does / why we need it:
The clientConnection QPS/burst configuration is validated and defaulted but never applied to the manager's Kubernetes client.

Fixes #3431

  • Extracts ApplyClientConnection() in pkg/config and calls it from main.go to wire QPS/burst onto rest.Config
  • Adds the missing clientConnection block to the Helm chart ConfigMap template and values.yaml
  • Adds unit and end-to-end config loading tests

Checklist:

  • [Docs] No doc changes needed - existing config field, just fixing the wiring.

Signed-off-by: abhijeet-dhumal <abhijeetdhumal652@gmail.com>
Copilot AI review requested due to automatic review settings April 16, 2026 07:25
@google-oss-prow
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tenzen-y for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a wiring gap where clientConnection QPS/burst settings (already defaulted/validated in the Configuration API) were not being applied to the controller manager’s Kubernetes rest.Config, and adds Helm chart parity plus tests to prevent regression.

Changes:

  • Adds ApplyClientConnection() in pkg/config and applies it before creating the controller-runtime manager.
  • Extends the Helm chart to emit clientConnection into the generated manager config.
  • Adds unit tests to cover applying clientConnection to a rest.Config, including default and custom config loading.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/config/config.go Introduces ApplyClientConnection() to apply QPS/burst onto a rest.Config.
pkg/config/config_test.go Adds tests for ApplyClientConnection() and for load+apply behavior.
cmd/trainer-controller-manager/main.go Wires clientConnection into the manager’s REST config before ctrl.NewManager().
charts/kubeflow-trainer/values.yaml Adds manager.config.clientConnection values (qps/burst) with defaults.
charts/kubeflow-trainer/templates/manager/configmap.yaml Renders clientConnection into the manager configmap template.

Comment on lines +68 to +69
qps: {{ .Values.manager.config.clientConnection.qps | default 50 }}
burst: {{ .Values.manager.config.clientConnection.burst | default 100 }}
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

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

Using Helm's default here will treat explicit 0 as empty, so users cannot set clientConnection.qps/burst to 0 even though the API allows it; render the values directly (relying on values.yaml defaults) or gate on key existence (hasKey) instead of default so explicit 0 is preserved.

Suggested change
qps: {{ .Values.manager.config.clientConnection.qps | default 50 }}
burst: {{ .Values.manager.config.clientConnection.burst | default 100 }}
qps: {{ dig "manager" "config" "clientConnection" "qps" 50 .Values }}
burst: {{ dig "manager" "config" "clientConnection" "burst" 100 .Values }}

Copilot uses AI. Check for mistakes.
@abhijeet-dhumal abhijeet-dhumal changed the title fix(config): Apply clientConnection QPS/burst to the manager client fix(config): apply clientConnection QPS/burst to the manager client Apr 16, 2026
@abhijeet-dhumal abhijeet-dhumal changed the title fix(config): apply clientConnection QPS/burst to the manager client fix: apply clientConnection QPS/burst to the manager client Apr 16, 2026
Signed-off-by: abhijeet-dhumal <abhijeetdhumal652@gmail.com>
Copy link
Copy Markdown
Contributor

@robert-bell robert-bell left a comment

Choose a reason for hiding this comment

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

Thanks @abhijeet-dhumal this was a good spot.

Comment thread pkg/config/config.go

// ApplyClientConnection sets QPS and burst on the given rest.Config
// from the Configuration's clientConnection settings.
func ApplyClientConnection(restCfg *rest.Config, cfg *configapi.Configuration) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what's the rationale for having a separate function for this rather than doing this as part of Load?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah - re-reading this I see the rest config is created in main.go directly. A separate function makes sense.

Comment thread pkg/config/config_test.go Outdated
}

func TestApplyClientConnection(t *testing.T) {
testcases := []struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the convention is to use map-based test cases rather than list - could you udpate pls?

Define test cases as maps instead of slices to avoid dependencies on the running order. Map key should be equal to the test case name.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks @robert-bell , great catch 🙌

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done ✅ - Converted both TestApplyClientConnection and TestLoadAndApplyClientConnection to use map-based test cases.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread charts/kubeflow-trainer/templates/manager/configmap.yaml Outdated
Comment thread pkg/config/config_test.go
}
}

func TestLoadAndApplyClientConnection(t *testing.T) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this effectively re-testing logic we already cover in TestApplyClientConnection and TestLoad?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for the review @robert-bell ! Addressed all your feedback ✅

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Please review !

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @abhijeet-dhumal. I was more wondering whether this test is needed?

…convention

Signed-off-by: abhijeet-dhumal <abhijeetdhumal652@gmail.com>
Signed-off-by: abhijeet-dhumal <abhijeetdhumal652@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clientConnection QPS/burst configuration is not applied to the manager client

3 participants