-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
network limit tbf #350
network limit tbf #350
Conversation
b6927f0
to
9e0f82a
Compare
Codecov Report
@@ Coverage Diff @@
## master #350 +/- ##
=======================================
Coverage 58.63% 58.63%
=======================================
Files 60 60
Lines 3626 3626
=======================================
Hits 2126 2126
Misses 1332 1332
Partials 168 168 Continue to review full report at Codecov.
|
b523ffc
to
2004080
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM.
@cwen0 PTAL
4d49072
to
9b251c2
Compare
Please also document that minikube doesn't support this feature, as I will try to add this kernel option for minikube later. |
65d2520
to
2e59872
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@cwen0 PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
"app.kubernetes.io/component": "tikv" | ||
bandwidth: | ||
rate: 100kbps | ||
limit: 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What will happen if we set this value to "0"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, string "0" will be fail for type checking error, and int 0 will fail to apply qdisc as limit is required for tbf (in the background). One thing could improve this is add a validation before actually apply this.
} | ||
|
||
// TODO(vincent178): this is ok if we only apply either netem or tbf, revisit this if we want both working | ||
func qdiscExists(qdisc netlink.Qdisc, handler *netlink.Handle, link netlink.Link) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some unit tests for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function is simple and straightforward, but I do find the comment is not valid anymore, so I remove it. Thank you!
d9ca093
to
d15bbe4
Compare
@vincent178 Is this PR ready for another round of review now ? |
@AngleNet I'm adding validation for api object, should be quick though. Will let you guys know after that. |
|
8ed2d27
to
f7877b7
Compare
This reverts commit f7877b7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
/run-all-tests |
return nil, mockError("SetTbf") | ||
} | ||
|
||
func (c *MockChaosDaemonClient) DeleteTbf(ctx context.Context, in *chaosdaemon.TbfRequest, opts ...grpc.CallOption) (*empty.Empty, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method MockChaosDaemonClient.DeleteTbf should have comment or be unexported
@@ -43,6 +43,14 @@ func (c *MockChaosDaemonClient) DeleteNetem(ctx context.Context, in *chaosdaemon | |||
return nil, mockError("DeleteNetem") | |||
} | |||
|
|||
func (c *MockChaosDaemonClient) SetTbf(ctx context.Context, in *chaosdaemon.TbfRequest, opts ...grpc.CallOption) (*empty.Empty, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method MockChaosDaemonClient.SetTbf should have comment or be unexported
networkTbfActionMsg = "network tbf action duration %s" | ||
) | ||
|
||
type Reconciler struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported type Reconciler should have comment or be unexported
/run-all-tests |
@vincent178 merge failed. |
* proto and tbf server apply logic * refactor common logic to netlink_linux and apply it in tbf_server * [temp] remove limit in networkchaos * make fmt and make yaml * fix var * add mock implementation * fix missing grpc option * rough implementation of API spec and controller * implement InnerReconciler * make fmt * rename to bandwidth * make * fix api zero value parse issue * fix remove tbf issue * adjust type for bandwidth * commit yaml and test * fix tbf server test * add unit support for rate * add network bandwidth example * add documentation * make yaml * make fmt * update pb * make yaml * update log * refactor netem with toQdiscFunc * update based on comments * update based on comments * optional * fix nil pointer dereference * fix typo * update document * update document * update based on comments * add more doc * add unit test and add license comment * add comments for tbf * fix comment * add license comment * fix ut * add validation * update licensed * update code * Revert "update licensed" This reverts commit f7877b7. * update license file to 2020 Co-authored-by: pingcap-github-bot <[email protected]>
What problem does this PR solve?
This PR is adding bandwidth limit feature for network chaos which specify in #303, which use tbf qdisc under the hood.
What is changed and how does it work?
SetTbf
andDeleteTbf
NetworkChaosSpec
addBandwidthSpec
chaosdaemon
implementSetTbf
andDeleteTbf
grpc functionSome notable things I would like to work next is
Check List
Tests
manually run
kubectl apply -f network-chaos.yaml
andkubectl delete -f network-chaos.yaml
below.screenshot below

Code changes
Side effects
n/a
Related changes
done
Does this PR introduce a user-facing change?: