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

CSI: remove global vars #74966

Closed
wants to merge 1 commit into from
Closed

CSI: remove global vars #74966

wants to merge 1 commit into from

Conversation

hoegaarden
Copy link
Contributor

@hoegaarden hoegaarden commented Mar 5, 2019

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:

  • 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 & kubelet 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.

Release notes

NONE

/assign @vladimirvivien

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Mar 5, 2019
@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/kubelet sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/node Categorizes an issue or PR as relevant to SIG Node. 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 Mar 5, 2019
@hoegaarden
Copy link
Contributor Author

/test pull-kubernetes-integration

@hoegaarden
Copy link
Contributor Author

/milestone v1.15

@k8s-ci-robot k8s-ci-robot added this to the v1.15 milestone Mar 5, 2019
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 9, 2019
@hoegaarden
Copy link
Contributor Author

/test pull-kubernetes-e2e-gce
boskos seems to have issues

@hoegaarden
Copy link
Contributor Author

/test pull-kubernetes-kubemark-e2e-gce-big

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 31, 2019
@hoegaarden
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 7, 2019
@hoegaarden hoegaarden changed the title CSI: remove the singleton CSI: remove global vars Apr 8, 2019
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 8, 2019
@hoegaarden
Copy link
Contributor Author

/retest

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

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?

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

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.

@derekwaynecarr derekwaynecarr removed their assignment Jan 28, 2020
@derekwaynecarr
Copy link
Member

defer to @tallclair for final review

@jtslear
Copy link

jtslear commented Feb 12, 2020

Hello, @hoegaarden, @cheftako, and @sjpotter
Bug Triage team here for the 1.18 release. This is a friendly reminder that code freeze is scheduled for 5 March. Is this PR still intended for milestone 1.18? It looks like we are awaiting reviews and there are some conflicting files.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 12, 2020
@jtslear
Copy link

jtslear commented Feb 28, 2020

Hello, @hoegaarden, @tallclair
Bug Triage team here for the 1.18 release. This is a friendly reminder that code freeze is scheduled for 5 March. Is this PR still intended for milestone 1.18? There hasn't been any movement on this since the end of January. We are pending reviews, and conflicts.

cc @kubernetes/sig-apps-pr-reviews, @kubernetes/sig-node-pr-reviews, @kubernetes/sig-storage-pr-reviews

@jtslear
Copy link

jtslear commented Mar 5, 2020

With no response during the course of this release, I'm going to clear the milestone tracking of this PR.

/milestone clear

@k8s-ci-robot k8s-ci-robot removed this from the v1.18 milestone Mar 5, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 3, 2020
@cheftako
Copy link
Member

Are we still trying to merge this or should we just close it?

@hoegaarden
Copy link
Contributor Author

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

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 27, 2020
@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 27, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hoegaarden, jsafrane
To complete the pull request process, please assign vishh, wojtek-t
You can assign the PR to them by writing /assign @vishh @wojtek-t in a comment when ready.

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

@k8s-ci-robot k8s-ci-robot added the sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. label Jul 27, 2020
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.
@hoegaarden
Copy link
Contributor Author

/retest

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Oct 27, 2020
@k8s-ci-robot
Copy link
Contributor

@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.

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 26, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet