mirror of https://github.com/k3s-io/k3s
Merge pull request #75442 from mars1024/bugfix/bandwidth_unit
change bandwidth units from Kb to bk3s-v1.15.3
commit
f4937619a2
|
@ -398,11 +398,14 @@ func (plugin *cniNetworkPlugin) buildCNIRuntimeConf(podName string, podNs string
|
|||
if ingress != nil || egress != nil {
|
||||
bandwidthParam := cniBandwidthEntry{}
|
||||
if ingress != nil {
|
||||
bandwidthParam.IngressRate = int(ingress.Value() / 1000)
|
||||
// see: https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md and
|
||||
// https://github.com/containernetworking/plugins/blob/master/plugins/meta/bandwidth/README.md
|
||||
// Rates are in bits per second, burst values are in bits.
|
||||
bandwidthParam.IngressRate = int(ingress.Value())
|
||||
bandwidthParam.IngressBurst = math.MaxInt32 // no limit
|
||||
}
|
||||
if egress != nil {
|
||||
bandwidthParam.EgressRate = int(egress.Value() / 1000)
|
||||
bandwidthParam.EgressRate = int(egress.Value())
|
||||
bandwidthParam.EgressBurst = math.MaxInt32 // no limit
|
||||
}
|
||||
rt.CapabilityArgs["bandwidth"] = bandwidthParam
|
||||
|
|
|
@ -291,7 +291,7 @@ func TestCNIPlugin(t *testing.T) {
|
|||
t.Errorf("mismatch in expected port mappings. expected %v got %v", expectedMappings, inputConfig.RuntimeConfig.PortMappings)
|
||||
}
|
||||
expectedBandwidth := map[string]interface{}{
|
||||
"ingressRate": 1000.0, "egressRate": 1000.0,
|
||||
"ingressRate": 1000000.0, "egressRate": 1000000.0,
|
||||
"ingressBurst": 2147483647.0, "egressBurst": 2147483647.0,
|
||||
}
|
||||
if !reflect.DeepEqual(inputConfig.RuntimeConfig.Bandwidth, expectedBandwidth) {
|
||||
|
|
Loading…
Reference in New Issue