Skip to contentSkip to conversation

RGW multi-tenancy APIs overview

DISCUSSION Pete Zaitcev 2 participants 6 messages Nov 10, 2015 – Nov 18, 2015

lore
Share & tools
lore
#0 lore raw

With ticket 5073 getting close to complete, we're getting the APIs mostly nailed down. Most of them come down to selection a syntax separator character. Unfortunately, there are several such characters. Plus, it is not always feasible to get by with a character (in S3 at least).

So far we have the following changes:

#1 Back-end and radosgw-admin use '/' or "tenant/bucket". This is what is literally stored in RADOS, because it's used to name bucket objects in the .rgw pool.

#2 Buckets in Swift URLs use '\' (backslash), because there does not seem to be a way to use '/'. Example:
http://host.corp.com:8080/swift/v1/testen\testcont

At first, I tried URL encoding (%2f), but that didn't work: we permit '%' in Swift container names, so there's a show-stopper compatibility problem. So, backslash. The backslash poses a similar problem, too, but hopefuly nobody created a container with backslash in name.

Note that strictly speaking, we don't really need this, since Swift URLs could easily include tenant names where reference Swift places account names. It's just easier to implement without disturbing authenthication code.

#3 S3 host addressing of buckets

This is similar to Swift and is slated to use backslash. Note that S3 prohibits it, so we're reasonably safe with this choice.

#4 S3 URL addressing of buckets

Here we must use a period. Example:
bucket.tenant.host.corp.com

#5 Listings and redirects.

Listings present a difficulty in S3: we don't know if the name will be used in host-based or URL-based addressing of a bucket. So, we put the tenant of a bucket into a separate XML attribute.

Since Swift listings are always in a specific account, and thus tenant, they are unchanged.

In addition to listings, bucket names leak into certain HTTP headers, where we add "Tenant:" headers as appropriate.

Finally, multi-tenancy also puts user_uid namespaces under tenants as well as bucket namespaces. That one is easy though. A '$' separator is used consistently for it (tenant$user).

-- Pete

#1 lore raw
Quoted 1 line · Pete Zaitcev

With ticket 5073 getting close to complete, we're getting the APIs mostly

Great! thanks for all the work you've done to get this closer to completion.

Quoted 14 lines

nailed down. Most of them come down to selection a syntax separator character. Unfortunately, there are several such characters. Plus, it is not always feasible to get by with a character (in S3 at least).

So far we have the following changes:

#1 Back-end and radosgw-admin use '/' or "tenant/bucket". This is what is literally stored in RADOS, because it's used to name bucket objects in the .rgw pool.

#2 Buckets in Swift URLs use '\' (backslash), because there does not seem to be a way to use '/'. Example:
http://host.corp.com:8080/swift/v1/testen\testcont

Quoted 8 lines

At first, I tried URL encoding (%2f), but that didn't work: we permit '%' in Swift container names, so there's a show-stopper compatibility problem. So, backslash. The backslash poses a similar problem, too, but hopefuly nobody created a container with backslash in name.

Note that strictly speaking, we don't really need this, since Swift URLs could easily include tenant names where reference Swift places account names. It's just easier to implement without disturbing authenthication code.

I think that leveraging the native swift URL tenant encoding is probably a cleaner solution than having it encoded as a backslash.

Quoted 11 lines

#3 S3 host addressing of buckets

This is similar to Swift and is slated to use backslash. Note that S3 prohibits it, so we're reasonably safe with this choice.

#4 S3 URL addressing of buckets

Here we must use a period. Example:
bucket.tenant.host.corp.com

Can probably identify this automatically, if the host is at a subdomain of a supported domain, and it's a second level subdomain from the main domain then we can regard it as <bucket>.<tenant>

Quoted 5 lines

#5 Listings and redirects.

Listings present a difficulty in S3: we don't know if the name will be used in host-based or URL-based addressing of a bucket. So, we put the tenant of a bucket into a separate XML attribute.

You mean a separate http header? http param?

In the supported domains configuration, we can specify for each domain whether a subdomain for it would be a bucket (as it is now), or whether it would be a tenant (which implies the possibility of bucket.tenant). This only affects the global (a.k.a the "empty") tenant.

E.g., we can have two domains:

legacy-foo.com
new-foo.com

We'd specify that legacy-foo.com is a global tenant endpoint. In which case, when accessing buck.legacy-foo.com, it will access the global tenant, and bucket=buck.
Whereas, new-foo.com isn't a global tenant endpoint, in which case, if we'd access buck.new-foo.com, it will mean that we accessed the 'buck' tenant.

Quoted 11 lines

Since Swift listings are always in a specific account, and thus tenant, they are unchanged.

In addition to listings, bucket names leak into certain HTTP headers, where we add "Tenant:" headers as appropriate.

Finally, multi-tenancy also puts user_uid namespaces under tenants as well as bucket namespaces. That one is easy though. A '$' separator is used consistently for it (tenant$user).

Does that work the same for object copy, and acls?

Thanks,
Yehuda

Quoted 1 line

-- Pete

#2 lore raw

On Mon, 9 Nov 2015 21:36:47 -0800
Yehuda Sadeh-Weinraub <[email protected]> wrote:

We discussed this a bit on RGW team meeting in BJ, and there were some developments, so for the sake of update here goes.

Quoted 3 lines
Quoted 3 lines

#1 Back-end and radosgw-admin use '/' or "tenant/bucket". This is what is literally stored in RADOS, because it's used to name bucket objects in the .rgw pool.

This works.

Quoted 10 lines
Quoted 7 lines

#2 Buckets in Swift URLs use '\' (backslash), because there does not seem to be a way to use '/'. Example:
http://host.corp.com:8080/swift/v1/testen\testcont

Note that strictly speaking, we don't really need this, since Swift URLs could easily include tenant names where reference Swift places account names. It's just easier to implement without disturbing authenthication code.

I think that leveraging the native swift URL tenant encoding is probably a cleaner solution than having it encoded as a backslash.

Indeed, I clearly took a lazy way out. Backslashes are removed from the current pull request #6358, to be replaced with the right solution through the auth.

Quoted 4 lines
Quoted 4 lines

#3 S3 host addressing of buckets

This is similar to Swift and is slated to use backslash. Note that S3 prohibits it, so we're reasonably safe with this choice.

We circled back to this in the meeting and replaced backslashes with colons, for a cleaner look.

Note that in a potentially major development, the tenant name and the colon are included into the string that is used to calculate HMAC. So, theoretically stock clients could work, by packing tenant into buckets - except if they use some kind of configuration syntax with colons. One motivation for backslash was that it could be easier to make clients to eat. This is something we ought to test and possibly tweak.

Quoted 8 lines
Quoted 4 lines

#4 S3 URL addressing of buckets

Here we must use a period. Example:
bucket.tenant.host.corp.com

Can probably identify this automatically, if the host is at a subdomain of a supported domain, and it's a second level subdomain from the main domain then we can regard it as <bucket>.<tenant>

This part suffered a major setback. And oddly enough nobody raised any objections until now. But periods are permitted in bucket names in S3. Therefore the "bucket.tenant.host.domain" thing cannot work.

I'm inclined to document this and simply tell people who want to access buckets across tenants to use URL paths per above. However...

Quoted 11 lines

In the supported domains configuration, we can specify for each domain whether a subdomain for it would be a bucket (as it is now), or whether it would be a tenant (which implies the possibility of bucket.tenant). This only affects the global (a.k.a the "empty") tenant.

E.g., we can have two domains:

legacy-foo.com
new-foo.com

Quoted 6 lines

We'd specify that legacy-foo.com is a global tenant endpoint. In which case, when accessing buck.legacy-foo.com, it will access the global tenant, and bucket=buck.
Whereas, new-foo.com isn't a global tenant endpoint, in which case, if we'd access buck.new-foo.com, it will mean that we accessed the 'buck' tenant.

Okay, that is plausible (meaning: I can make it work). This scheme has a little downside in it: these DNS domains cannot nest. In other words, corp.com cannot be migrated to tenantized-rados.corp.com. But otherwise, I don't see it can't work.

Quoted 7 lines
Quoted 5 lines

#5 Listings and redirects.

Listings present a difficulty in S3: we don't know if the name will be used in host-based or URL-based addressing of a bucket. So, we put the tenant of a bucket into a separate XML attribute.

You mean a separate http header? http param?

