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

e2e: add qos policy test cases #2924

Merged
merged 2 commits into from
Jun 16, 2023
Merged

Conversation

shane965
Copy link
Contributor

@shane965 shane965 commented Jun 10, 2023

Add the following test cases:

  1. Set qos policy for natgw
  2. Set qos policy for eip
  3. Rebuild qos of natgw when the natgw pod restarts
  4. Rebuild qos of eip when the natgw pod restarts
  5. Change qos policy of natgw
  6. Change qos policy of eip
  7. Update qos policy of eip
  8. Set specific ip qos policy of natgw
  9. Match Qos priority
  10. Create natgw with qos policy
  11. Create eip with qos policy

What type of this PR

Examples of user facing changes:

  • Tests

Which issue(s) this PR fixes:

Fixes #2633

WHAT

🤖 Generated by Copilot at fe99231

This pull request fixes a bug in the qosPolicy finalizer logic and adds e2e tests and framework enhancements to cover the qos policy feature of the eip and nat gateway objects. It modifies pkg/controller/qos_policy.go, test/e2e/framework/iptables-eip.go, and test/e2e/framework/vpc-nat-gw.go to handle the qos policy logic and verification. It also adds new files test/e2e/framework/exec_utils.go and test/e2e/framework/qos-policy.go to provide helper functions for executing commands and manipulating qos policy objects. It also adds a new function NetworkDelete to test/e2e/framework/docker/network.go to clean up the docker networks used for testing.

🤖 Generated by Copilot at fe99231

docker cleans up
testing qosPolicy for
eip and nat - spring

HOW

🤖 Generated by Copilot at fe99231

  • Add and modify helper methods to create, update, patch, delete, and wait for qos policy objects in the framework package (link)
  • Add a new function to delete docker networks in the docker package (link)
  • Add helper functions to execute commands in pods and containers using the kubernetes client-go tools in the framework package (link)
  • Add and modify methods to sync, patch, and wait for qos policies of eip objects in the test/e2e/framework/iptables-eip.go file (link, link, link, link, link)
  • Modify the signature of the MakeIptablesEIP function to accept a qos policy name as a parameter and set the qos policy field of the eip object accordingly in the test/e2e/framework/iptables-eip.go file (link, link)
  • Modify the signature of the PatchSync method of the VpcNatGatewayClient struct to remove the unused requiredNodes parameter in the test/e2e/framework/vpc-nat-gw.go file (link)
  • Add a new method to patch and wait for qos policies of nat gateway objects in the test/e2e/framework/vpc-nat-gw.go file (link, link)
  • Modify the signature of the MakeVpcNatGateway function to accept a qos policy name as a parameter and set the qos policy field of the nat gateway object accordingly in the test/e2e/framework/vpc-nat-gw.go file (link)
  • Add conditions to check for not found errors when listing eip and nat gateway objects in the pkg/controller/qos_policy.go file and skip error handling if true (link, link)

@shane965 shane965 force-pushed the e2e-qos-policy branch 5 times, most recently from 94f0694 to 0e37176 Compare June 12, 2023 07:57
@zbb88888 zbb88888 requested a review from zhangzujian June 14, 2023 01:15
@zbb88888
Copy link
Collaborator

Hi, @zhangzujian could you please help review this e2e?

@zhangzujian zhangzujian added test automation tests ci labels Jun 14, 2023
Comment on lines 185 to 187
if qosPolicyName != "" {
vpcNatGw.Spec.QoSPolicy = qosPolicyName
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if qosPolicyName != "" {
vpcNatGw.Spec.QoSPolicy = qosPolicyName
}
vpcNatGw.Spec.QoSPolicy = qosPolicyName

attachNet := framework.MakeNetworkAttachmentDefinition(externalNetworkName, framework.KubeOvnNamespace, attachConf)
attachNetClient.Create(attachNet)
nad := attachNetClient.Get(externalNetworkName)
framework.ExpectNoError(err, "failed to get")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
framework.ExpectNoError(err, "failed to get")

// ExecWithOptions executes a command in the specified container,
// returning stdout, stderr and error. `options` allowed for
// additional parameters to be passed.
func ExecWithOptions(f *Framework, options ExecOptions) (string, string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we use util.ExecuteCommandInContainer() directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I was referencing kubernetes/test/e2e/network/networking_perf.go to write e2e, I also considered this issue. If it is in the e2e scenario, I think it would be better to use func ExecCommandInContainer(f *framework.Framework, podName, containerName string, cmd ...string) string, because I can use framework.Logf to output some debugging information and obtain some properties through f..

Copy link
Member

Choose a reason for hiding this comment

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

klog.Infof() can also print debug information.

What does obtain some properties through f. mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I can pass f.Namespace.Name as a parameter.
Thank you for your suggestion. I will try to modify exec_util.go and reuse the code from /pkg/util/pod_exec.go.

@shane965 shane965 force-pushed the e2e-qos-policy branch 5 times, most recently from e8f418b to f13c096 Compare June 15, 2023 11:45
Set qos policy for natgw
Set qos policy for eip
Rebuild qos of natgw when the natgw pod restarts
Rebuild qos of eip when the natgw pod restarts
Change qos policy of natgw
Change qos policy of eip
Update qos policy of eip
Set specific ip qos policy of natgw
Match Qos priority
Create natgw with qos policy
Create eip with qos policy
@@ -34,6 +38,34 @@ const vpcNatGWConfigMapName = "ovn-vpc-nat-gw-config"
const networkAttachDefName = "ovn-vpc-external-network"
const externalSubnetProvider = "ovn-vpc-external-network.kube-system"

const iperf2Port = "20288"
const skipIperf = true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Iperf will cause the program to spend more time on e2e, taking approximately 15 minutes.
I will try to optimize the program to reduce the time to 5 minutes and then enable the iperf test.

@zbb88888 zbb88888 merged commit f52b150 into kubeovn:master Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci test automation tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More QoS features supported in NATGW
3 participants