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

Add k8s e2e test support & script #196

Merged
merged 1 commit into from
Nov 10, 2021
Merged

Conversation

dkeven
Copy link
Member

@dkeven dkeven commented Nov 5, 2021

Signed-off-by: dkeven [email protected]

What type of PR is this?
/kind feature

What this PR does / why we need it:
This PR adds a script, along with some config templates, to conveniently run the Kubernetes storage external e2e test, including:

  • installing necessary packages if not found
  • building docker image of the latest commit
  • pushing image to other nodes, if there are any
  • installing CSIDriver of the just built image
  • generating e2e test config, and start the test.

Which issue(s) this PR fixes:

Fixes #189

Special notes for your reviewer:

This PR adds a slightly modified version of the csi-qingcloud helm chart, mainly for avoiding conficts with existing csi-qingcloud's staically-named cluster-level resources like ClusterRole and ClusterRoleBinding, with each of them changed to a template-rendered name.

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., usage docs, etc.:

Refer to the readme.md

@f10atin9
Copy link
Contributor

f10atin9 commented Nov 5, 2021

I used it to test vpa, helpful. 👍

Copy link
Contributor

@stoneshi-yunify stoneshi-yunify left a comment

Choose a reason for hiding this comment

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

see my comments

controllerExpansion: true
nodeExpansion: true
onlineExpansion: false
volumeLimits: false
Copy link
Contributor

Choose a reason for hiding this comment

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

why volumeLimits is disabled?

Copy link
Member Author

Choose a reason for hiding this comment

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

This test will create more than max_volumes_per_node of PVCs to check the functioning of CSI Volume Limit, which is a very slow test, and which, in my opinion, is more of a K8s CSI logic rather than the CSIDriver implementation.

But we can add it back if it's considered necessary, what's your opinion?

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 understand. This test will create more than max_volumes_per_node of PVCs , for qingcloud-csi, the max volumes is 9, so the test will create 10 or 10+ volumes, correct? 10+ volumes will be very slow? why?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the description in the e2e test pkg. I've checked the test case, I think the " very slow" warning is for some drivers with more than 100 max volumes.
There're 2 test cases in the volume limits, which means in the case of qingcloud-csi, a total of 20 PVCs will be created, which is acceptable.
I'll change this test back to enabled.

@@ -0,0 +1,34 @@
# Copyright (C) 2018 Yunify, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

are you adding the qingcloud-csi chart here? Why not using the existing chart?

Copy link
Member Author

Choose a reason for hiding this comment

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

In the test environment, there are likely already a deployed qingcloud-csi, with some of the cluster-level components like ClusterRole and ClusterRoleBinding created in a static name, which results in a conflict when deploying the qingcloud-csi driver of the e2e test.

So I'm adding a local chart with the names modified to a configurable template, to avoid conflicts.

Copy link
Contributor

Choose a reason for hiding this comment

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

okay, I understand. But adding a bunch of source files from another repo to this repo is strongly discouraged. They work now, but maintaining them in the future will be a nightmare.

Try to use the existing qingcloud-csi chart ( or even modify the existing qingcloud-csi chart to support the e2e test), but don't add the chart source codes to this repo.

The simplest and quickest way to me may be adding a prerequisite: this e2e test need a clean cluster without qingcloud-csi deployed. if it's deployed, uninstall it before proceed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I agree on that, will just leave it to the user in the prerequisites doc section.

tar -xf e2e-tests.tar.gz --directory=./qingcloud-csi/test/e2e && rm e2e-tests.tar.gz
```

2. Multiple nodes are preferred, if that's possible, as some tests will check against volume drifting from one node to another.
Copy link
Contributor

Choose a reason for hiding this comment

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

will the test detect the number of nodes? If I run the test on a single-node cluster, will some test cases fail or skip?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the test won't skip tests according to the number of nodes, and will time out if there is only one node.

I'll figure out a way to get around this. I think I'll check the number of nodes in the script and skip the multi-node tests if there is only one node.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, try to auto-detect the cluster nodes and enable the proper tests. If that's is impossible, add a argument to your test script or write a guide for user to self-check the cluster nodes and disable/enable the proper tests.


## Run

Execute `./run_e2e_test.sh` to run the e2e tests.
Copy link
Contributor

Choose a reason for hiding this comment

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

do I need use root or regular user to run this script?

Copy link
Member Author

Choose a reason for hiding this comment

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

root access in Linux is not necessary, but admin access to the K8s cluster is needed. I'll update the usage doc to clarify that.

@dkeven
Copy link
Member Author

dkeven commented Nov 8, 2021

/hold do not merge until I've verified the new commit

@dkeven dkeven changed the title Add k8s e2e test support & script [WIP] Add k8s e2e test support & script Nov 8, 2021
@dkeven dkeven force-pushed the supporte2etest branch 5 times, most recently from 678679b to 511aa5e Compare November 9, 2021 10:59
@dkeven dkeven changed the title [WIP] Add k8s e2e test support & script Add k8s e2e test support & script Nov 10, 2021
@dkeven
Copy link
Member Author

dkeven commented Nov 10, 2021

/unhold I've finished updating the commit, plz take a look @stoneshi-yunify @f10atin9

There appears to be a bug when I'm testing the e2e functions. I'll create another PR to separate the commit.

Copy link
Contributor

@stoneshi-yunify stoneshi-yunify left a comment

Choose a reason for hiding this comment

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

/lgtm

thank you !

@zheng1
Copy link
Member

zheng1 commented Nov 10, 2021

It looks like the ci-bot is hanging again

@zheng1 zheng1 merged commit bdeb967 into yunify:master Nov 10, 2021
@dkeven dkeven deleted the supporte2etest branch November 10, 2021 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CSI e2e test
4 participants