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

Network policy latency test clients v.0.0.1 #2226

Conversation

dlapcevic
Copy link
Contributor

A golang client application that runs in pods inside a K8s cluster, and measures network policy enforcement latency for changes to pods and network policies.

Details are in the README.md file.

Main purpose: Test network policy performance and scalability by using it with ClusterLoader2 framework.

/kind feature

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 17, 2023
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 17, 2023
@dlapcevic
Copy link
Contributor Author

/assign @alan-kut

@k8s-ci-robot
Copy link
Contributor

@dlapcevic: GitHub didn't allow me to assign the following users: alan-kut.

Note that only kubernetes members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @alan-kut

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.

@dlapcevic dlapcevic force-pushed the netpol-enforcement-latency-test-client branch 2 times, most recently from 57d1c63 to 34e7d46 Compare January 17, 2023 10:40
Copy link
Contributor

@alan-kut alan-kut left a comment

Choose a reason for hiding this comment

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

I haven't reviewed it fully yet.
Here is first batch of comments.

PTAL

@dlapcevic dlapcevic force-pushed the netpol-enforcement-latency-test-client branch from 34e7d46 to 268b83e Compare January 17, 2023 13:09
@dlapcevic dlapcevic requested review from alan-kut and removed request for shyamjvs and wojtek-t January 17, 2023 13:54
Comment on lines 152 to 160
if c.config.podCreationMode {
if err := c.measurePodCreation(); err != nil {
klog.Errorf("Pod creation test failed, error: %v", err)
}
} else {
if err := c.measureNetPolicyCreation(); err != nil {
klog.Errorf("Pod creation test failed, error: %v", err)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like it. If I'm not mistake majority of the code is for either pod or policy.
Some common code could be extracted to some utils or library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. Most of the functionality besides initialization and sending a request is not common to the modes.
I will extract the common code to utils package and separate it into 2 applications. We can run both in the scale tests.
Sounds good?

}

c.policyCreatedTime.lock.Unlock()
if failed {
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens in this case?
Don't we lose some test data because of this?
Doesn't it mean that request was sent before the policy was deployed?
Can't we wait for the policy before testing reachability?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Policy creation test starts sending traffic before allow policy is created.
Once allow policy is created, the requests to pods will succeed, and the policy will exist to measure latency for its creation.
If the policy cannot be retrieved here, it means the setup is incorrect. The warning log will make it clear that the specified allow policy is not found. No metrics should be generated from it.

@dlapcevic dlapcevic changed the title Network policy latency test client v.0.0.1 Network policy latency test clients v.0.0.1 Jan 24, 2023
@dlapcevic dlapcevic force-pushed the netpol-enforcement-latency-test-client branch from 268b83e to 016a828 Compare January 24, 2023 10:32
@dlapcevic
Copy link
Contributor Author

dlapcevic commented Jan 24, 2023

I refactored the code. Extracted all common code into a separate package and split the modes into two applications pod-creation-reachability-latency and policy-creation-enforcement-latency.
@alan-kut Please take another look.

@dlapcevic dlapcevic force-pushed the netpol-enforcement-latency-test-client branch from 016a828 to f22777b Compare January 24, 2023 10:50
@alan-kut
Copy link
Contributor

alan-kut commented Feb 6, 2023

/LGTM

@k8s-ci-robot
Copy link
Contributor

@alan-kut: changing LGTM is restricted to collaborators

In response to this:

/LGTM

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.

@dlapcevic
Copy link
Contributor Author

Hey @marseel, can you give LGTM for this one, so I can merge it?
@alan-kut reviewed it.

@marseel
Copy link
Member

marseel commented Feb 6, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 6, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alan-kut, dlapcevic, marseel

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot merged commit f9f2b21 into kubernetes:master Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants