Skip to content

Commit 398777f

Browse files
committed
ignore kubeclient nil in csi plugin init
1 parent 8b97e2a commit 398777f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pkg/volume/csi/csi_plugin.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,14 @@ func (p *csiPlugin) Init(host volume.VolumeHost) error {
207207
if utilfeature.DefaultFeatureGate.Enabled(features.CSIDriverRegistry) {
208208
csiClient := host.GetKubeClient()
209209
if csiClient == nil {
210-
return errors.New("unable to get Kubernetes client")
210+
klog.Warning(log("kubeclient not set, assuming standalone kubelet"))
211+
} else {
212+
// Start informer for CSIDrivers.
213+
factory := csiapiinformer.NewSharedInformerFactory(csiClient, csiResyncPeriod)
214+
p.csiDriverInformer = factory.Storage().V1beta1().CSIDrivers()
215+
p.csiDriverLister = p.csiDriverInformer.Lister()
216+
go factory.Start(wait.NeverStop)
211217
}
212-
// Start informer for CSIDrivers.
213-
factory := csiapiinformer.NewSharedInformerFactory(csiClient, csiResyncPeriod)
214-
p.csiDriverInformer = factory.Storage().V1beta1().CSIDrivers()
215-
p.csiDriverLister = p.csiDriverInformer.Lister()
216-
go factory.Start(wait.NeverStop)
217218
}
218219

219220
// Initializing the label management channels

0 commit comments

Comments
 (0)