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
CSI: remove global vars #74966
CSI: remove global vars #74966
Conversation
/test pull-kubernetes-integration |
/milestone v1.15 |
/test pull-kubernetes-e2e-gce |
/test pull-kubernetes-kubemark-e2e-gce-big |
/retest |
/retest |
pkg/kubelet/kubelet.go
Outdated
// Adding Registration Callback function for CSI Driver | ||
kl.pluginManager.AddHandler(pluginwatcherapi.CSIPlugin, plugincache.PluginHandler(csi.PluginHandler)) | ||
if err := kl.registerCSIPluginHandler(); err != nil { | ||
kl.recorder.Eventf(kl.nodeRef, v1.EventTypeWarning, events.KubeletSetupFailed, err.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.
Is this a synchronous call, or is it possible that for the following fatal call to happen before the event is sent to the apiserver?
pkg/kubelet/kubelet.go
Outdated
kl.pluginManager.AddHandler(pluginwatcherapi.CSIPlugin, plugincache.PluginHandler(csi.PluginHandler)) | ||
if err := kl.registerCSIPluginHandler(); err != nil { | ||
kl.recorder.Eventf(kl.nodeRef, v1.EventTypeWarning, events.KubeletSetupFailed, err.Error()) | ||
klog.Fatalf("failed to register CSI Plugin Handler. err: %v", err) |
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.
Under what circumstances would an error occur here? Adding a Fatal
call in the kubelet startup path makes me nervous.
defer to @tallclair for final review |
Hello, @hoegaarden, @cheftako, and @sjpotter |
Hello, @hoegaarden, @tallclair cc @kubernetes/sig-apps-pr-reviews, @kubernetes/sig-node-pr-reviews, @kubernetes/sig-storage-pr-reviews |
With no response during the course of this release, I'm going to clear the milestone tracking of this PR. /milestone clear |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Are we still trying to merge this or should we just close it? |
I think I have more bandwidth again to look into that. I have no idea what happened in the CSI world in the last months, so I will check if I can rebase it or close it otherwise. /remove-lifecycle stale |
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: hoegaarden, jsafrane The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This commit removes global state in the variables - `csi.csiDrivers` - `csi.nim` - `csi.PluginHandler` The CSI plugin struct now holds the methods to implement a volume plugin and a plugin handler. The state formerly held in the package global variables now has been moved into this struct, too. Therefore, any instance of the CSI plugin now is completely indipendent and does not share anything with any other instance. Because the CSI plugin is a very special plugin, the volume plugin manager knows some specifics about it: it has a method to specifically get hold of the plugin and return its plugin handler aspect. This is used by the kubelet to register this plugin handler with its plugin watcher without the need to know specifics about the CSI plugin, all those are handled in the volume plugin manager. Additional notes: - If the plugin handler cannot be registered at the start of the kubelet we retry the registration every 10 secs in the background. For each failed registration attempt we generate a log message and an event - Because the the kubelet fails to start now if the CSI plugin cannot be found, a CSI plugin now also needs to be registered for kubemark's hollow kubelet. We use a faked plugin here. - The fake implementations (for the plugin manager & kubelete watchable volume plugin) have been automatically generated by `counterfeiter` and can therefore be updated automatically. - To break an import cycle (the CSI plugin imports the volume plugin, now that the volume plugin manager needs to query for the CSI plugin, it in turn imports the CSI plugin -> import cycle) we've split out the const for the plugin name into its own package. This pacakge can be imported by all packages in question: the volume & the csi package.
/retest |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@hoegaarden: PR needs rebase. 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. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closed this PR. 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. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This commit removes global state in the variables
csi.csiDrivers
csi.nim
csi.PluginHandler
The CSI plugin struct now holds the methods to implement a volume plugin
and a plugin handler. The state formerly held in the package
global variables now has been moved into this struct, too.
Therefore, any instance of the CSI plugin now is completely indipendent
and does not share anything with any other instance.
Because the CSI plugin is a very special plugin, the volume plugin
manager knows some specifics about is: it has a method to specifically
get hold of the plugin and return its plugin handler aspect.
This is used by the kubelet to register this plugin handler with its
plugin watcher without the need to know specifics about the CSI plugin,
all those are handled in the volume plugin manager.
Additional notes:
plugin cannot be found, a CSI plugin now also needs to be registered
for kubemark's hollow kubelet. We use a faked plugin here.
volume plugin) have been automatically generated by
counterfeiter
andcan therefore be updated automatically.
now that the volume plugin manager needs to query for the CSI plugin,
it in turn imports the CSI plugin -> import cycle) we've split out the
const for the plugin name into its own package. This pacakge can be
imported by all packages in question: the volume & the csi package.
Release notes
/assign @vladimirvivien