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: CSI Tests #56509

Merged
merged 1 commit into from
Jan 13, 2018
Merged

e2e: CSI Tests #56509

merged 1 commit into from
Jan 13, 2018

Conversation

lpabon
Copy link
Contributor

@lpabon lpabon commented Nov 28, 2017

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#178

Special notes for your reviewer:

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 28, 2017
@lpabon
Copy link
Contributor Author

lpabon commented Nov 28, 2017

/assign @msau42

@k8s-ci-robot
Copy link
Contributor

@lpabon: GitHub didn't allow me to assign the following users: erinboyd.

Note that only kubernetes members can be assigned.

In response to this:

/assign @erinboyd

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.

@lpabon
Copy link
Contributor Author

lpabon commented Nov 28, 2017

cc @erinboyd @jsafrane

@msau42
Copy link
Member

msau42 commented Nov 28, 2017

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 28, 2017
@lpabon
Copy link
Contributor Author

lpabon commented Nov 28, 2017

To test this using cluster/kube-up.sh you must enable the following:

export KUBE_RUNTIME_CONFIG="storage.k8s.io/v1alpha1=true"
export KUBE_FEATURE_GATES="CSIPersistentVolume=true

@lpabon lpabon force-pushed the csi-e2e branch 2 times, most recently from 44e9932 to fab7712 Compare November 28, 2017 22:23
@msau42
Copy link
Member

msau42 commented Nov 28, 2017

@lpabon to enable these tests in CI, you need to modify these two places:
https://github.com/kubernetes/test-infra/blob/master/jobs/config.json#L4110
https://github.com/kubernetes/test-infra/blob/master/jobs/env/ci-kubernetes-e2e-gci-gce-alpha-features.env

Note that you cannot enable these tests in GKE until someone from google enables the v1alpha group.

@lpabon
Copy link
Contributor Author

lpabon commented Nov 28, 2017

@msau42 nice! so I should add a skip if gke statement?

@msau42
Copy link
Member

msau42 commented Nov 28, 2017

you don't need a skip statement as long as you don't add it to the gke env/config files.

By("creating a persistentvolume")
pv := externalAttacherPersistentVolume(cs, config, false, false, mockPluginName, mockPluginVolumeHandle)

By("creating a fake volume attacher")
Copy link
Member

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?

Copy link
Contributor Author

@lpabon lpabon Nov 28, 2017

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.

Copy link
Member

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.

Copy link
Contributor Author

@lpabon lpabon Nov 29, 2017

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?

Copy link
Contributor Author

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.

@lpabon lpabon changed the title e2e: CSI Attacher Tests WIP: e2e: CSI Attacher Tests Nov 29, 2017
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 29, 2017
{
APIGroups: []string{"storage.k8s.io"},
Resources: []string{"volumeattachments"},
Verbs: []string{"get", "list", "watch", "update"},
Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

@jsafrane Got it.

},
Volumes: []v1.Volume{
{
Name: "socket-dir",
Copy link
Member

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.

},
}

// Delete old VA with same name
Copy link
Member

Choose a reason for hiding this comment

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

VA -> PV?


func setNodeAnnotation(
client clientset.Interface,
config framework.VolumeTestConfig,
Copy link
Member

Choose a reason for hiding this comment

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

config is not used


func deleteNodeAnnotation(
client clientset.Interface,
config framework.VolumeTestConfig,
Copy link
Member

Choose a reason for hiding this comment

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

config is not used

func waitForVolumeAttachementAttached(
client clientset.Interface,
name string,
ns string,
Copy link
Member

Choose a reason for hiding this comment

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

ns is not used

blob, err := json.Marshal(annotationMap)
framework.ExpectNoError(err, "Unable to marshal csi node mapping: %v", err)

n.Annotations[csiNodeAnnotationMappingKey] = string(blob)
Copy link
Member

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

@lpabon
Copy link
Contributor Author

lpabon commented Dec 4, 2017

Thanks all. I will have an update with a full e2e update coming.

@lpabon lpabon changed the title WIP: e2e: CSI Attacher Tests WIP: e2e: CSI Tests Dec 4, 2017
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 12, 2017
@kubernetes kubernetes deleted a comment from k8s-github-robot Dec 12, 2017
@k8s-ci-robot k8s-ci-robot removed the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 13, 2017
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 13, 2017
@lpabon lpabon changed the title WIP: e2e: CSI Tests e2e: CSI Tests Dec 13, 2017
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 13, 2017
@lpabon
Copy link
Contributor Author

lpabon commented Dec 13, 2017

/retest

@lpabon
Copy link
Contributor Author

lpabon commented Dec 13, 2017

/assign @msau42

csiDriverRegistrarImage string = "docker.io/k8scsi/driver-registrar"
)

func externalAttacherServiceAccout(
Copy link
Member

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)
Copy link
Member

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?

Copy link
Contributor Author

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().

Copy link
Contributor Author

@lpabon lpabon Dec 14, 2017

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.

Copy link
Contributor Author

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?

@lpabon
Copy link
Contributor Author

lpabon commented Dec 14, 2017

/retest

2 similar comments
@lpabon
Copy link
Contributor Author

lpabon commented Dec 14, 2017

/retest

@lpabon
Copy link
Contributor Author

lpabon commented Dec 14, 2017

/retest

@lpabon
Copy link
Contributor Author

lpabon commented Dec 14, 2017

/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.
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 19, 2017
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 20, 2017
@lpabon
Copy link
Contributor Author

lpabon commented Dec 20, 2017

/retest

Copy link
Member

@jsafrane jsafrane left a 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) {
Copy link
Member

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

Copy link
Member

@saad-ali saad-ali left a 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",
Copy link
Member

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.

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

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@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 12, 2018
@k8s-github-robot
Copy link

/test all

Tests are more than 96 hours old. Re-running tests.

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to @fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@k8s-github-robot
Copy link

/test all

Tests are more than 96 hours old. Re-running tests.

@k8s-github-robot
Copy link

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.

@k8s-github-robot k8s-github-robot merged commit 7dbb709 into kubernetes:master Jan 13, 2018
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants