Skip to content
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

refractor network chaos to support multiple network chaos on the same pod #788

Merged
merged 52 commits into from Aug 19, 2020

Conversation

YangKeao
Copy link
Member

@YangKeao YangKeao commented Aug 5, 2020

What problem does this PR solve?

Part of #718. This PR brings a lot of new features to NetworkChaos:

  1. Support multiple network chaos on the same pod.

  2. Support target selector for bandwidth limit

What is changed and how does it work?

A new resource PodNetworkChaos is created to record the relation between Iptables, IPSet and Tc rules and the chaos definitions.

The implementation of the network partition is quite straightforward. If multiple network partition chaoses are set on the same pod,
all these ips/cidrs will be blocked.

For bandwidth limit and netem chaos, the final traffic control tree will be like:

                +--------+
                |NETEM/TBF
                +---+----+
                    |
                    |
                +---+----+
                |NETEM/TBF
                +---+----+
                    |
                    |
                +---+----+
                |NETEM/TBF
                +---+----+
                    |
                    |
                +---v----+
                |PRIO    |
                +---+----+
                    |
    +-Filter 1------------Default---+
    |               |               |
    |           Filter 2            |
+---+----+      +--------+      +---+----+
|NETEM/TBF      |NETEM/TBF      |SFQ     |
+--------+      +--------+      +--------+

All netem/bandwidth chaos without a filter will be piped at the beginning of qdisc (and linked to root qdisc). The netem/bandwidth chaos with a filter will be set on one band of PRIO qdisc.

Limitation: Only one netem/tbf qdisc with a filter will be applied, so that if you are applying two netem/tbf chaos and their targets overlapped, only one of them takes effect (for the pod in the intersection of their targets).

Check List

Tests

  • E2E test
  • Manual test

Code changes

  • Has Go code change

Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
@YangKeao YangKeao requested a review from cwen0 August 5, 2020 09:20
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
@YangKeao
Copy link
Member Author

YangKeao commented Aug 5, 2020

/run-e2e-tests

1 similar comment
@cwen0
Copy link
Member

cwen0 commented Aug 5, 2020

/run-e2e-tests

Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
@YangKeao
Copy link
Member Author

/run-e2e-tests

@YangKeao YangKeao requested a review from cwen0 August 12, 2020 07:24
@YangKeao
Copy link
Member Author

/run-e2e-tests

@YangKeao
Copy link
Member Author

/run-e2e-tests

@YangKeao
Copy link
Member Author

/run-e2e-tests

cwen0
cwen0 previously approved these changes Aug 18, 2020
Copy link
Member

@cwen0 cwen0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

api/v1alpha1/podnetworkchaos_types.go Outdated Show resolved Hide resolved
controllers/networkchaos/partition/types.go Outdated Show resolved Hide resolved
controllers/networkchaos/trafficcontrol/types.go Outdated Show resolved Hide resolved
controllers/networkchaos/trafficcontrol/types_test.go Outdated Show resolved Hide resolved
controllers/networkchaos/trafficcontrol/types_test.go Outdated Show resolved Hide resolved
controllers/podnetworkchaos/types.go Outdated Show resolved Hide resolved
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Signed-off-by: Yang Keao <keao.yang@yahoo.com>
Copy link
Contributor

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot
Copy link
Contributor

@WangXiangUSTC,Thanks for your review. However, LGTM is restricted to Reviewers or higher roles.See the corresponding SIG page for more information. Related SIGs: chaos-mesh(slack).

@cwen0
Copy link
Member

cwen0 commented Aug 19, 2020

/run-e2e-tests

@cwen0 cwen0 merged commit 1539c9d into chaos-mesh:master Aug 19, 2020
@Yiyiyimu Yiyiyimu mentioned this pull request Oct 2, 2020
4 tasks
sjwsl pushed a commit to sjwsl/chaos-mesh that referenced this pull request May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants