-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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: CSI Tests #56509
e2e: CSI Tests #56509
Conversation
/assign @msau42 |
@lpabon: GitHub didn't allow me to assign the following users: erinboyd. Note that only kubernetes members can be assigned. In response to this:
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. |
/ok-to-test |
To test this using
|
44e9932
to
fab7712
Compare
@lpabon to enable these tests in CI, you need to modify these two places: Note that you cannot enable these tests in GKE until someone from google enables the v1alpha group. |
@msau42 nice! so I should add a |
you don't need a skip statement as long as you don't add it to the gke env/config files. |
test/e2e/storage/csi_volumes.go
Outdated
By("creating a persistentvolume") | ||
pv := externalAttacherPersistentVolume(cs, config, false, false, mockPluginName, mockPluginVolumeHandle) | ||
|
||
By("creating a fake volume attacher") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the attach detach controller be the one creating/deleting the AttachVolume object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently that is not the task of the external-attacher. Instead is part of the plugin code created by #54529 . There will be another e2e test to test the K8S/CSI plugin creation of PV and volumeattach objects.
Since this test creates them manual pretending to be the k8s/csi plugin, then it is responsible to delete them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E2E tests are supposed to test from the user's POV. If you're stubbing out different components, that is better suited for an integration or unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree, but this is the only way to test a ...mostly.. e2e due to csi components. I will add to this test the e2e for #54529 in another PR. This one will set the foundation. Unless we wait until the full PR is ready?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will add to this PR another commit for a full e2e test.
{ | ||
APIGroups: []string{"storage.k8s.io"}, | ||
Resources: []string{"volumeattachments"}, | ||
Verbs: []string{"get", "list", "watch", "update"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resource "nodes" need Verbs "update" from Line 423;
Resource "volumeattachments" need Verbs "delete" from Line 351.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is policy for external-attacher started as a pod somewhere in this PR. It's not policy for the test itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsafrane Got it.
test/e2e/storage/csi_volumes.go
Outdated
}, | ||
Volumes: []v1.Volume{ | ||
{ | ||
Name: "socket-dir", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect some emptyDir
here.
test/e2e/storage/csi_volumes.go
Outdated
}, | ||
} | ||
|
||
// Delete old VA with same name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VA -> PV?
test/e2e/storage/csi_volumes.go
Outdated
|
||
func setNodeAnnotation( | ||
client clientset.Interface, | ||
config framework.VolumeTestConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config
is not used
test/e2e/storage/csi_volumes.go
Outdated
|
||
func deleteNodeAnnotation( | ||
client clientset.Interface, | ||
config framework.VolumeTestConfig, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config
is not used
test/e2e/storage/csi_volumes.go
Outdated
func waitForVolumeAttachementAttached( | ||
client clientset.Interface, | ||
name string, | ||
ns string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ns
is not used
test/e2e/storage/csi_volumes.go
Outdated
blob, err := json.Marshal(annotationMap) | ||
framework.ExpectNoError(err, "Unable to marshal csi node mapping: %v", err) | ||
|
||
n.Annotations[csiNodeAnnotationMappingKey] = string(blob) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the annotation if annotationMap
is empty
Thanks all. I will have an update with a full e2e update coming. |
/retest |
/assign @msau42 |
test/e2e/storage/csi_volumes.go
Outdated
csiDriverRegistrarImage string = "docker.io/k8scsi/driver-registrar" | ||
) | ||
|
||
func externalAttacherServiceAccout( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Account
|
||
claim := newClaim(t, ns.GetName(), "") | ||
class := newStorageClass(t, ns.GetName(), "") | ||
testDynamicProvisioning(t, cs, claim, class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any plans to also test mount/unmount, attach/detach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now, we would need a driver that supports attach/detach. But mount/unmount is tested by testDynamicProvisioning()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, now that I think about it, the test does test it. It all depends on the driver, but the e2e test does send out all the CSI calls to attach/detach and mount/unmount. All the CSI drivers we have right now do attach/deatch and mount/unmount on the NodePublish/Unpublish
calls done from the kubelet to the CSI driver. Probably when we get CSI drivers for the cloud vendors, the test would exercise attach/detach done from the external-attacher
side car container to the CSI driver, then mount/unmount would be done by the kubelet to the CSI driver.
So, tldr: Yes, both are tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I think about it, maybe I should change the text on line 227 to say something like: should provision, attach/detach, then mount/unmount storage with a hostPath CSI driver
. Would that make sense?
/retest |
2 similar comments
/retest |
/retest |
/retest |
This e2e test tests the CSI volume plugin in kubernetes with a CSI hostPath driver. It is also setup to be able to be tested with more drivers in the future.
/retest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor nit, otherwise LGTM
} | ||
|
||
clusterRoleClient.Delete(role.GetName(), &metav1.DeleteOptions{}) | ||
err := wait.Poll(2*time.Second, 10*time.Minute, func() (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd appreciate a constant for 10*time.Minute
, as it is used on multiple times
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
}, | ||
}, | ||
{ | ||
Name: "driver-registrar", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you bundled the all the external components and the driver in to the same pod. Not a huge deal, but our recommendation is two pods: 1) no more then one replica containing external-attacher, external-provisioner, and csi-driver and 2) on every node a driver-registrar and csi-driver.
We can consider this configuration for additional E2E tests in the future.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lpabon, saad-ali Associated issue: #178 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all Tests are more than 96 hours old. Re-running tests. |
/retest Review the full test history for this PR. Silence the bot with an |
/test all Tests are more than 96 hours old. Re-running tests. |
Automatic merge from submit-queue (batch tested with PRs 57266, 58187, 58186, 46245, 56509). If you want to cherry-pick this change to another branch, please follow the instructions here. |
What this PR does / why we need it:
This e2e test tests the CSI external attacher with a mock CSI plugin driver.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged): kubernetes/enhancements#178Special notes for your reviewer:
VolumeAttachment
API Object #54463Release note: