-
Notifications
You must be signed in to change notification settings - Fork 1.5k
pkg/asset: Introduce Load() into the Asset interface that loads assets (from disk) #374
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
Conversation
pkg/asset/cluster/cluster.go
Outdated
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 this can move out of this if ?
pkg/asset/asset.go
Outdated
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.
can the load provide basic read/stat on files. So each asset doesn't have to remember to prefix dir
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.
what do you mean? assets are not remembering dir, that's why the dir is passed in.
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.
assets are not remembering dir, that's why the dir is passed in.
I think @abhinavdahiya's suggesting we handle the file open and read in centralized code, and then pass the data down into the individual assets. I agree that this is a good way to go. Basically, what we're doing here is reversing the looped PersistToFile. How about making that a Store.Save(dir) method, and adding a new Store.Load(dir) to reverse? The difficulty would be that the Store would need a way to discover filenames used by the asset. I'd rather make that public instead. Maybe with a Filenames() []string method here on Asset? Then Store.Load goes through the required assets, calls their Filenames(), reads those files, and pushes the read map[string][]bytes (filename -> content) into Asset.Load to get turned into a *State. In the other hand, once you've loaded the content from disk by filename, you've pretty much got a State instance already. Maybe all we need from Asset is Asset.Filenames()?
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.
@wking Going to take care of the state of the whole store in the next PR. This one is only going to handle reading individual assets from the disk, the reason is that when run openshift-install <target> only the assets in the <target> are written to the disk, the state of other assets will be stored in a hidden state file.
That's why we also want individual asset to have a Load() function. The implementation of the Load() is centralized in the state.go, only the master-ignition and network-config are special because they will only look for some specific files under a dir.
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.
pkg/asset/ignition/machine/master.go
Outdated
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.
ioutil.ReadDir()
8fdca37 to
5d11dc3
Compare
|
e2e: |
wking
left a comment
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.
How does this interact with #344? I haven't wrapped my head around that one well enough to know.
pkg/asset/asset.go
Outdated
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.
assets are not remembering dir, that's why the dir is passed in.
I think @abhinavdahiya's suggesting we handle the file open and read in centralized code, and then pass the data down into the individual assets. I agree that this is a good way to go. Basically, what we're doing here is reversing the looped PersistToFile. How about making that a Store.Save(dir) method, and adding a new Store.Load(dir) to reverse? The difficulty would be that the Store would need a way to discover filenames used by the asset. I'd rather make that public instead. Maybe with a Filenames() []string method here on Asset? Then Store.Load goes through the required assets, calls their Filenames(), reads those files, and pushes the read map[string][]bytes (filename -> content) into Asset.Load to get turned into a *State. In the other hand, once you've loaded the content from disk by filename, you've pretty much got a State instance already. Maybe all we need from Asset is Asset.Filenames()?
|
/test e2e-aws |
@wking I looked at the #344, it seems the biggest change is that tls asets are split from two types (certkey, keypair) to a number of types to match all assets. So basically we will add |
|
ok, let me try something different than |
|
@abhinavdahiya @wking @rajatchopra Updated, ptal. |
220be45 to
1390176
Compare
|
/retest |
pkg/asset/asset.go
Outdated
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.
/s/will/should ?
pkg/asset/store.go
Outdated
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.
IsAssetInState
pkg/asset/store.go
Outdated
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.
you can return dirty, <error>
pkg/asset/store.go
Outdated
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.
you can return dirty, <error>
pkg/asset/store.go
Outdated
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.
you can return dirty, <error>
pkg/asset/store.go
Outdated
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.
you can return dirty, <error>
- Add Loadable interface to load assets from disk. - Load on-disk assets in Fetch() and use it to overwrite the state file. - Add FileFetcher interface to help reading the files from disk.
Implement Load() for all loadable assets to read files from disk and generate the in-memory asset.
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya, crawford, yifan-gu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
I run with libvirt and after this pull merged I see resetting to bf0fa6d gives me a working binary |
|
@stevekuznetsov how do I make a revert of this multicommit pull locally? |
|
After this PR |
|
|
|
@sttts Isn't the second CA output the root CA, not the apiserver CA?
|
|
Yep, copied the wrong piece. Recreating a cluster to get the right one. |
Avoiding: $ openshift-install --dir=wking create install-config $ emacs wking/install-config.yaml $ openshift-install --dir=wking create manifests FATAL Error executing openshift-install: remove install-config.yml: no such file or directory Fixing a bug from 116dd64 (pkg/asset: Load on-disk files in Fetch(), 2018-10-18, openshift#374).
|
To close the discussion: the issue was #522, i.e. the installer picking up state from the working dir leading to a cert mismatch. |
@deads2k are you asking how to revert this merge? Find the merge commit SHA and Is that what you need? |
Fix https://jira.coreos.com/browse/CORS-847
Load()to Asset interface that returns files of the asset.Load()function to read files from disk.