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

update code for for large networkpolicy and egress firewall rule #688

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

liqcui
Copy link

@liqcui liqcui commented Feb 28, 2024

Type of change

  • Refactor
  • [ Yes ] New feature
  • Bug fix
  • Optimization
  • Documentation Update

Description

To simulate a customer zero trust environment. We deny all traffic of ingress and egress for network policy and egress firewall, adding a whitelist to open essential ports.

For network policy, create two type workloads to send network traffic.
pod to pod traffic in the same namespace - node density heavy, create two pods, one pod is postgres DB, another is client to insert data into database continuously.
across namespace traffic, it will query dns to prometheus pod hostname from others namespace.
For egress firewall, adding allow/deny rules for egress firewall. We create one pod to send network traffic from the OCP network to the internet continuously.

Creating 10500 pods, 20k networkpolicy, 200k egress firewall rule(acl) first, then create 9 additional new ns with 20k networkpolicy, 200k egress firewall rule, then delete those additional ns to simulate customer maybe remove unuseless network policy.

After all pods/network policy/egress firewall created and ready, wait for 90 minutes to create a new namespace and add new network-policy, create new pods again to check OVN init-sync time.

Related Tickets & Documents

Checklist before requesting a review

  • [ Yes ] I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.

Testing

  • Please describe the System Under Test.

master: 16 vCPUs 64 GiB 

worker: 8 vCPUs 32 GiB | x86 | 100 worker node

https://docs.google.com/document/d/1X3YNRXmPB1boDeEk0OCZdZPoYdA2B0q2yYrDzJWBcaw/edit

Copy link

openshift-ci bot commented Feb 28, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: liqcui
Once this PR has been reviewed and has the lgtm label, please assign morenod for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

openshift-ci bot commented Feb 28, 2024

Hi @liqcui. Thanks for your PR.

I'm waiting for a cloud-bulldozer member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@liqcui liqcui force-pushed the large-networkpolicy-egress branch 2 times, most recently from e3f04b9 to 1c906d7 Compare February 28, 2024 02:48
@liqcui
Copy link
Author

liqcui commented Feb 28, 2024

/assign @qiliRedHat @paigerube14 Please review the PR when you are available, thanks!

@liqcui
Copy link
Author

liqcui commented Feb 28, 2024

/cc @qiliRedHat @paigerube14

@krishvoor
Copy link
Member

@liqcui Can you please sign-off the PR?

@liqcui
Copy link
Author

liqcui commented Feb 28, 2024

@krishvoor Sorry, I don't quite understand what's your mean, you mean the case isn't suitable for merge into e2e-benchmarking code repository now? right?

@krishvoor
Copy link
Member

@liqcui we recently added DCO a mandatory check which needs users to sign commits first this could be performed via git commit -s

@liqcui
Copy link
Author

liqcui commented Feb 28, 2024

@liqcui we recently added DCO a mandatory check which needs users to sign commits first this could be performed via git commit -s
Thank you, I have sign-off the PR now!

@liqcui liqcui force-pushed the large-networkpolicy-egress branch 3 times, most recently from 4a68e78 to f78cabe Compare February 29, 2024 11:04
@liqcui
Copy link
Author

liqcui commented Mar 1, 2024

/cc @mohit-sheth

@openshift-ci openshift-ci bot requested a review from mohit-sheth March 1, 2024 10:37

## large-networkpolicy-egress

With the help of [large-networkpolicy-egress] customer cases that combined with node-density-heavy, network policy and egress firewall
Copy link
Collaborator

Choose a reason for hiding this comment

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

@liqcui This sentence seems not completed.

Copy link
Author

Choose a reason for hiding this comment

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

@qiliRedHat Thank you for taking time to review my pr, I have updated the README, please review again, if still have something that didn't describe clearly. thanks!

- Default deny large-networkpolicy-egress is applied first that blocks traffic to any test namespace
- 100 network policies in each namespace that allows traffic from the same namespace and two other namespaces using namespace selectors,NETWORKPOLICY_RPLICAS=50, default value of NETWORKPOLICY_RPLICAS is 50
- 1 egress policy in each namespace, you can specified how many egress policy rule by EGRESS_FIREWALL_POLICY_TOTAL_NUM=80, it will create 80 rules for one policy. default value of EGRESS_FIREWALL_POLICY_TOTAL_NUM is 80
- WAIT_OVN_DB_SYNC_TIME used for specify the time that wait for OVN DB sync, the memory usage of ovn node pod will increase during the time.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you be more specific about the exact pod name?
Could you describe when the OVN DB sync will happen, is that right after applying all the network policies and egress firewalls? How long it usually take with the default settings (the default WAIT_OVN_DB_SYNC_TIME setting). What will happen if this is set too short?

Copy link
Author

Choose a reason for hiding this comment

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

@qiliRedHat I will update the pod name since the script did a minor change. got the pod name from new testing.

Copy link
Author

Choose a reason for hiding this comment

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

Update the pod name now!

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: case-amadeus-mgob-allow-dns
Copy link
Collaborator

Choose a reason for hiding this comment

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

@liqcui I searched and found 11 'amadeus', please remove or replace them.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in new code, thanks!

pod-security.kubernetes.io/audit: privileged
pod-security.kubernetes.io/warn: privileged
objects:
- objectTemplate: case-engress-firewall.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't find the case-engress-firewall.yaml file.

Copy link
Author

Choose a reason for hiding this comment

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

@liqcui liqcui force-pushed the large-networkpolicy-egress branch 2 times, most recently from e9966d0 to e9ae1d4 Compare April 10, 2024 11:16
@liqcui liqcui force-pushed the large-networkpolicy-egress branch from e9ae1d4 to f6d0c1a Compare April 10, 2024 11:54
…o-trust environment

Signed-off-by: Liquan Cui <liqcui@redhat.com>
@liqcui liqcui force-pushed the large-networkpolicy-egress branch from f6d0c1a to 15a55af Compare April 10, 2024 13:32
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.

3 participants