mirror of https://github.com/k3s-io/k3s
parent
1fe288ec02
commit
b573cce595
|
@ -19,6 +19,7 @@ package cni
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -377,11 +378,11 @@ func (plugin *cniNetworkPlugin) buildCNIRuntimeConf(podName string, podNs string
|
|||
bandwidthParam := cniBandwidthEntry{}
|
||||
if ingress != nil {
|
||||
bandwidthParam.IngressRate = int(ingress.Value() / 1000)
|
||||
bandwidthParam.IngressBurst = 0 // default to no limit
|
||||
bandwidthParam.IngressBurst = math.MaxInt32 // no limit
|
||||
}
|
||||
if egress != nil {
|
||||
bandwidthParam.EgressRate = int(egress.Value() / 1000)
|
||||
bandwidthParam.EgressBurst = 0 // default to no limit
|
||||
bandwidthParam.EgressBurst = math.MaxInt32 // no limit
|
||||
}
|
||||
rt.CapabilityArgs["bandwidth"] = bandwidthParam
|
||||
}
|
||||
|
|
|
@ -291,6 +291,7 @@ func TestCNIPlugin(t *testing.T) {
|
|||
}
|
||||
expectedBandwidth := map[string]interface{}{
|
||||
"ingressRate": 1000.0, "egressRate": 1000.0,
|
||||
"ingressBurst": 2147483647.0, "egressBurst": 2147483647.0,
|
||||
}
|
||||
if !reflect.DeepEqual(inputConfig.RuntimeConfig.Bandwidth, expectedBandwidth) {
|
||||
t.Errorf("mismatch in expected bandwidth. expected %v got %v", expectedBandwidth, inputConfig.RuntimeConfig.Bandwidth)
|
||||
|
|
Loading…
Reference in New Issue