From cfb24eeebce8e6c384322b0d197e5d2efa1b2ca4 Mon Sep 17 00:00:00 2001 From: "Johannes M. Scheuermann" Date: Thu, 8 Aug 2019 16:23:40 +0200 Subject: [PATCH 1/2] Update internal traffic shaping docs --- pkg/kubelet/dockershim/network/cni/cni.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/kubelet/dockershim/network/cni/cni.go b/pkg/kubelet/dockershim/network/cni/cni.go index 81351dcaa5b..9a0a6740ffa 100644 --- a/pkg/kubelet/dockershim/network/cni/cni.go +++ b/pkg/kubelet/dockershim/network/cni/cni.go @@ -87,12 +87,12 @@ type cniBandwidthEntry struct { // IngressRate is the bandwidth rate in bits per second for traffic through container. 0 for no limit. If ingressRate is set, ingressBurst must also be set IngressRate int `json:"ingressRate,omitempty"` // IngressBurst is the bandwidth burst in bits for traffic through container. 0 for no limit. If ingressBurst is set, ingressRate must also be set - // NOTE: it's not used for now and default to 0. + // NOTE: it's not used for now and defaults to 0. If IngressRate is set IngressBurst will be math.MaxInt32 ~ 2Gbit IngressBurst int `json:"ingressBurst,omitempty"` // EgressRate is the bandwidth is the bandwidth rate in bits per second for traffic through container. 0 for no limit. If egressRate is set, egressBurst must also be set EgressRate int `json:"egressRate,omitempty"` // EgressBurst is the bandwidth burst in bits for traffic through container. 0 for no limit. If egressBurst is set, egressRate must also be set - // NOTE: it's not used for now and default to 0. + // NOTE: it's not used for now and defaults to 0. If EgressRate is set EgressBurst will be math.MaxInt32 ~ 2Gbit EgressBurst int `json:"egressBurst,omitempty"` } @@ -409,11 +409,11 @@ func (plugin *cniNetworkPlugin) buildCNIRuntimeConf(podName string, podNs string // 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 + bandwidthParam.IngressBurst = math.MaxInt32 // limit to math.MaxInt32 ~ 2Gbit } if egress != nil { bandwidthParam.EgressRate = int(egress.Value()) - bandwidthParam.EgressBurst = math.MaxInt32 // no limit + bandwidthParam.EgressBurst = math.MaxInt32 // limit to math.MaxInt32 ~ 2Gbit } rt.CapabilityArgs["bandwidth"] = bandwidthParam } From a9cf6cec729ea97b3713c05935401adc43247a2a Mon Sep 17 00:00:00 2001 From: "Johannes M. Scheuermann" Date: Thu, 8 Aug 2019 22:11:40 +0200 Subject: [PATCH 2/2] Correct typos in docs and add better explanation for burstrate --- pkg/kubelet/dockershim/network/cni/cni.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/kubelet/dockershim/network/cni/cni.go b/pkg/kubelet/dockershim/network/cni/cni.go index 9a0a6740ffa..96f7711238e 100644 --- a/pkg/kubelet/dockershim/network/cni/cni.go +++ b/pkg/kubelet/dockershim/network/cni/cni.go @@ -84,14 +84,14 @@ type cniPortMapping struct { // see: https://github.com/containernetworking/cni/blob/master/CONVENTIONS.md and // https://github.com/containernetworking/plugins/blob/master/plugins/meta/bandwidth/README.md type cniBandwidthEntry struct { - // IngressRate is the bandwidth rate in bits per second for traffic through container. 0 for no limit. If ingressRate is set, ingressBurst must also be set + // IngressRate is the bandwidth rate in bits per second for traffic through container. 0 for no limit. If IngressRate is set, IngressBurst must also be set IngressRate int `json:"ingressRate,omitempty"` - // IngressBurst is the bandwidth burst in bits for traffic through container. 0 for no limit. If ingressBurst is set, ingressRate must also be set + // IngressBurst is the bandwidth burst in bits for traffic through container. 0 for no limit. If IngressBurst is set, IngressRate must also be set // NOTE: it's not used for now and defaults to 0. If IngressRate is set IngressBurst will be math.MaxInt32 ~ 2Gbit IngressBurst int `json:"ingressBurst,omitempty"` - // EgressRate is the bandwidth is the bandwidth rate in bits per second for traffic through container. 0 for no limit. If egressRate is set, egressBurst must also be set + // EgressRate is the bandwidth is the bandwidth rate in bits per second for traffic through container. 0 for no limit. If EgressRate is set, EgressBurst must also be set EgressRate int `json:"egressRate,omitempty"` - // EgressBurst is the bandwidth burst in bits for traffic through container. 0 for no limit. If egressBurst is set, egressRate must also be set + // EgressBurst is the bandwidth burst in bits for traffic through container. 0 for no limit. If EgressBurst is set, EgressRate must also be set // NOTE: it's not used for now and defaults to 0. If EgressRate is set EgressBurst will be math.MaxInt32 ~ 2Gbit EgressBurst int `json:"egressBurst,omitempty"` } @@ -409,11 +409,13 @@ func (plugin *cniNetworkPlugin) buildCNIRuntimeConf(podName string, podNs string // 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 // limit to math.MaxInt32 ~ 2Gbit + // Limit IngressBurst to math.MaxInt32, in practice limiting to 2Gbit is the equivalent of setting no limit + bandwidthParam.IngressBurst = math.MaxInt32 } if egress != nil { bandwidthParam.EgressRate = int(egress.Value()) - bandwidthParam.EgressBurst = math.MaxInt32 // limit to math.MaxInt32 ~ 2Gbit + // Limit EgressBurst to math.MaxInt32, in practice limiting to 2Gbit is the equivalent of setting no limit + bandwidthParam.EgressBurst = math.MaxInt32 } rt.CapabilityArgs["bandwidth"] = bandwidthParam }