Skip to content

Commit d34c181

Browse files
authored
Merge pull request kubernetes#128444 from tosi3k/ds-syncs
Add --concurrent-daemonset-syncs argument to kube-controller-manager
2 parents 151ca56 + 4afa554 commit d34c181

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

cmd/kube-controller-manager/app/options/daemonsetcontroller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ limitations under the License.
1717
package options
1818

1919
import (
20+
"fmt"
21+
2022
"github.com/spf13/pflag"
2123

2224
daemonconfig "k8s.io/kubernetes/pkg/controller/daemon/config"
@@ -32,6 +34,8 @@ func (o *DaemonSetControllerOptions) AddFlags(fs *pflag.FlagSet) {
3234
if o == nil {
3335
return
3436
}
37+
38+
fs.Int32Var(&o.ConcurrentDaemonSetSyncs, "concurrent-daemonset-syncs", o.ConcurrentDaemonSetSyncs, "The number of daemonset objects that are allowed to sync concurrently. Larger number = more responsive daemonsets, but more CPU (and network) load")
3539
}
3640

3741
// ApplyTo fills up DaemonSetController config with options.
@@ -52,5 +56,8 @@ func (o *DaemonSetControllerOptions) Validate() []error {
5256
}
5357

5458
errs := []error{}
59+
if o.ConcurrentDaemonSetSyncs < 1 {
60+
errs = append(errs, fmt.Errorf("concurrent-daemonset-syncs must be greater than 0, but got %d", o.ConcurrentDaemonSetSyncs))
61+
}
5562
return errs
5663
}

cmd/kube-controller-manager/app/options/options_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ var args = []string{
9898
"--cluster-signing-legacy-unknown-cert-file=/cluster-signing-legacy-unknown/cert-file",
9999
"--cluster-signing-legacy-unknown-key-file=/cluster-signing-legacy-unknown/key-file",
100100
"--concurrent-deployment-syncs=10",
101+
"--concurrent-daemonset-syncs=10",
101102
"--concurrent-horizontal-pod-autoscaler-syncs=10",
102103
"--concurrent-statefulset-syncs=15",
103104
"--concurrent-endpoint-syncs=10",
@@ -264,7 +265,7 @@ func TestAddFlags(t *testing.T) {
264265
},
265266
DaemonSetController: &DaemonSetControllerOptions{
266267
&daemonconfig.DaemonSetControllerConfiguration{
267-
ConcurrentDaemonSetSyncs: 2,
268+
ConcurrentDaemonSetSyncs: 10,
268269
},
269270
},
270271
DeploymentController: &DeploymentControllerOptions{
@@ -514,6 +515,13 @@ func TestValidateFlags(t *testing.T) {
514515
},
515516
wantErr: true,
516517
},
518+
{
519+
name: "concurrent daemonset syncs set to 0",
520+
flags: []string{
521+
"--concurrent-daemonset-syncs=0",
522+
},
523+
wantErr: true,
524+
},
517525
}
518526

519527
for _, tc := range testcases {
@@ -609,7 +617,7 @@ func TestApplyTo(t *testing.T) {
609617
},
610618
},
611619
DaemonSetController: daemonconfig.DaemonSetControllerConfiguration{
612-
ConcurrentDaemonSetSyncs: 2,
620+
ConcurrentDaemonSetSyncs: 10,
613621
},
614622
DeploymentController: deploymentconfig.DeploymentControllerConfiguration{
615623
ConcurrentDeploymentSyncs: 10,

0 commit comments

Comments
 (0)