Skip to content

Commit

Permalink
Merge pull request #142 from digitalocean/check-limit-only-with-token
Browse files Browse the repository at this point in the history
driver: don't check limits on worker nodes
  • Loading branch information
fatih authored and jcodybaker committed Apr 26, 2019
1 parent e9374a1 commit 0ffd67c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ var (
// csi.NodeServer
//
type Driver struct {
endpoint string
nodeId string
region string
doTag string
endpoint string
nodeId string
region string
doTag string
isController bool

srv *grpc.Server
log *logrus.Entry
Expand Down Expand Up @@ -114,6 +115,9 @@ func NewDriver(ep, token, url, doTag string) (*Driver, error) {
region: region,
mounter: newMounter(log),
log: log,
// for now we're assuming only the controller has a non-empty token. In
// the future we should pass an explicit flag to the driver.
isController: token != "",

storage: doClient.Storage,
storageActions: doClient.StorageActions,
Expand Down Expand Up @@ -164,9 +168,12 @@ func (d *Driver) Run() error {
}

// warn the user, it'll not propagate to the user but at least we see if
// something is wrong in the logs
if err := d.checkLimit(context.Background()); err != nil {
d.log.WithError(err).Warn("CSI plugin will not function correctly, please resolve volume limit")
// something is wrong in the logs. Only check if the driver is running with
// a token (i.e: controller)
if d.isController {
if err := d.checkLimit(context.Background()); err != nil {
d.log.WithError(err).Warn("CSI plugin will not function correctly, please resolve volume limit")
}
}

d.srv = grpc.NewServer(grpc.UnaryInterceptor(errHandler))
Expand Down

0 comments on commit 0ffd67c

Please sign in to comment.