feat(hcloud): select the location randomly from a given list#89
feat(hcloud): select the location randomly from a given list#89ebostijancic wants to merge 1 commit intoJonasProgrammer:masterfrom
Conversation
JonasProgrammer
left a comment
There was a problem hiding this comment.
Hi and first of all, thank you for the PR.
There are some minor nit-picks I could also fix myself, but I wanted to know if there is a specific design rationale behind.
In general, I have one more comment regarding the architecture: Would it be feasible to select the random location directly at configuration time (i.e. by indexing directly into the string slice) and then resolve all of the strings in the PreCreateCheck, just keeping one cachedLocation around? This should have pretty much the same effect, but the configuration will be in a specified state directly after create.
Also, without having tested it, I think that the current implementation may fail if no location is passed at all?
| cachedType *hcloud.ServerType | ||
| Location string | ||
| cachedLocation *hcloud.Location | ||
| Locations []string |
There was a problem hiding this comment.
Personally I think the final location should still be in Location, as there are some downstream projects that depend on the 'public' data of the driver.
Keeping the location pool around in a separate public field seems like the best downward-compatible solution IMHO, that would still allow downstream tools to support this option in the future.
db686cf to
13bf4f8
Compare
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hetzner cloud can run out of instances in a given location. To avoid reconfiguring the driver every time this happens, this PR implements a random location selection based on the list of whitelisted locations.