diff --git a/cmd/csi-snapshotter/main.go b/cmd/csi-snapshotter/main.go index df1b11663..8454fc09d 100644 --- a/cmd/csi-snapshotter/main.go +++ b/cmd/csi-snapshotter/main.go @@ -97,6 +97,10 @@ func main() { klog.Warning("--snapshotter is deprecated and will have no effect") } + if len(*snapshotNamePrefix) == 0 { + klog.Error("Snapshot name prefix cannot be of length 0") + os.Exit(1) + } // Create the client config. Use kubeconfig if given, otherwise assume in-cluster. config, err := buildConfig(*kubeconfig) if err != nil { @@ -173,11 +177,6 @@ func main() { os.Exit(1) } - if len(*snapshotNamePrefix) == 0 { - klog.Error("Snapshot name prefix cannot be of length 0") - os.Exit(1) - } - klog.V(2).Infof("Start NewCSISnapshotController with snapshotter [%s] kubeconfig [%s] csiTimeout [%+v] csiAddress [%s] createSnapshotContentRetryCount [%d] createSnapshotContentInterval [%+v] resyncPeriod [%+v] snapshotNamePrefix [%s] snapshotNameUUIDLength [%d]", *snapshotterName, *kubeconfig, *csiTimeout, *csiAddress, createSnapshotContentRetryCount, *createSnapshotContentInterval, *resyncPeriod, *snapshotNamePrefix, snapshotNameUUIDLength) snapShotter := snapshotter.NewSnapshotter(csiConn)