-
Notifications
You must be signed in to change notification settings - Fork 209
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
Add support for Subscription creation in ASO #2446
Conversation
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.
I think I need to read through this again to see how it works, but my first pass looks good, just a trio of comments.
case ResourceHierarchyRootTenant: | ||
// The only resource we actually care about for figuring out resource types is the | ||
// most derived resource | ||
res := h[len(h)-1] |
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.
could this run into indexOutOfBounds if len==0
?
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.
ok, makes sense .. it panics in rootKind
method if len==0
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.
It could, yes. There are other places where we explicitly panic on len==0
, but basically a ResourceHierarchy
is expected to be at least length = 1. Moreover, these are created by functions we control and they always have at least the resource being deployed in them, so there's no way in practice to end up with 1 that's length = 0.
Good question though.
Includes using various extensions to make this resource behave a bit more like expected
7fbf05a
to
c0f83fd
Compare
/ok-to-test sha=c0f83fd |
c0f83fd
to
daa372b
Compare
/ok-to-test sha=daa372b |
/ok-to-test sha=bfc2610 |
/ok-to-test sha=d5f6faa |
/ok-to-test sha=32bfbfb |
1 similar comment
/ok-to-test sha=32bfbfb |
This resource is a bit wonky/tricky and as such required a few hooks to customize its reconciliation behavior from what the default is.
The underlying API is that creating a subscription requires creating an Alias. That Alias is not the subscription itself, just a mechanism to produce a new one. Unfortunately the Alias cannot have RoleAssignments or other things put on it once it's created, that must be done on the subscription itself.
In order to manage this resource in ASO we combine the two concepts into a single one:
subscription.Alias
. Deleting the Alias causes the subscription to be cancelled. A subscription cannot be cancelled if it has resources (delete will fail with an error). A subscription that is cancelled will be deleted 90 days later (or can be manually deleted after 3 days).Blocked until
How does this PR make you feel:

If applicable: