<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 29, 2021 at 11:24 AM Gorka Eguileor <<a href="mailto:geguileo@redhat.com">geguileo@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 28/01, Lance Bragstad wrote:<br>
> Hey folks,<br>
><br>
> As I'm sure some of the cinder folks are aware, I'm updating cinder<br>
> policies to include support for some default personas keystone ships with.<br>
> Some of those personas use system-scope (e.g., system-reader and<br>
> system-admin) and I've already proposed a series of patches that describe<br>
> what those changes look like from a policy perspective [0].<br>
><br>
> The question now is how we test those changes. To help guide that decision,<br>
> I worked on three different testing approaches. The first was to continue<br>
> testing policy using unit tests in cinder with mocked context objects. The<br>
> second was to use DDT with keystonemiddleware mocked to remove a dependency<br>
> on keystone. The third also used DDT, but included changes to update<br>
> NoAuthMiddleware so that it wasn't as opinionated about authentication or<br>
> authorization. I brought each approach in the cinder meeting this week<br>
> where we discussed a fourth approach, doing everything in tempest. I<br>
> summarized all of this in an etherpad [1]<br>
><br>
> Up to yesterday morning, the only approach I hadn't tinkered with manually<br>
> was tempest. I spent some time today figuring that out, resulting in a<br>
> patch to cinderlib [2] to enable a protection test job, and<br>
> cinder_tempest_plugin [3] that adds the plumbing and some example tests.<br>
><br>
> In the process of implementing support for tempest testing, I noticed that<br>
> service catalogs for system-scoped tokens don't contain cinder endpoints<br>
> [4]. This is because the cinder endpoint contains endpoint templating in<br>
> the URL [5], which keystone will substitute with the project ID of the<br>
> token, if and only if the catalog is built for a project-scoped token.<br>
> System and domain-scoped tokens do not have a reasonable project ID to use<br>
> in this case, so the templating is skipped, resulting in a cinder service<br>
> in the catalog without endpoints [6].<br>
><br>
> This cascades in the client, specifically tempest's volume client, because<br>
> it can't find a suitable endpoint for request to the volume service [7].<br>
><br>
> Initially, my testing approaches were to provide examples for cinder<br>
> developers to assess the viability of each approach before committing to a<br>
> protection testing strategy. But, the tempest approach highlighted a larger<br>
> issue for how we integrate system-scope support into cinder because of the<br>
> assumption there will always be a project ID in the path (for the majority<br>
> of the cinder API). I can think of two ways to approach the problem, but<br>
> I'm hoping others have more.<br>
><br>
<br>
Hi Lance,<br>
<br>
Sorry to hear that the Cinder is giving you such trouble.<br></blockquote><div><br></div><div>No worries - I think these types of issues just come with the territory when we're trying to make such large changes across different projects and APIs. :)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> First, we remove project IDs from cinder's API path.<br>
><br>
> This would be similar to how nova (and I assume other services) moved away<br>
> from project-specific URLs (e.g., /v3/%{project_id}s/volumes would become<br>
> /v3/volumes). This would obviously require refactoring to remove any<br>
> assumptions cinder has about project IDs being supplied on the request<br>
> path. But, this would force all authorization information to come from the<br>
> context object. Once a deployer removes the endpoint URL templating, the<br>
> endpoints will populate in the cinder entry of the service catalog. Brian's<br>
> been helping me understand this and we're unsure if this is something we<br>
> could even do with a microversion. I think nova did it moving from /v2/ to<br>
> /v2.0/, which was technically classified as a major bump? This feels like a<br>
> moon shot.<br>
><br>
<br>
In my opinion such a change should not be treated as a microversion and<br>
would require us to go into v4, which is not something that is feasible<br>
in the short term.<br>
<br>
<br>
> Second, we update cinder's clients, including tempest, to put the project<br>
> ID on the URL.<br>
><br>
> After we update the clients to append the project ID for cinder endpoints,<br>
> we should be able to remove the URL templating in keystone, allowing cinder<br>
> endpoints to appear in system-scoped service catalogs (just like the first<br>
> approach). Clients can use the base URL from the catalog and append the<br>
<br>
I'm not familiar with keystone catalog entries, so maybe I'm saying<br>
something stupid, but couldn't we have multiple entries?  A<br>
project-specific URL and another one for the project and system scoped<br>
requests?<br>
<br>
I know it sounds kind of hackish, but if we add them in the right order,<br>
first the project one and then the new one, it would probably be<br>
backward compatible, as older clients would get the first endpoint and<br>
new clients would be able to select the right one.<br></blockquote><div><br></div><div>I think that's an option.</div><div><br></div><div>For example, if I add a fourth cinder service to my catalog without project ID templating in the endpoint URL [0], my system-scoped token contains endpoints for that cinder service [1]. Project-scoped tokens contain all four cinder services, and each service has endpoints populated since URL templating works with project IDs [2].<br></div><div> </div><div>So, maybe the question becomes, what should the service type and name be for this new entry? I think the cinder clients would need to know this new service is a actually a cinder endpoint without the project ID in the URL. It'll also need to know it's on the hook for appending a project ID to the URL.<br></div><div><br></div><div>[0] <a href="http://paste.openstack.org/show/802148/">http://paste.openstack.org/show/802148/</a></div><div>[1] <a href="http://paste.openstack.org/show/802145/">http://paste.openstack.org/show/802145/</a> (lines 66 - 78)<br></div><div>[2] <a href="http://paste.openstack.org/show/802149/">http://paste.openstack.org/show/802149/</a></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> admin project ID before putting the request on the wire. Even though the<br>
> request has a project ID in the path, cinder would ignore it for<br>
> system-specific APIs. This is already true for users with an admin role on<br>
> a project because cinder will allow you to get volumes in one project if<br>
> you have a token scoped to another with the admin role [8]. One potential<br>
> side-effect is that cinder clients would need *a* project ID to build a<br>
> request, potentially requiring another roundtrip to keystone.<br>
<br>
What would happen in this additional roundtrip? Would we be converting<br>
provided project's name into its UUID?<br></blockquote><div><br></div><div>If cinder always assumes and validates a project_id exists in the URL path, then clients making requests, regardless of the scope (system, domain, or project), will need to find a project to use, or use a fake project.</div><div><br></div><div>And I think the answer to that depends on how cinder wants to handle that validation in the API. I believe this is where that's handled now [3].<br></div><div><br></div><div>If the client sends a request with a system-scoped token in the X-Auth-Token header, cinder could detect that and ignore whatever the project ID is from the path. So maybe it can be fake? At least until we figure out if we can version the API to introduce a project-less URL path?<br></div><div> </div><div>[3] <a href="https://opendev.org/openstack/cinder/src/commit/500f5100c8531b4995537c4952382fed3b0e2c8c/cinder/api/openstack/wsgi.py">https://opendev.org/openstack/cinder/src/commit/500f5100c8531b4995537c4952382fed3b0e2c8c/cinder/api/openstack/wsgi.py</a></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
If that's the case then it wouldn't happen when UUIDs are being<br>
provided, so for cases where this extra request means a performance<br>
problem they could just provide the UUID.<br>
<br>
><br>
> Thoughts?<br>
<br>
Truth is that I would love to see the Cinder API move into URLs without<br>
the project id as well as move out everything from contrib, but that<br>
doesn't seem like a realistic piece of work we can bite right now.<br>
<br>
So I think your second proposal is the way to go.<br>
<br>
Thanks for all the work you are putting into this.<br>
<br>
Cheers,<br>
Gorka.<br>
<br>
<br>
><br>
> [0] <a href="https://review.opendev.org/q/project:openstack/cinder+topic:secure-rbac" rel="noreferrer" target="_blank">https://review.opendev.org/q/project:openstack/cinder+topic:secure-rbac</a><br>
> [1] <a href="https://etherpad.opendev.org/p/cinder-secure-rbac-protection-testing" rel="noreferrer" target="_blank">https://etherpad.opendev.org/p/cinder-secure-rbac-protection-testing</a><br>
> [2] <a href="https://review.opendev.org/c/openstack/cinderlib/+/772770" rel="noreferrer" target="_blank">https://review.opendev.org/c/openstack/cinderlib/+/772770</a><br>
> [3] <a href="https://review.opendev.org/c/openstack/cinder-tempest-plugin/+/772915" rel="noreferrer" target="_blank">https://review.opendev.org/c/openstack/cinder-tempest-plugin/+/772915</a><br>
> [4] <a href="http://paste.openstack.org/show/802117/" rel="noreferrer" target="_blank">http://paste.openstack.org/show/802117/</a><br>
> [5] <a href="http://paste.openstack.org/show/802097/" rel="noreferrer" target="_blank">http://paste.openstack.org/show/802097/</a><br>
> [6]<br>
> <a href="https://opendev.org/openstack/keystone/src/commit/c239cc66615b41a0c09e031b3e268c82678bac12/keystone/catalog/backends/sql.py" rel="noreferrer" target="_blank">https://opendev.org/openstack/keystone/src/commit/c239cc66615b41a0c09e031b3e268c82678bac12/keystone/catalog/backends/sql.py</a><br>
> [7] <a href="http://paste.openstack.org/show/802092/" rel="noreferrer" target="_blank">http://paste.openstack.org/show/802092/</a><br>
> [8] <a href="http://paste.openstack.org/show/802118/" rel="noreferrer" target="_blank">http://paste.openstack.org/show/802118/</a><br>
<br>
</blockquote></div></div>