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

allow running the CSI controller outside DigitalOcean infrastructure #400

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thojkooi
Copy link

@thojkooi thojkooi commented Nov 7, 2021

When running the CSI controller outside DO, it will still attempt to contact the metadata service due to it attempting to collect the droplet ID.

When running in controller mode, it will ignore the error from DropletID(). With this change, it fixes the "Controller only mode not in DigitalOcean" mentioned in the README file.

I could not find any references to hostID() except for some node related logic, which from what I could tell is not called when running in controller mode.

Signed-off-by: Thomas Kooi [email protected]

When running the CSI controller outside DO, it will still attempt to contact the metadata service due to it attempting to collect the droplet ID.

When running in controller mode, it will ignore the error from DropletID(). With this change, it fixes the "Controller only mode not in DigitalOcean" mentioned in the README file.

Signed-off-by: Thomas Kooi <[email protected]>
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.

Sorry for the super late review, but here it is finally.

I left one suggestion and a question with regards to the modified code.

I'd also suggest we conditionally set the "host_id" log field here depending on whether hostID is empty or not. That way, we don't log a field with an empty value when the controller is running outside of a DO droplet.

hostIDInt, err := mdClient.DropletID()
if err != nil {
if !isController && err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could make this check slightly more robust by verifying that we run in controller-only mode (per the definition in the README), i.e., by checking that the token and region flag (prior to setting the variable through the metadata service) are set. This rules out the case where we run in mixed controller/node mode on a DO droplet and should be able to retrieve the droplet ID but won't due to a transient error.

region: region,
mounter: newMounter(log),
log: log,
// we're assuming only the controller has a non-empty token.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I fully understand why this comment was removed. I think it's still true that controllers must have a valid token? Or is this removed in reference to the mixed controller/node mode?

Copy link
Author

Choose a reason for hiding this comment

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

The comment was moved to the variable assignment for isController. Since it's a variable I think it's no longer relevant on this line, but only earlier where we actually make that assumption.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah sorry, totally missed the move. Makes complete sense. 👍

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