Not sure what that question assumed. A separate XML attribute looks like:

<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<Name>foobucket</Name>
<Tenant>footenant</Tenant> <=============== this one <IsTruncated>false</IsTruncated>

There's a certain problem with this, in case the client is constructing the URLs for further access. In case it's trying to access across tenants, it has to fetch the tenant name from the attribute. I thought about returning the bucket name as <Name>footenant:foobucket</Name> for all buckets that belong to non-empty tenant, but that seems asking for compatibility issues even for access within the tenant.

Quoted 11 lines
Quoted 9 lines

Since Swift listings are always in a specific account, and thus tenant, they are unchanged.

In addition to listings, bucket names leak into certain HTTP headers, where we add "Tenant:" headers as appropriate.

Finally, multi-tenancy also puts user_uid namespaces under tenants as well as bucket namespaces. That one is easy though. A '$' separator is used consistently for it (tenant$user).

Does that work the same for object copy, and acls?

ACLs do not list buckets, only users, which may be qualified (tenant$user). COPY verbs use colons in S3. Fortunately there's no additional complication with HMAC. In Swift, currently, all that support is removed together with the backslash and is waiting for "new" URLs.

-- Pete

#3 lore raw
Quoted 96 lines · Pete Zaitcev

On Mon, 9 Nov 2015 21:36:47 -0800
Yehuda Sadeh-Weinraub <[email protected]> wrote:

We discussed this a bit on RGW team meeting in BJ, and there were some developments, so for the sake of update here goes.

Quoted 3 lines
Quoted 3 lines

#1 Back-end and radosgw-admin use '/' or "tenant/bucket". This is what is literally stored in RADOS, because it's used to name bucket objects in the .rgw pool.

This works.

Quoted 10 lines
Quoted 7 lines

#2 Buckets in Swift URLs use '\' (backslash), because there does not seem to be a way to use '/'. Example:
http://host.corp.com:8080/swift/v1/testen\testcont

Note that strictly speaking, we don't really need this, since Swift URLs could easily include tenant names where reference Swift places account names. It's just easier to implement without disturbing authenthication code.

I think that leveraging the native swift URL tenant encoding is probably a cleaner solution than having it encoded as a backslash.

Indeed, I clearly took a lazy way out. Backslashes are removed from the current pull request #6358, to be replaced with the right solution through the auth.

Quoted 4 lines
Quoted 4 lines

#3 S3 host addressing of buckets

This is similar to Swift and is slated to use backslash. Note that S3 prohibits it, so we're reasonably safe with this choice.

We circled back to this in the meeting and replaced backslashes with colons, for a cleaner look.

Note that in a potentially major development, the tenant name and the colon are included into the string that is used to calculate HMAC. So, theoretically stock clients could work, by packing tenant into buckets - except if they use some kind of configuration syntax with colons. One motivation for backslash was that it could be easier to make clients to eat. This is something we ought to test and possibly tweak.

Quoted 8 lines
Quoted 4 lines

#4 S3 URL addressing of buckets

Here we must use a period. Example:
bucket.tenant.host.corp.com

Can probably identify this automatically, if the host is at a subdomain of a supported domain, and it's a second level subdomain from the main domain then we can regard it as <bucket>.<tenant>

This part suffered a major setback. And oddly enough nobody raised any objections until now. But periods are permitted in bucket names in S3. Therefore the "bucket.tenant.host.domain" thing cannot work.

I'm inclined to document this and simply tell people who want to access buckets across tenants to use URL paths per above. However...

Quoted 11 lines

In the supported domains configuration, we can specify for each domain whether a subdomain for it would be a bucket (as it is now), or whether it would be a tenant (which implies the possibility of bucket.tenant). This only affects the global (a.k.a the "empty") tenant.

E.g., we can have two domains:

legacy-foo.com
new-foo.com

Quoted 6 lines

We'd specify that legacy-foo.com is a global tenant endpoint. In which case, when accessing buck.legacy-foo.com, it will access the global tenant, and bucket=buck.
Whereas, new-foo.com isn't a global tenant endpoint, in which case, if we'd access buck.new-foo.com, it will mean that we accessed the 'buck' tenant.

