Skip to content

Commit eac2951

Browse files
enoodlegithub-actions[bot]
authored andcommitted
fix: propagate Kubernetes client arguments
Signed-off-by: Erez Freiberger <enoodle@gmail.com> (cherry picked from commit 386b7e9)
1 parent 7e67737 commit eac2951

8 files changed

Lines changed: 20 additions & 4 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Fixed
2+
body: |-
3+
Propagate Kubernetes client QPS and burst settings to operator-managed controllers

pkg/operator/operands/admission/resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ func buildArgsList(kaiConfig *kaiv1.Config, config *kaiv1admission.Admission) []
397397
args = append(args, "--gpu-pod-runtime-class-name", *config.GPUPodRuntimeClassName)
398398
}
399399

400-
common.AddK8sClientConfigToArgs(config.Service.K8sClientConfig, args)
400+
args = common.AddK8sClientConfigToArgs(config.Service.K8sClientConfig, args)
401401
return common.AddControllerRuntimeJSONLogArg(kaiConfig.Spec.Global.JSONLog, args)
402402
}
403403

pkg/operator/operands/admission/resources_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ func TestDeploymentForKAIConfig(t *testing.T) {
5555
"--webhook-addr", "9443",
5656
"--health-probe-bind-address", ":8081",
5757
"--metrics-bind-address", ":8080",
58+
"--qps", "20",
59+
"--burst", "100",
5860
},
5961
notExpectedArgs: []string{
6062
"--gpu-sharing-enabled=true",

pkg/operator/operands/common/common.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func isControllerAvailable(obj client.Object, objKind string) (bool, error) {
323323
return false, nil
324324
}
325325

326-
func AddK8sClientConfigToArgs(k8sClientConfig *kaiv1common.K8sClientConfig, args []string) {
326+
func AddK8sClientConfigToArgs(k8sClientConfig *kaiv1common.K8sClientConfig, args []string) []string {
327327
if k8sClientConfig != nil {
328328
if k8sClientConfig.QPS != nil {
329329
args = append(args, "--qps", strconv.Itoa(*k8sClientConfig.QPS))
@@ -332,6 +332,8 @@ func AddK8sClientConfigToArgs(k8sClientConfig *kaiv1common.K8sClientConfig, args
332332
args = append(args, "--burst", strconv.Itoa(*k8sClientConfig.Burst))
333333
}
334334
}
335+
336+
return args
335337
}
336338

337339
func AddControllerRuntimeJSONLogArg(jsonLog *bool, args []string) []string {

pkg/operator/operands/pod_group_controller/pod_group_controller_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ var _ = Describe("PodGrouper", func() {
5353
deployment := *deploymentT
5454
Expect(deployment).NotTo(BeNil())
5555
Expect(deployment.Name).To(Equal(defaultResourceName))
56+
Expect(deployment.Spec.Template.Spec.Containers[0].Args).To(ContainElements(
57+
"--qps", "20", "--burst", "100",
58+
))
5659
})
5760

5861
It("the deployment should keep labels from existing deployment", func(ctx context.Context) {

pkg/operator/operands/pod_group_controller/resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func buildArgsList(config *pod_group_controller.PodGroupController, schedulerNam
228228
"--scheduler-name", schedulerName,
229229
}
230230

231-
common.AddK8sClientConfigToArgs(config.Service.K8sClientConfig, args)
231+
args = common.AddK8sClientConfigToArgs(config.Service.K8sClientConfig, args)
232232

233233
if config.MaxConcurrentReconciles != nil {
234234
args = append(args, "--max-concurrent-reconciles", strconv.Itoa(*config.MaxConcurrentReconciles))

pkg/operator/operands/queue_controller/queue_controller_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ var _ = Describe("QueueController", func() {
5151

5252
Context("Deployment", func() {
5353
It("should return a Deployment in the objects list", func(ctx context.Context) {
54+
kaiConfig.Spec.QueueController.Service.K8sClientConfig.QPS = ptr.To(42)
55+
kaiConfig.Spec.QueueController.Service.K8sClientConfig.Burst = ptr.To(84)
56+
5457
objects, err := qc.DesiredState(ctx, fakeKubeClient, kaiConfig)
5558
Expect(err).To(BeNil())
5659
Expect(len(objects)).To(BeNumerically(">", 1))
@@ -60,6 +63,9 @@ var _ = Describe("QueueController", func() {
6063
deployment := *deploymentT
6164
Expect(deployment).NotTo(BeNil())
6265
Expect(deployment.Name).To(Equal(defaultResourceName))
66+
Expect(deployment.Spec.Template.Spec.Containers[0].Args).To(ContainElements(
67+
"--qps", "42", "--burst", "84",
68+
))
6369
})
6470

6571
It("the deployment should keep labels from existing deployment", func(ctx context.Context) {

pkg/operator/operands/queue_controller/resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,6 @@ func buildArgsList(kaiConfig *kaiv1.Config) []string {
274274
args = append(args, "--queue-label-to-default-metric-value", *config.QueueLabelToDefaultMetricValue)
275275
}
276276

277-
common.AddK8sClientConfigToArgs(config.Service.K8sClientConfig, args)
277+
args = common.AddK8sClientConfigToArgs(config.Service.K8sClientConfig, args)
278278
return common.AddControllerRuntimeJSONLogArg(kaiConfig.Spec.Global.JSONLog, args)
279279
}

0 commit comments

Comments
 (0)