Skip to content

Commit

Permalink
Allow more events to be buffered before the backend starts
Browse files Browse the repository at this point in the history
Signed-off-by: forrestchen <[email protected]>
  • Loading branch information
ChenLingPeng committed Mar 22, 2021
1 parent 921c569 commit 8a494ab
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Documentation/kube-flannel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: K8S_SCALE
value: "5000"
volumeMounts:
- name: run
mountPath: /run/flannel
Expand Down
14 changes: 13 additions & 1 deletion subnet/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"io/ioutil"
"net"
"os"
"strconv"
"time"

"github.com/coreos/flannel/pkg/ip"
Expand Down Expand Up @@ -138,7 +139,18 @@ func newKubeSubnetManager(c clientset.Interface, sc *subnet.Config, nodeName, pr
ksm.client = c
ksm.nodeName = nodeName
ksm.subnetConf = sc
ksm.events = make(chan subnet.Event, 5000)
scale := 5000
scaleStr := os.Getenv("K8S_SCALE")
if scaleStr != "" {
n, err := strconv.Atoi(scaleStr)
if err != nil {
return nil, fmt.Errorf("env K8S_SCALE=%s format error: %v", scaleStr, err)
}
if n > 0 {
scale = n
}
}
ksm.events = make(chan subnet.Event, scale)
indexer, controller := cache.NewIndexerInformer(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
Expand Down

0 comments on commit 8a494ab

Please sign in to comment.