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

etcdbackend: support version auto discovery #2299

Merged
merged 3 commits into from
Jan 26, 2017
Merged

etcdbackend: support version auto discovery #2299

merged 3 commits into from
Jan 26, 2017

Conversation

xiang90
Copy link
Contributor

@xiang90 xiang90 commented Jan 24, 2017

Rule:

when api version is not defined by user:

  1. use api 2 if server only supports api 2
  2. use api 2 if previous vault data exists in api 2
  3. use api 3 if server supports api3 and no user data exists in api 2

when api version is provided by user, always trust user.

Manually tested.

@xiang90 xiang90 changed the title Auto discovery etcdbackend: support version auto discovery Jan 24, 2017
@xiang90
Copy link
Contributor Author

xiang90 commented Jan 24, 2017

@jefferai

Hi, i do not think the CI failure is relevant to this pr.

@jefferai
Copy link
Member

Is rule #2 because you're concerned about breakages with existing data if the API level changes?

@jefferai
Copy link
Member

Also, the failure is not related to this. I made a copypasta screwup when fixing tests because of a sad interaction between Go bugs and trusty on Travis. It should be fixed if you rebase on master.

@xiang90
Copy link
Contributor Author

xiang90 commented Jan 24, 2017

Is rule #2 because you're concerned about breakages with existing data if the API level changes?

Yes, exactly.

return newEtcd3Backend(conf, logger)
default:
return nil, EtcdVersionUnknow
}
}

func getEtcdAPIVersion(c client.Client) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Comments on this function as to how the version is computed might be helpful.

if haEnabled == "" {
haEnabled = conf["ha_enabled"]
}
haEnabledBool, _ := strconv.ParseBool(haEnabled)
Copy link
Member

Choose a reason for hiding this comment

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

Can we catch the error here?

@jefferai
Copy link
Member

Agreed on Vishal's request to catch the ParseBool error (people do put strange things in config file) but after that we'll merge it.

@xiang90
Copy link
Contributor Author

xiang90 commented Jan 25, 2017

@jefferai I will clean up today or tomorrow, and ping you guys. Thanks a lot for reviewing it.

@xiang90
Copy link
Contributor Author

xiang90 commented Jan 25, 2017

@jefferai @vishalnayak fixed. PTAL!

@jefferai
Copy link
Member

👍

@jefferai jefferai added this to the 0.6.5 milestone Jan 26, 2017
@jefferai jefferai merged commit 73ad5b7 into hashicorp:master Jan 26, 2017
@xiang90 xiang90 deleted the auto_discovery branch January 26, 2017 22:26
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.

3 participants