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

driver: don't check limits on worker nodes #142

Merged
merged 2 commits into from
Apr 19, 2019
Merged

Conversation

fatih
Copy link
Contributor

@fatih fatih commented Apr 19, 2019

We're checking the volume limit during the driver startup. However
because the driver is used both for the controller and node part, it
fails during the node startup because we're deploying the driver to the
nodes without a token. The DO token is only needed by the controller.

The checkLimit() function would therefore print when deployed to the
nodes:

time="2019-01-14T20:13:52Z" level=warning msg="CSI plugin will not
function correctly, please resolve volume limit" error="rpc error: code
= Internal desc = couldn't get account information to check volume
limit: GET https://api.digitalocean.com/v2/account: 401 Unable to
authenticate you."

This PR fixes that to not to call checkLimit if the token is not
passed, which is a valid case for drivers deployed to the worker nodes.

supersedes #127

We're checking the volume limit during the driver startup. However
because the driver is used both for the controller and node part, it
fails during the node startup because we're deploying the driver to the
nodes without a token. The DO token is only needed by the controller.

The `checkLimit()` function would therefore print when deployed to the
nodes:

```
time="2019-01-14T20:13:52Z" level=warning msg="CSI plugin will not
function correctly, please resolve volume limit" error="rpc error: code
= Internal desc = couldn't get account information to check volume
limit: GET https://api.digitalocean.com/v2/account: 401 Unable to
authenticate you."
```

This PR fixes that to not to call `checkLimit` if the token is not
passed, which is a valid case for drivers deployed to the worker nodes.

supersedes #127
Copy link
Contributor

@timoreimann timoreimann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one optional suggestion.

driver/driver.go Outdated
@@ -58,6 +58,7 @@ type Driver struct {
nodeId string
region string
doTag string
hasToken bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about calling this isController? I think that would make the code a bit easier to understand and reduce the degree of comments we need below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense, pushed some updates. I'll squash afterwards 👍

@fatih fatih merged commit 1a7d9bd into master Apr 19, 2019
@fatih fatih deleted the check-limit-only-with-token branch April 25, 2019 13:23
jcodybaker pushed a commit that referenced this pull request Apr 25, 2019
jcodybaker pushed a commit that referenced this pull request Apr 26, 2019
jcodybaker added a commit that referenced this pull request Apr 26, 2019
* Cherry-pick: Add tagging support for Volumes via the new `--do-tag` flag
  [[GH-130]](#130)
* Cherry-pick: Fix support for volume snapshots by setting snapshot id on volume creation
  [[GH-129]](#129)
* Cherry-pick: Goreportcard fixes (typos, exported variables, etc..)
  [[GH-121]](#121)
* Cherry-pick: Rename the cluster role bindings for the `node-driver-registrar` to be
  consistent with the other role bindings.
  [[GH-118]](#118)
* Cherry-pick: Remove the `--token` flag for the `csi-do-node` driver. Drivers running on
  the node don't need the token anymore.
  [[GH-118]](#118)
* Cherry-pick: Don't check the volume limits on the worker nodes (worker nodes are not able
  to talk to DigitalOcean API)
  [[GH-142]](#142)
* Cherry-pick: Update `godo` (DigitalOcean API package) version to v1.13.0
  [[GH-143]](#143)
* Cherry-pick: Fix race in snapshot integration test.
  [[GH-146]](#146)
* Cherry-pick: Add tagging support for Volume snapshots via the new `--do-tag` flag
  [[GH-145]](#145)
jcodybaker added a commit that referenced this pull request Apr 26, 2019
* Cherry-pick: Add tagging support for Volumes via the new `--do-tag` flag
  [[GH-130]](#130)
* Cherry-pick: Fix support for volume snapshots by setting snapshot id on volume creation
  [[GH-129]](#129)
* Cherry-pick: Goreportcard fixes (typos, exported variables, etc..)
  [[GH-121]](#121)
* Cherry-pick: Rename the cluster role bindings for the `node-driver-registrar` to be
  consistent with the other role bindings.
  [[GH-118]](#118)
* Cherry-pick: Remove the `--token` flag for the `csi-do-node` driver. Drivers running on
  the node don't need the token anymore.
  [[GH-118]](#118)
* Cherry-pick: Don't check the volume limits on the worker nodes (worker nodes are not able
  to talk to DigitalOcean API)
  [[GH-142]](#142)
* Cherry-pick: Update `godo` (DigitalOcean API package) version to v1.13.0
  [[GH-143]](#143)
* Cherry-pick: Fix race in snapshot integration test.
  [[GH-146]](#146)
* Cherry-pick: Add tagging support for Volume snapshots via the new `--do-tag` flag
  [[GH-145]](#145)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants