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

Fix windows MountSensitive error #148

Merged

Conversation

mboersma
Copy link
Contributor

After kubernetes/kubernetes#88684 was included in 1.18.0-rc.1, Windows volume mounts began failing in our AKS Engine e2e tests. It appears that the code path for Windows MountSensitive should have been looking at the sensitiveOptions instead of options. We see options empty in every call.

We've tested this interactively and found it to resolve Windows mounting problems.

cc: @kkmsft @marosset

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 20, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @mboersma!

It looks like this is your first PR to kubernetes/utils 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/utils has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 20, 2020
Copy link
Member

@andyzhangx andyzhangx 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
Thanks, we need to do hotfix in v1.18.0 too.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2020
@mboersma
Copy link
Contributor Author

mboersma commented Mar 20, 2020

This is a quick fix--let's let @kkmsft weigh in because he may have a smarter one.

Perhaps e1ea343 should have included Linux-style changes for Windows?

@andyzhangx
Copy link
Member

@gnufied coud you approve this? Thanks.

@andyzhangx
Copy link
Member

/assign @saad-ali @jingxu97 @msau42 @jsafrane

mount/mount_windows.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 20, 2020
@@ -99,13 +99,13 @@ func (mounter *Mounter) MountSensitive(source string, target string, fstype stri
getSMBMountMutex.LockKey(source)
defer getSMBMountMutex.UnlockKey(source)

if output, err := newSMBMapping(options[0], options[1], source); err != nil {
if output, err := newSMBMapping(sensitiveOptions[0], sensitiveOptions[1], source); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Nothing in the documentation indicates the order or distribution between options/sensitiveOptions is important... assuming a particular option will be in one or the other is fairly fragile. This was raised in #138 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

given the order and distribution of options is important here, I would expect something more like this:

allOptions := []string{}
allOptions = append(allOptions, options...)
allOptions = append(allOptions, sensitiveOptions...)
if len(allOptions) < 2 {
...
}
...
if output, err := newSMBMapping(allOptions[0], allOptions[1], source); err != nil {
...
}

and to document that sensitiveOptions are always placed after options

Copy link
Member

Choose a reason for hiding this comment

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

(and don't log the content of allOptions anywhere, since it can contain sensitive options)

Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to have a map and search for specific option keys rather than assuming the options are passed in a specific order?

Copy link
Member

Choose a reason for hiding this comment

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

iiuc, these options don't have identifying keys

Copy link
Member

Choose a reason for hiding this comment

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

they appear to be passed in the form "user=abc", "password=abc", so we could at least try to parse and search for the correct option?

@liggitt
Copy link
Member

liggitt commented Mar 20, 2020

was there a presubmit job that could have been run against kubernetes/kubernetes#88684 to catch this before merge?

mount/mount_windows.go Outdated Show resolved Hide resolved
@alejandrox1
Copy link

/kind bug
/priority critical-urgent
/milestone v1.18

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Mar 20, 2020
@mboersma
Copy link
Contributor Author

Thanks for the comments on this hasty PR. I'll make changes and re-test locally.

We think reverting just the azure_file.go changes in kubernetes/kubernetes#88684 would be a safer approach, and buy more time to fix this cleanly and to add unit tests.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 20, 2020
@liggitt
Copy link
Member

liggitt commented Mar 20, 2020

/lgtm
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 20, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2020
@liggitt
Copy link
Member

liggitt commented Mar 20, 2020

go ahead and squash to a single commit

@mboersma mboersma force-pushed the fix-windows-mount-sensitive branch from cad438f to 9162b39 Compare March 20, 2020 19:08
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2020
@liggitt
Copy link
Member

liggitt commented Mar 20, 2020

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 20, 2020
Copy link

@kkmsft kkmsft left a comment

Choose a reason for hiding this comment

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

/lgtm

@kkmsft
Copy link

kkmsft commented Mar 20, 2020

/assign @jingxu97
/cc @saad-ali @jsafrane

@k8s-ci-robot
Copy link
Contributor

@kkmsft: GitHub didn't allow me to request PR reviews from the following users: other, in, list, -, the.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/assign @jingxu97
/cc the other approvers in the list - @saad-ali @jsafrane

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.

@saad-ali
Copy link
Member

/assign

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.

Thanks for fixing this.

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, kkmsft, liggitt, mboersma, saad-ali

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 20, 2020
@k8s-ci-robot k8s-ci-robot merged commit 4a6ff03 into kubernetes:master Mar 20, 2020
@mboersma mboersma deleted the fix-windows-mount-sensitive branch March 20, 2020 21:32
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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants