-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bind and unbind managed resources conservatively #175
Conversation
… them This gates against two possible issues: 1. Claim A dynamically provisions managed resource M. Claim B runs and wins a race against Claim A to bind to the newly provisioned and bindable M. 2. Claim A dynamically provisions managed resource M. Claim B explicitly sets its resource reference to M, and is then deleted, thereby deleting M which it was never bound to and did not dynamically provision. Signed-off-by: Nic Cope <negz@rk0n.org>
@muvaf @hasheddan Can you sanity check the commit I just added that guards against binding to managed resources with controller refs. Do we have any cases where a resource (e.g. a stack) creates and is the controller reference of a managed resource that is intended to be claimable? |
I've rebased this on #174 (which is now merged) and tested that:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have any cases where a resource (e.g. a stack) creates and is the controller reference of a managed resource that is intended to be claimable?
We do not currently provision claimable resources in stacks (i.e. all managed resources are network related, and the only other resources are providers or classes). However, we don't explicitly guard against doing so, so a stack could provision a managed resource and I believe it would be unable to be claimed in this situation. I think that is ok as I see stacks likely getting replaced by composition.
This will ensure resource claims don't bind to managed resources that are part of a composite resource while these two features live side by side. I suspect it will also nesure resource claims don't bind to a managed resource produced by a stack. As far as I know we don't have any use cases in which a stack creates a managed resource that is expected to be claimable. Signed-off-by: Nic Cope <negz@rk0n.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I needed to refresh my memory about why we can't add controller ref of claim to the managed resource and the reason was namespaced cannot own cluster-scoped.
Description of your changes
Fixes #177
The two commits in this PR gate against a handful of possible issues:
We noticed both of these issues during review of #174 (which did not introduce them). I'd like to wait until that PR is merged before I manually test this.
Note (cc @prasek) that one implication of this change is that a resource claim may not claim a managed resource that was statically provisioned by an infrastructure stack. i.e. You could not author an infra stack that created a
CloudSQLInstance
, then later author aMySQLInstance
that claimed thatCloudSQLInstance
. To my knowledge we don't do this today - infra stacks only provision "unclaimable" supporting infrastructure like VPC networks.Checklist
I have:
make reviewable
to ensure this PR is ready for review.clusterrole.yaml
to include any new types.