worker-manager: delegate gcp instaces.insert validation to gcp
Categories
(Taskcluster :: Services, enhancement)
Tracking
(Not tracked)
People
(Reporter: pmoore, Assigned: bstack)
Details
For example, displayDevice is a request body parameter of the google cloud instances.insert API.
It is useful for generic-worker both on Linux and Windows, but is currently unavailable to worker-manager workers since it is not whitelisted in the gcp instance schema.
I think it would be reasonable to either allow all gcp instances.insert request body properties (with an automatic procedure to routinely update config-google.yml) or to not place any schema restrictions at all in taskcluster, and simply surface instance launch failures to users.
The issues I see with taskcluster imposing its own schema restrictions are:
- It makes worker-manager a gatekeeper to API changes, effectively blocking potentially interesting and useful features to users (including new gcp features that appear overnight)
- It adds maintenance overhead to worker-manager, such that we need to track changes to google's schema, and reflect them in our own schema, including rolling out new releases
- It redundantly duplicates the validation logic of google's instances.insert endpoint
I would therefore advocate not placing schema restrictions, but instead deferring input validation to gcp, and surfacing any failures to users, and pointing users to gcp docs where needed.
If there are specific properties we need to block, e.g. for security/financial reasons, perhaps we can achieve this instead with google account access controls, or worst case, with a blacklist of properties, rather than a whitelist.
We had a similar situation in taskcluster-client-go, where the client validated user credentials before calling taskcluster endpoints. Since the client validation was duplicated in two places, whenever changes were made to credential validation, both the auth service and taskcluster-client-go needed to be updated, potentially getting out-of-sync, and adding little value. So we scrapped taskcluster client validation in the clients, and left it to the auth service. Since auth failures surface in the client, the user would already get feedback if the client was invalid. This gave us some freedom to evolve the client validation (changing clientId length, allowed chars, etc) without having to update all clients and code that imported those clients.
I see this as a similar situation that doesn't benefit from having duplicated restrictions. By removing the restrictions on the taskcluster side, delegating the validation to gcp but surfacing failures, worker-manager has fewer concerns to manage, exposes more gcp features to users, and is more agile to operate (since platform updates aren't needed when there are gcp schema changes).
Let me know if you agree! :-)
| Reporter | ||
Updated•7 years ago
|
Comment 1•7 years ago
|
||
(In reply to Pete Moore [:pmoore][:pete] from comment #0)
If there are specific properties we need to block, e.g. for security/financial reasons, perhaps we can achieve this instead with google account access controls, or worst case, with a blacklist of properties, rather than a whitelist.
That's what I do in aws provider - I have a couple of blacklisted properties, and that's it. As I was experimenting with a different aws api for launching instances last week, I do confirm that it wasn't hard to make that change - I didn't have to touch the schema at all.
I basically agree with your argument, Pete
| Assignee | ||
Comment 2•7 years ago
|
||
ok, this seems like the best plan going forward. I can maybe go over the instance insert options with aj to see if any are scary.
| Reporter | ||
Comment 3•7 years ago
•
|
||
I should call out the one drawback of this approach, which is of course that the user would not get immediate feedback that there was an error in their config, only when instances are provisioned, which could happen some time later.
The "middle-ground" options I can think of are:
- We have some cron that routinely updates our json schema to reflect google's latest schema
- We warn the user (somehow) if their config does not match our schema, but allow it anyway
- When a config is submitted, we swallow the cost of spawning a single instance, ensuring the call works, and then deleting the instance. Perhaps for an extremely minimal cost (a few seconds of compute time) we then know if the config is valid or not without needing to manage schemas, and still can provide immediate feedback to the user when they create/update a workerpool definition.
The advantage of the above options is that the user gets immediate feedback which without a schema, they wouldn't have (only at instance launch time).
It's hard to know which is the best solution, I tend to lean towards the last option above as it seems to me the best balance between not tying a release to a static version of an external schema that can change at any time, but at the same time providing immediate feedback if a submitted config is invalid. But it does come at the cost of a couple of seconds of extra compute time per API request.
Comment 4•7 years ago
|
||
I suspect the delayed effect is OK. Let's look at how to solve that issue if it becomes a problem for users.
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 5•7 years ago
|
||
Done! Anything that we don't need to set explicitly is now allowed.
Description
•