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

strict staging and target directory #182

Merged
merged 1 commit into from
Mar 25, 2019

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Mar 21, 2019

The CSI spec requires the CO (= csi-sanity) to create the staging
directory and the parent of the target
directory. Kubernetes (kubernetes/kubernetes#75535)
and csi-sanit have handled the target directory incorrectly by
creating it.

Now directory handling is standard-compliant and more strict, to catch
mistakes:

  • the specified target directory is treated as the parent which gets
    created by csi-sanity, while the actual NodePublishVolume call then
    specifies an entry inside that directory; this was done to keep the
    code simple (handling both directories is the same) and to minimize
    API changes
  • os.Mkdir and os.Remove are used instead of the more forgiving
    os.MkdirAll and os.RemoveAll; as a result, both directories
    now must be different (which is what they should have been in the
    anyway, it just happened to work when they were identical)
  • the mock driver checks for non-existence of the target directory

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pohly

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 added 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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 21, 2019
The CSI spec requires the CO (= csi-sanity) to create the staging
directory and the *parent* of the target
directory. Kubernetes (kubernetes/kubernetes#75535)
and csi-sanity have handled the target directory incorrectly by
creating it.

Now directory handling is standard-compliant and more strict, to catch
mistakes:
- the specified target directory is treated as the parent which gets
  created by csi-sanity, while the actual NodePublishVolume call then
  specifies an entry inside that directory; this was done to keep the
  code simple (handling both directories is the same) and to minimize
  API changes
- os.Mkdir and os.Remove are used instead of the more forgiving
  os.MkdirAll and os.RemoveAll; as a result, both directories
  now must be different (which is what they should have been in the
  anyway, it just happened to work when they were identical)
- the mock driver checks for non-existence of the target directory
@msau42
Copy link
Collaborator

msau42 commented Mar 25, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 25, 2019
@k8s-ci-robot k8s-ci-robot merged commit 692e5bd into kubernetes-csi:master Mar 25, 2019
suneeth51 pushed a commit to suneeth51/csi-test that referenced this pull request Sep 11, 2019
strict staging and target directory
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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants