Implement subresources in VWs - #4342
Conversation
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
60af7fe to
3fc8c0e
Compare
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
127 because a resource can have up to 63 bytes per segment, so 63 for the resource, 63 for the subresource and 1 for the `/`. Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
3fc8c0e to
4aba907
Compare
|
/retest |
Signed-off-by: Nelo-T. Wallus <n.wallus@sap.com>
|
/retest One is #4343 |
|
/retest infra failure |
|
/retest |
|
Nice! /lgtm I'll leave approval for a bit if someone else wants to have a look. |
|
LGTM label has been added. DetailsGit tree hash: 0bb5af6988e649277b698d6e26a194d0f83dfff4 |
| // subresource status is implicitly granted with its parent resource. | ||
| // others must be claimed explicitly |
There was a problem hiding this comment.
Yes, we just never checked for subresource permissions because only implemented status so far.
Given kube also doesn't give implicit access to the status subresource - but requiring this now would break existing APIExport/-Bindings.
I wanted to bring this up in todays community meeting to see how we feel about this.
On one hand I'd rather we are exact, on the other I'm not sure how we could make this "nice" for end users.
E.g. we could gate the implicit status on a feature gate, but that isn't really nice.
We could just keep status being implicit for now and require it explicitly in the next API version.
But I'm not really a fan of either.
There was a problem hiding this comment.
Albeit not on paper, but the "spirit" of offering a service is for the consumer to give the spec, and provider to update the status - so I think it's assumed the provider needs access to that at all times, even when claiming. So if we're looking for an excuse to keep these perms implicit, I think this could be one :D but it does sound a bit weak.
There was a problem hiding this comment.
I mean yeah but for resources exported via an APIExport we are already implicitly claiming the resource and the subresources^^
But I get what you mean. Plus that subresources are only really interesting for update/patch, so at that point the consumer is already accepting mutations from the provider on the claimed resource - and that could include subresources.
| @@ -119,6 +124,50 @@ func provideDelegatingRestStorage(ctx context.Context, dynamicClusterClientFunc | |||
|
|
|||
| // TODO(sttts): add scale subresource | |||
There was a problem hiding this comment.
Is this TODO still relevant?
There was a problem hiding this comment.
Yes. CRDs can support the scale subresource, so technically a CRD could be exported via an APIExport that supports the scale subresource.
https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#scale-subresource
There was a problem hiding this comment.
But why is it different than status? Isn't this PR working for all subresources?
There was a problem hiding this comment.
Not all, but making it possible to handle subresources other than status with the changes to permission claims and handling it in authorization.
I can take a stab at implementing the scale subresource as well for completeness :D
I'm not sure if scale is actually different or if sttts just didn't bother with it at the time.
But I think there's more work down the line because I'm not sure how well this works for e.g. virtual resource. But I haven't used virtual resources at all so far so 🤷
There was a problem hiding this comment.
Done :D Scale subresource works!
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
Signed-off-by: Nelo-T. Wallus <red.brush9525@fastmail.com>
|
New changes are detected. LGTM label has been removed. |
Summary
Implements subresources in VWs, specifically the
TokenRequest.Went with RBAC style in the claims for less API changes and because it feels closer. I tested a separate
Subresoureas part of the claims but that didn't look quite right.I've been hacking on this on and off for two weeks.
I think its secure now because to access a subresource a) the claim for the subresource needs to be present and b) the parent resource needs to be claimed as well, so the usual gates apply.
subresource claims cannot have their own labels to prevent mismatching labels between parent and subresource (I could see the value of being able to distinguish that a provider has access to resource set A but only to subset B for accessing the subresource - but that feels like the edge case of an edge case).
What Type of PR Is This?
/kind feature
Related Issue(s)
Fixes #
Release Notes