Skip to content

Commit

Permalink
add flag to enable the node check
Browse files Browse the repository at this point in the history
  • Loading branch information
jsanda committed Oct 9, 2019
1 parent a997d23 commit 7f071c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/csi-provisioner/csi-provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ var (
leaderElectionType = flag.String("leader-election-type", "endpoints", "the type of leader election, options are 'endpoints' (default) or 'leases' (strongly recommended). The 'endpoints' option is deprecated in favor of 'leases'.")
leaderElectionNamespace = flag.String("leader-election-namespace", "", "Namespace where the leader election resource lives. Defaults to the pod namespace if not set.")
strictTopology = flag.Bool("strict-topology", false, "Passes only selected node topology to CreateVolume Request, unlike default behavior of passing aggregated cluster topologies that match with topology keys of the selected node.")
enableNodeCheck = flag.Bool("enable-node-check", false, "Enables a check to see that the node selected by the scheduler for provisioning is this node.")

featureGates map[string]bool
provisionController *controller.ProvisionController
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (p *csiProvisioner) ProvisionExt(options controller.ProvisionOptions) (*v1.
}
}

if options.SelectedNode.Name != os.Getenv("NODE_NAME") {
if p.enableNodeCheck && options.SelectedNode.Name != os.Getenv("NODE_NAME") {
return nil, controller.ProvisioningNoChange, &controller.IgnoredError{
Reason: fmt.Sprintf("Selected node (%s) is not current node (%s)", options.SelectedNode.Name, os.Getenv("NODE_NAME")),
}
Expand Down

0 comments on commit 7f071c5

Please sign in to comment.