-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Use string as the asset map key instead of the object itself #416
Conversation
Change assets map to use the asset.Name() as key instead of asset object itself. This is to help with deserializing the state file.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rajatchopra The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@rajatchopra this should be done after #344; maybe just rebase on that for now. |
If we use Name() as the string, then this does not need to wait for #344. If we choose to use Type() as the key string, then we need to wait for #344. #388 will depend on both this PR and #344. I have put up this PR to this particular feedback: do we use type? Or do we use name()? The problem with type is that no two assets can be of type UserProvided for example or even CertKey as another example. They have to be their own asset object though they can use UserProvided/CertKey as part of Generate. |
@rajatchopra all this is still falls under #388, it would makes sense to make decision in #388 based on the fact that what is colliding and easy for serialization and deserialization. This change is not a concern for #344 i suppose. And after #344 the key for store will be internal impl detail to store. |
@rajatchopra: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Closing this out. The commit has been cherry picked into #388. |
The store has a map of assets and states, where the key is the asset object currently. This is an issue with json serialization and deserialization.
If we move the key to be the Name() or Type(), then deserialization can happen assuming there are only singleton asset objects (which they are in this project).
This PR only changes the asset map key to be the Name() of the asset. We can use reflect.TypeOf(assetObj).String() but for that we need at least #344 and some normalization of package reference paths and pointers.