Merge pull request #128444 from tosi3k/ds-syncs

Add --concurrent-daemonset-syncs argument to kube-controller-manager
This commit is contained in:
Kubernetes Prow Robot 2024-10-31 19:21:34 +00:00 committed by GitHub
commit d34c181465
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 2 deletions

View File

@ -17,6 +17,8 @@ limitations under the License.
package options
import (
"fmt"
"github.com/spf13/pflag"
daemonconfig "k8s.io/kubernetes/pkg/controller/daemon/config"
@ -32,6 +34,8 @@ func (o *DaemonSetControllerOptions) AddFlags(fs *pflag.FlagSet) {
if o == nil {
return
}
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")
}
// ApplyTo fills up DaemonSetController config with options.
@ -52,5 +56,8 @@ func (o *DaemonSetControllerOptions) Validate() []error {
}
errs := []error{}
if o.ConcurrentDaemonSetSyncs < 1 {
errs = append(errs, fmt.Errorf("concurrent-daemonset-syncs must be greater than 0, but got %d", o.ConcurrentDaemonSetSyncs))
}
return errs
}

View File

@ -98,6 +98,7 @@ var args = []string{
"--cluster-signing-legacy-unknown-cert-file=/cluster-signing-legacy-unknown/cert-file",
"--cluster-signing-legacy-unknown-key-file=/cluster-signing-legacy-unknown/key-file",
"--concurrent-deployment-syncs=10",
"--concurrent-daemonset-syncs=10",
"--concurrent-horizontal-pod-autoscaler-syncs=10",
"--concurrent-statefulset-syncs=15",
"--concurrent-endpoint-syncs=10",
@ -264,7 +265,7 @@ func TestAddFlags(t *testing.T) {
},
DaemonSetController: &DaemonSetControllerOptions{
&daemonconfig.DaemonSetControllerConfiguration{
ConcurrentDaemonSetSyncs: 2,
ConcurrentDaemonSetSyncs: 10,
},
},
DeploymentController: &DeploymentControllerOptions{
@ -514,6 +515,13 @@ func TestValidateFlags(t *testing.T) {
},
wantErr: true,
},
{
name: "concurrent daemonset syncs set to 0",
flags: []string{
"--concurrent-daemonset-syncs=0",
},
wantErr: true,
},
}
for _, tc := range testcases {
@ -609,7 +617,7 @@ func TestApplyTo(t *testing.T) {
},
},
DaemonSetController: daemonconfig.DaemonSetControllerConfiguration{
ConcurrentDaemonSetSyncs: 2,
ConcurrentDaemonSetSyncs: 10,
},
DeploymentController: deploymentconfig.DeploymentControllerConfiguration{
ConcurrentDeploymentSyncs: 10,