Okay, that is plausible (meaning: I can make it work). This scheme has a little downside in it: these DNS domains cannot nest. In other words, corp.com cannot be migrated to tenantized-rados.corp.com. But otherwise, I don't see it can't work.

Quoted 7 lines
Quoted 5 lines

#5 Listings and redirects.

Listings present a difficulty in S3: we don't know if the name will be used in host-based or URL-based addressing of a bucket. So, we put the tenant of a bucket into a separate XML attribute.

You mean a separate http header? http param?

Not sure what that question assumed. A separate XML attribute looks like:

<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<Name>foobucket</Name>
<Tenant>footenant</Tenant> <=============== this one <IsTruncated>false</IsTruncated>

Quoted 6 lines

There's a certain problem with this, in case the client is constructing the URLs for further access. In case it's trying to access across tenants, it has to fetch the tenant name from the attribute. I thought about returning the bucket name as <Name>footenant:foobucket</Name> for all buckets that belong to non-empty tenant, but that seems asking for compatibility issues even for access within the tenant.

Ah, I understand this point now. Note that a user will only have buckets under its own tenant (not going to own buckets from another tenant), so I'm not sure we need to add this.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Since Swift listings are always in a specific account, and thus tenant, they are unchanged.

In addition to listings, bucket names leak into certain HTTP headers, where we add "Tenant:" headers as appropriate.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Finally, multi-tenancy also puts user_uid namespaces under tenants as well as bucket namespaces. That one is easy though. A '$' separator is used consistently for it (tenant$user).

Does that work the same for object copy, and acls?

ACLs do not list buckets, only users, which may be qualified (tenant$user).

Not tenant:user?

Quoted 5 lines

COPY verbs use colons in S3. Fortunately there's no additional complication with HMAC. In Swift, currently, all that support is removed together with the backslash and is waiting for "new" URLs.

-- Pete

#4 lore raw
Quoted 12 lines · On Tue, 17 Nov 2015 16:00:12 -0800 Yehuda Sadeh-Weinraub <[email protected]>…
Quoted 11 lines

<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01">
<Name>foobucket</Name>
<Tenant>footenant</Tenant> <=============== this one <IsTruncated>false</IsTruncated>

There's a certain problem with this, in case the client is constructing the URLs for further access. In case it's trying to access across tenants, it has to fetch the tenant name from the attribute. I thought about returning the bucket name as <Name>footenant:foobucket</Name> for all buckets that belong to non-empty tenant, but that seems asking for compatibility issues even for access within the tenant.

Quoted 3 lines

Ah, I understand this point now. Note that a user will only have buckets under its own tenant (not going to own buckets from another tenant), so I'm not sure we need to add this.

Good point. I think I'll drop that.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Does that work the same for object copy, and acls?

ACLs do not list buckets, only users, which may be qualified (tenant$user).

Not tenant:user?

I forgot what happened when we did tenant:user. There was some kind of metadata syntax that used colon somewhere in one of APIs. I shall re-examine that and add a code comment near to_str() with dollar.

-- Pete

#5 lore raw
In reply to Yehuda Sadeh-Weinraub
Quoted 11 lines · On Mon, 9 Nov 2015 21:36:47 -0800 Yehuda Sadeh-Weinraub <[email protected]>…

In the supported domains configuration, we can specify for each domain whether a subdomain for it would be a bucket (as it is now), or whether it would be a tenant (which implies the possibility of bucket.tenant). This only affects the global (a.k.a the "empty") tenant.

E.g., we can have two domains:

legacy-foo.com
new-foo.com

Quoted 6 lines

We'd specify that legacy-foo.com is a global tenant endpoint. In which case, when accessing buck.legacy-foo.com, it will access the global tenant, and bucket=buck.
Whereas, new-foo.com isn't a global tenant endpoint, in which case, if we'd access buck.new-foo.com, it will mean that we accessed the 'buck' tenant.

I think I found another issue with this. Suppose we want a client authenticated under an explicit tenant accessing a legacy bucket. The only way for it to work is for it to use a different endpoint (in your example above it's legacy-foo.com). The client cannot use buck.new-foo.com syntax, as mentioned. So, there's a certain asymmetry built into the system.

Oddly enough, the X-amz-copy-source: syntax always includes bucket, and tenant:bucket syntax is recognized there, so miraclously we're good there.

-- Pete