From c706d0447a303c52089eff3b58a17c1011f9820f Mon Sep 17 00:00:00 2001 From: Lars Ekman Date: Sat, 3 Jul 2021 14:57:28 +0200 Subject: [PATCH 1/3] Add KEP 2819: CNI traffic shaping support --- .../README.md | 133 ++++++++++++++++++ .../2819-CNI-traffic-shaping-support/kep.yaml | 35 +++++ 2 files changed, 168 insertions(+) create mode 100644 keps/sig-network/2819-CNI-traffic-shaping-support/README.md create mode 100644 keps/sig-network/2819-CNI-traffic-shaping-support/kep.yaml diff --git a/keps/sig-network/2819-CNI-traffic-shaping-support/README.md b/keps/sig-network/2819-CNI-traffic-shaping-support/README.md new file mode 100644 index 00000000000..20e757df2c2 --- /dev/null +++ b/keps/sig-network/2819-CNI-traffic-shaping-support/README.md @@ -0,0 +1,133 @@ +# KEP-0012: Support traffic shaping for Kubelet CNI network plugin + + +- [Release Signoff Checklist](#release-signoff-checklist) +- [Summary](#summary) +- [Motivation](#motivation) + - [Goals](#goals) + - [Non-goals](#non-goals) +- [Proposal](#proposal) + - [Pod Setup](#pod-setup) + - [Pod Teardown](#pod-teardown) +- [Graduation Criteria](#graduation-criteria) +- [Implementation History](#implementation-history) + - [CNI plugin part](#cni-plugin-part) + - [Kubernetes part](#kubernetes-part) +- [Drawbacks](#drawbacks) +- [Alternatives](#alternatives) + + +## Release Signoff Checklist + +Items marked with (R) are required *prior to targeting to a milestone / release*. + +- [ ] (R) Enhancement issue in release milestone, which links to KEP dir in [kubernetes/enhancements] (not the initial KEP PR) +- [ ] (R) KEP approvers have approved the KEP status as `implementable` +- [ ] (R) Design details are appropriately documented +- [ ] (R) Test plan is in place, giving consideration to SIG Architecture and SIG Testing input +- [ ] (R) Graduation criteria is in place +- [ ] (R) Production readiness review completed +- [ ] Production readiness review approved +- [ ] "Implementation History" section is up-to-date for milestone +- [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io] +- [ ] Supporting documentation e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes + + + +## Summary + +Make kubelet cni network plugin support basic traffic shapping capability `bandwidth`. + +## Motivation + +Currently the kubenet code supports applying basic traffic shaping during pod setup. +This will happen if bandwidth-related annotations have been added to the pod's metadata. + +Kubelet CNI code doesn't support it yet, though CNI has already added a [traffic sharping plugin](https://github.com/containernetworking/plugins/tree/master/plugins/meta/bandwidth). +We can replicate the behavior we have today in kubenet for kubelet CNI network plugin if we feel this is an important feature. + +### Goals + +* Support traffic shaping for CNI network plugin in Kubernetes. + +### Non-goals + +* CNI plugins to implement this sort of traffic shaping guarantee. + + +## Proposal + +If kubelet starts up with `network-plugin = cni` and user enabled traffic shaping via the network plugin configuration, +it would then populate the runtimeConfig section of the config when calling the bandwidth plugin. + +Traffic shaping in Kubelet CNI network plugin can work with ptp and bridge network plugins. + +### Pod Setup + +When we create a pod with bandwidth configuration in its metadata, for example, + +```json +{ + "kind": "Pod", + "metadata": { + "name": "iperf-slow", + "annotations": { + "kubernetes.io/ingress-bandwidth": "10M", + "kubernetes.io/egress-bandwidth": "10M" + } + } +} +``` + +Kubelet would firstly parse the ingress and egress bandwidth values and transform them to ingressRate and egressRate for cni bandwidth plugin. +Kubelet would then detect whether user has enabled the traffic shaping plugin by checking the following CNI config file: + +```json +{ + "type": "bandwidth", + "capabilities": {"trafficShaping": true} +} +``` + +If traffic shaping plugin is enabled, kubelet would populate the runtimeConfig section of the config when call the bandwidth plugin: + +```json +{ + "type": "bandwidth", + "runtimeConfig": { + "trafficShaping": { + "ingressRate": "X", + "egressRate": "Y" + } + } +} +``` + +### Pod Teardown + +When we delete a pod, kubelet will bulid the runtime config call cni plugin DelNetworkList API, which will remove this pod's bandwidth configuration. + +## Graduation Criteria + +* Add traffic shaping as part of the Kubernetes e2e runs and ensure tests are not failing. + +## Implementation History + +### CNI plugin part + +* [traffic shaping plugin](https://github.com/containernetworking/plugins/pull/96) +* [support runtime config](https://github.com/containernetworking/plugins/pull/138) + +### Kubernetes part + +* [add traffic shaping support](https://github.com/kubernetes/kubernetes/pull/63194) + +## Drawbacks + +None + +## Alternatives + +None \ No newline at end of file diff --git a/keps/sig-network/2819-CNI-traffic-shaping-support/kep.yaml b/keps/sig-network/2819-CNI-traffic-shaping-support/kep.yaml new file mode 100644 index 00000000000..4c3ee4fc4a1 --- /dev/null +++ b/keps/sig-network/2819-CNI-traffic-shaping-support/kep.yaml @@ -0,0 +1,35 @@ +title: Support traffic shaping for CNI network plugin +kep-number: 2819 +authors: + - "@Lion-Wei" + - "@m1093782566" +owning-sig: sig-network +participating-sigs: +status: implemented +creation-date: 2018-05-31 +reviewers: + - "@thockin" + - "@m1093782566" +approvers: + - "@thockin" + - "@m1093782566" + +see-also: +replaces: + +stage: alpha + +# The most recent milestone for which work toward delivery of this KEP has been +# done. This can be the current (upcoming) milestone, if it is being actively +# worked on. +latest-milestone: "v1.9" + +# The milestone at which this feature was, or is targeted to be, at each stage. +milestone: + alpha: "v1.9" + beta: "v1.23" + stable: "v1.24" + +feature-gates: +disable-supported: false + From ac14230486ea025e7ceaa5608f66e49445c83ff0 Mon Sep 17 00:00:00 2001 From: Lars Ekman Date: Sat, 10 Jul 2021 09:38:01 +0200 Subject: [PATCH 2/3] Align title Now "CNI traffic shaping support" in KEP, issue and PR. --- keps/sig-network/2819-CNI-traffic-shaping-support/README.md | 2 +- keps/sig-network/2819-CNI-traffic-shaping-support/kep.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/keps/sig-network/2819-CNI-traffic-shaping-support/README.md b/keps/sig-network/2819-CNI-traffic-shaping-support/README.md index 20e757df2c2..23b87d6d1f1 100644 --- a/keps/sig-network/2819-CNI-traffic-shaping-support/README.md +++ b/keps/sig-network/2819-CNI-traffic-shaping-support/README.md @@ -1,4 +1,4 @@ -# KEP-0012: Support traffic shaping for Kubelet CNI network plugin +# KEP-2819: CNI traffic shaping support - [Release Signoff Checklist](#release-signoff-checklist) diff --git a/keps/sig-network/2819-CNI-traffic-shaping-support/kep.yaml b/keps/sig-network/2819-CNI-traffic-shaping-support/kep.yaml index 4c3ee4fc4a1..865eed073a8 100644 --- a/keps/sig-network/2819-CNI-traffic-shaping-support/kep.yaml +++ b/keps/sig-network/2819-CNI-traffic-shaping-support/kep.yaml @@ -1,4 +1,4 @@ -title: Support traffic shaping for CNI network plugin +title: CNI traffic shaping support kep-number: 2819 authors: - "@Lion-Wei" From f39e4999edd7ab631abfb7a9101ab517d4f8ff3a Mon Sep 17 00:00:00 2001 From: Lars Ekman Date: Fri, 16 Jul 2021 08:36:35 +0200 Subject: [PATCH 3/3] Typo Co-authored-by: Tim Bannister --- keps/sig-network/2819-CNI-traffic-shaping-support/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keps/sig-network/2819-CNI-traffic-shaping-support/README.md b/keps/sig-network/2819-CNI-traffic-shaping-support/README.md index 23b87d6d1f1..28499672149 100644 --- a/keps/sig-network/2819-CNI-traffic-shaping-support/README.md +++ b/keps/sig-network/2819-CNI-traffic-shaping-support/README.md @@ -45,7 +45,7 @@ Make kubelet cni network plugin support basic traffic shapping capability `bandw Currently the kubenet code supports applying basic traffic shaping during pod setup. This will happen if bandwidth-related annotations have been added to the pod's metadata. -Kubelet CNI code doesn't support it yet, though CNI has already added a [traffic sharping plugin](https://github.com/containernetworking/plugins/tree/master/plugins/meta/bandwidth). +Kubelet CNI code doesn't support it yet, though CNI has already added a [traffic shaping plugin](https://github.com/containernetworking/plugins/tree/master/plugins/meta/bandwidth). We can replicate the behavior we have today in kubenet for kubelet CNI network plugin if we feel this is an important feature. ### Goals @@ -130,4 +130,4 @@ None ## Alternatives -None \ No newline at end of file +None