-
Notifications
You must be signed in to change notification settings - Fork 204
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
Idiomatic resource naming for asoctl #4487
Conversation
b289c8e
to
5dc5f4e
Compare
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! Just left a few minor comments.
@@ -442,9 +445,10 @@ func (i *importableARMResource) getStatus( | |||
ctx context.Context, | |||
armID string, | |||
importable genruntime.ImportableARMResource, | |||
factory *importFactory, |
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.
We can pass just the scheme here rather than the whole struct?
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 have plans to tidy this further in the future, adding new methods to the factory that simplify this code further.
) | ||
|
||
// importFactory is a helper struct that's used to create things. | ||
type importFactory struct { |
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.
ImportHelper
sounds like a better name to me
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 try to avoid names like Helper
and Manager
as they become dumping grounds for too much.
I used factory as it's used for making things, but I'm open to a better suggestion.
What this PR does
Within a Kubernetes Cluster, resources need to have unique names only within resources of that type - the GroupKind of the resource is part of the uniqueness key.
This allows us to change
asoctl
to simply reuse the last part of the ARM ID for each resource as the name in most cases.To disambiguate when multiple resources have the same "name" and collide, we add a unique random suffix as required. In testing, this happened rarely.
Closes #4349
How does this PR make you feel?
Checklist