Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

rajatchopra
Copy link
Contributor

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.

Rajat Chopra added 2 commits October 4, 2018 15:30
Change assets map to use the asset.Name() as key instead of asset object itself. This is to help with deserializing the state file.
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 4, 2018
@abhinavdahiya
Copy link
Contributor

@rajatchopra this should be done after #344; maybe just rebase on that for now.

@abhinavdahiya
Copy link
Contributor

Also with the install core moving towards #344 ; i would like to see this change in #388 than a separate PR. unless you think we can go ahead with this without conflicting with #344

@rajatchopra
Copy link
Contributor Author

Also with the install core moving towards #344 ; i would like to see this change in #388 than a separate PR. unless you think we can go ahead with this without conflicting with #344

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.
The problem with Name() is only that it should be unique. But that can be a problem if the Name is dynamically generated (as an example ingress certKey).

@abhinavdahiya
Copy link
Contributor

abhinavdahiya commented Oct 4, 2018

@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.

@openshift-ci-robot
Copy link
Contributor

@rajatchopra: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/unit 10e201a link /test unit
ci/prow/govet 10e201a link /test govet
ci/prow/e2e-aws 10e201a link /test e2e-aws

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.

@rajatchopra
Copy link
Contributor Author

Closing this out. The commit has been cherry picked into #388.

@rajatchopra rajatchopra closed this Oct 4, 2018
@rajatchopra rajatchopra deleted the asset_key branch October 17, 2018 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants