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 flexvolume volumename issue #80904

Merged

Conversation

fredkan
Copy link
Member

@fredkan fredkan commented Aug 2, 2019

Introduction:

Flexvolume GetVolumeName always calls DefaultPlugin.GetVolumeName() and return the default value.
There are huge amounts of unexpected messages in kubelet logs like:

"kubelet: W0802 19:49:27.913542    7873 plugin-defaults.go:32] flexVolume driver alicloud/disk: using default GetVolumeName for volume d-wz9cy4ofbgt2wqm04ix9"

Issues Analysis:

As the below comments, lots of messages are printed as kubelet log, and real volumename is ignored, default volumename always be the response.

// GetVolumeName is part of the volume.VolumePlugin interface.
func (plugin *flexVolumePlugin) GetVolumeName(spec *volume.Spec) (string, error) {
	call := plugin.NewDriverCall(getVolumeNameCmd)
	call.AppendSpec(spec, plugin.host, nil)

	_, err := call.Run()
	if isCmdNotSupportedErr(err) {
		return (*pluginDefaults)(plugin).GetVolumeName(spec)
	} else if err != nil {
		return "", err
	}

	// Although GetVolumeName is supported in plugin, this will always be called.
	// The expect VolumeName is ignored.
	name, err := (*pluginDefaults)(plugin).GetVolumeName(spec)
	if err != nil {
		return "", err
	}

	// Also, this warning message always be printed, which is not expected.
	klog.Warning(logPrefix(plugin), "GetVolumeName is not supported yet. Defaulting to PV or volume name: ", name)

	return name, nil
}

The unnecessary code should be removed.

release-note

None

What type of PR is this?

/kind bug
/sig storage
/priority important-soon

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Aug 2, 2019
@k8s-ci-robot
Copy link
Contributor

Hi @fredkan. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. labels Aug 2, 2019
@k8s-ci-robot k8s-ci-robot added sig/storage Categorizes an issue or PR as relevant to SIG Storage. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 2, 2019
@fredkan
Copy link
Member Author

fredkan commented Aug 2, 2019

@van4th @saad-ali Please help to review this issue.

@gnufied
Copy link
Member

gnufied commented Aug 6, 2019

/ok-to-test
/assign

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 6, 2019
@gnufied
Copy link
Member

gnufied commented Aug 6, 2019

/kind bug

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Aug 6, 2019
@xianlubird
Copy link

/ok-to-test

@fredkan
Copy link
Member Author

fredkan commented Aug 7, 2019

one testcase failed, but it seems etcd related reason.

[+]log ok
[-]etcd failed: reason withheld
[+]poststarthook/generic-apiserver-start-informers ok
[+]poststarthook/bootstrap-controller ok
[-]poststarthook/rbac/bootstrap-roles failed: reason withheld
[-]poststarthook/scheduling/bootstrap-system-priority-classes failed: reason withheld
[-]poststarthook/ca-registration failed: reason withheld
healthz check failed

@gnufied @saad-ali @ivan4th please help to view.

@gnufied
Copy link
Member

gnufied commented Aug 7, 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 Aug 7, 2019
@xing-yang
Copy link
Contributor

/test pull-kubernetes-integration

@gnufied
Copy link
Member

gnufied commented Aug 8, 2019

/assign @chakri-nelluri

@gnufied
Copy link
Member

gnufied commented Aug 8, 2019

please add a release-note to the issue and also we tend to use rebase for updating a topic branch against master (not merge).

/lgtm cancel

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 8, 2019
@k8s-ci-robot k8s-ci-robot removed the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 9, 2019
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Aug 9, 2019
@fredkan
Copy link
Member Author

fredkan commented Aug 9, 2019

History :) The volume name was supposed to be unique which was tough to be enforced on the driver side and there is no clear mapping from driver volume name to PV name. To avoid this confusion we always defaulted to default volume name.

History, we should always use the default volume name, so it is not necessary to call the plugin GetVolumeName interface.

Just remove the plugin call related code.

func (plugin *flexVolumePlugin) GetVolumeName(spec *volume.Spec) (string, error) {
call := plugin.NewDriverCall(getVolumeNameCmd)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please keep this code. Some drivers might be assuming this call and use it for periodic health checks etc and they will be broken. Please keep the change to adjust the verbosity of the log. Thanks.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it,Thanks。

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 10, 2019
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.

/approve

Will let @chakri-nelluri LGTM

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 12, 2019
@@ -134,8 +133,6 @@ func (plugin *flexVolumePlugin) GetVolumeName(spec *volume.Spec) (string, error)
return "", err
}

klog.Warning(logPrefix(plugin), "GetVolumeName is not supported yet. Defaulting to PV or volume name: ", name)
Copy link
Member

Choose a reason for hiding this comment

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

Why not reduce verbosity of this message instead of removing it altogether?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why not reduce verbosity of this message instead of removing it altogether?

There is default volumeName log in GetVolumeName:

klog.V(4).Infof(logPrefix((*flexVolumePlugin)(plugin)), "using default GetVolumeName for volume ", spec.Name())

And, the message "GetVolumeName is not supported yet. Defaulting to PV or volume name: " is not suitable here, this log will be printed out when GetVolumeName is supported by plugin.

Copy link
Contributor

Choose a reason for hiding this comment

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

@fredkan GetVolumeName is not supported on the K8S side, not on the plugin side. I would recommend to just adjust the verbosity of the logs, unless there is a big need to.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree. Thanks.

@chakri-nelluri
Copy link
Contributor

chakri-nelluri commented Aug 16, 2019

/LGTM
/approve

@fredkan fredkan force-pushed the fix-flexvolume-volumename-issue branch from 2290f5c to 96928b8 Compare August 19, 2019 02:05
@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. and removed do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 19, 2019
@fredkan fredkan force-pushed the fix-flexvolume-volumename-issue branch from e55524a to 11d83df Compare August 19, 2019 09:28
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. labels Aug 19, 2019
@xianlubird
Copy link

/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 Aug 19, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chakri-nelluri, fredkan, saad-ali, xianlubird

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

@fredkan
Copy link
Member Author

fredkan commented Aug 19, 2019

/retest

@k8s-ci-robot k8s-ci-robot merged commit 5df8781 into kubernetes:master Aug 19, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.16 milestone Aug 19, 2019
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note-none Denotes a PR that doesn't merit a release note. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants