Integrate functionality from update into layered update#3030
Integrate functionality from update into layered update#3030openshift-merge-robot merged 12 commits intoopenshift:layeringfrom
Conversation
There was a problem hiding this comment.
This feels like overkill and I'm not even sure ostree's current behavior is intended, but right now ostree prints out every directory for a single file change, eg:
/path
/path/to
/path/to/file
Not sure if there's an easier way to simplify that than a tree
There was a problem hiding this comment.
The reason this happens is because ostree is content-addressed; each directory is represented by a checksum. So any change to any file recursively changes every directory object up to the parent.
(Just like git)
So that's why we print out each directory as modified.
There was a problem hiding this comment.
Gotcha makes sense. Do you think generating a tree is a good approach or too complicated? I think @jkyros is okay with it but would prefer something easier to understand
|
/approve |
| return | ||
| } | ||
|
|
||
| func Cat(stateroot, commit, path string) ([]byte, error) { |
There was a problem hiding this comment.
We could add a Deployment struct and this as a method; e.g. generate those structs from the status output.
There was a problem hiding this comment.
If you did booted.Cat(path), would it be clear whether that would cat what was originally booted vs live applied?
There was a problem hiding this comment.
Oh good question! Offhand I'd say booted.Cat(path) should always operate on the booted commit. Querying the live filesystem state inherently doesn't need a special API, one can just call open(path) right?
There was a problem hiding this comment.
True. I'm trying to diff two files from two different ostree commits though, but it's possible that one of them is live applied. Because if that I think I don't think it really makes sense to be on a Deployment struct because that doesn't really make sense when I need to cat a live applied file. I could just open(path) 🤔 But since I'm calling ostree diff image1 image2 it feels like diff(cat(image1, path), cat(image2, path)) is a bit more consistent. And right now I implemented Cat as just calling open
cef9b33 to
b957ffd
Compare
|
Okay I'm going to make this a mega PR with everything I've been working on for now because some of my changes won't even build without others. This is rebased on top of a few other PRs so it should gradually get smaller |
b957ffd to
4556f31
Compare
8551b64 to
9e0ea00
Compare
There was a problem hiding this comment.
So it looks like this kinda:
- fixes up the build configs to squash layers and use machine_config_to_ignition
- adjusts drain functions to use the new "file read" functions that return lists of files instead of parsing the ignition files directly (this shouldn't break anything, but it does adjust an existing code path)
- updates the "rpm-ostree bindings" to process the file diff
- fixes my
experimentalUpdateLayeredConfig()sloppy mess to work properly with drain/liveapply :)
There was a problem hiding this comment.
I don't care that the comment got mangled, but I am just mentioning it in case it is a find/replace or copy/paste accident. :)
There was a problem hiding this comment.
Haha I have no idea how that happened. Fixed
There was a problem hiding this comment.
It might just be the way my brain works, but this totally baked my noodle. I looked at it for way too long. 😆
Am I understanding this right that the reason you do all this work parsing the diff into a FileTree is because:
- ostree diff includes the intermediate directories also
- you don't know which ones are the intermediate directories until you find the "leaves" ?
- once you find the leaves, you can figure out which ones are "extra" (non-leaf) and exclude them from the changeset?
There was a problem hiding this comment.
It might just be the way my brain works, but this totally baked my noodle. I looked at it for way too long. laughing
Yeah see my comment above about overkill 😬
Am I understanding this right that the reason you do all this work parsing the diff into a FileTree is because:
- ostree diff includes the intermediate directories also
Yep
- you don't know which ones are the intermediate directories until you find the "leaves" ?
Right. We know a directory is not intermediate if it has no children or equivalently len(pathsToLeaves) == 0
- once you find the leaves, you can figure out which ones are "extra" (non-leaf) and exclude them from the changeset?
Essentially. The recursion will result in going from children up to the root, so you don't exclude so much as prepend to an already existing path. E.g. if we have /path/to/file, when you're processing to you'll see that you have child file and put /to/file in paths. And then the same will happen to prepend path
Any ideas on making this more legible? Or taking a completely different approach? I'm not even sure if ostree outputting every directory is a bug or a feature. @cgwalters should ostree be outputting
/path
/path/to
/path/to/file
There was a problem hiding this comment.
It's less gross, and it's not an array anymore, but it's still here! 😄
(This is just commentary, I assume we'll leave this here until we decide whether to break some of this out into some sort of library/bindings or not)
There was a problem hiding this comment.
Haha yep just needed to have Deployment vars
There was a problem hiding this comment.
When I hacked on this I was trying to decide if I should find a way to mangle SetDone to satisfy both paths, but I am very in favor of this being separate for now.
We're eventually going to have to talk about the pool/node-controller consequences of how to get from where we are now with layering which is:
- Our pool gets to a MachineConfig via an image
To the desired and state where:
- Our pool gets to an Image (that just so happens to contain the required machineconfig)
Like eventually the image needs to be the config, not the rendered-config.
Right now pool.Spec.Configuration.Name is implied to be a MachineConfig. As part of the build controller-y stuff I was thinking through what that might mean if the pool's config is an actual image.
Do we just add a "Kind" there in the pool status/spec to go along with the name? And then the pool/node-controller is like "I got you to that config you specified, whatever kind it was". Definitely a longer discussion that crosses into UX.
This comment is too long, but it's too late.
There was a problem hiding this comment.
Hmm yeah I'm less familiar with the controller side, I think I'd like to talk through some of that. From the MCD side, I think it would be nice if we could drop the SetDone call, because then all the MCD has to care about is 1. What's my DesiredImageConfigAnnotationKey and 2. did I set MachineConfigDaemonStateAnnotationKey and CurrentImageConfigAnnotationKey
5bdc530 to
15ce427
Compare
15ce427 to
1ce5317
Compare
c5a7f44 to
6f56f80
Compare
Add a comment to Rebase Don't return changed since there should be an error if nothing changed Remove logs about pivot and custom origin since we don't use pivot:// or --custom-origin-url for layered rebases
Also add LiveReplaced field A layered update will need to perform operations on the staged and deployed Deployments, which will require variables of type Deployment
6f56f80 to
21d0c34
Compare
|
/test images |
|
/retest-required |
21d0c34 to
2445b90
Compare
Factored some code out of experimentalUpdateLayeredConfig into a function in daemon.go since eventually we'll want to write pull secret on daemon startup. We don't handle layering there currently so for now we'll continue to call the function in experimentalUpdateLayeredConfig Also moved getPullSecret to daemon
b37bf61 to
39fd23a
Compare
Translate MachineConfig to Ignition and pass to mco-build-content build
Currently the Docker build leaves behind some files that trigger a reboot when we should be applying live, so those files should be cleaned up instead. Set ImageOptimizationPolicy=ImageOptimizationSkipLayers since currently ostree does not support whiteouts so file deletions won't work unless layers are squashed
39fd23a to
8d73a1f
Compare
|
@mkenigs: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
The "tree stuff" for the diff parsing works for now, worst case we put a big fat explanation comment on it if we keep it. I'd rather not hold things up just for that. /lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cgwalters, jkyros, mkenigs 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 |
Still rebasing changes to
experimentalUpdateLayeredConfigthat will use these changes. Should I lump it all into one PR or keep this as a separate prep PR?