Skip to content

Integrate functionality from update into layered update#3030

Merged
openshift-merge-robot merged 12 commits intoopenshift:layeringfrom
mkenigs:layering-rpm-ostree
Apr 5, 2022
Merged

Integrate functionality from update into layered update#3030
openshift-merge-robot merged 12 commits intoopenshift:layeringfrom
mkenigs:layering-rpm-ostree

Conversation

@mkenigs
Copy link
Copy Markdown
Contributor

@mkenigs mkenigs commented Mar 21, 2022

Still rebasing changes to experimentalUpdateLayeredConfig that will use these changes. Should I lump it all into one PR or keep this as a separate prep PR?

Comment thread pkg/daemon/rpm-ostree.go Outdated
Comment on lines 373 to 379
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@cgwalters
Copy link
Copy Markdown
Member

/approve

Comment thread pkg/daemon/rpm-ostree.go
return
}

func Cat(stateroot, commit, path string) ([]byte, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add a Deployment struct and this as a method; e.g. generate those structs from the status output.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you did booted.Cat(path), would it be clear whether that would cat what was originally booted vs live applied?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 21, 2022
Comment thread pkg/daemon/rpm-ostree_test.go Outdated
@mkenigs mkenigs force-pushed the layering-rpm-ostree branch 3 times, most recently from cef9b33 to b957ffd Compare March 21, 2022 22:56
@mkenigs mkenigs changed the title rpm-ostree prep work for layering branch Integrate functionality from update into layered update Mar 21, 2022
@mkenigs
Copy link
Copy Markdown
Contributor Author

mkenigs commented Mar 21, 2022

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

@mkenigs mkenigs marked this pull request as draft March 21, 2022 22:57
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 21, 2022
@mkenigs mkenigs force-pushed the layering-rpm-ostree branch from b957ffd to 4556f31 Compare March 22, 2022 14:18
Comment thread pkg/daemon/rpm-ostree.go Outdated
Copy link
Copy Markdown
Member

@jkyros jkyros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Comment thread pkg/daemon/daemon.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha I have no idea how that happened. Fixed

Comment thread pkg/daemon/rpm-ostree.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread pkg/daemon/rpm-ostree.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha yep just needed to have Deployment vars

Comment thread pkg/daemon/writer.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread pkg/daemon/update.go Outdated
@mkenigs mkenigs force-pushed the layering-rpm-ostree branch 5 times, most recently from 5bdc530 to 15ce427 Compare March 31, 2022 22:42
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 1, 2022
@mkenigs mkenigs force-pushed the layering-rpm-ostree branch from 15ce427 to 1ce5317 Compare April 1, 2022 20:27
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 1, 2022
@mkenigs mkenigs force-pushed the layering-rpm-ostree branch 2 times, most recently from c5a7f44 to 6f56f80 Compare April 1, 2022 20:48
@mkenigs mkenigs marked this pull request as ready for review April 1, 2022 20:52
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 1, 2022
mkenigs added 4 commits April 1, 2022 16:08
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
@mkenigs mkenigs force-pushed the layering-rpm-ostree branch from 6f56f80 to 21d0c34 Compare April 1, 2022 21:08
@mkenigs
Copy link
Copy Markdown
Contributor Author

mkenigs commented Apr 4, 2022

/test images

@mkenigs
Copy link
Copy Markdown
Contributor Author

mkenigs commented Apr 4, 2022

/retest-required

@mkenigs mkenigs force-pushed the layering-rpm-ostree branch from 21d0c34 to 2445b90 Compare April 4, 2022 17:21
mkenigs added 2 commits April 4, 2022 13:17
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
@mkenigs mkenigs force-pushed the layering-rpm-ostree branch 2 times, most recently from b37bf61 to 39fd23a Compare April 4, 2022 18:43
mkenigs added 5 commits April 4, 2022 16:30
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
@mkenigs mkenigs force-pushed the layering-rpm-ostree branch from 39fd23a to 8d73a1f Compare April 4, 2022 21:33
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 4, 2022

@mkenigs: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-op-single-node 8d73a1f link false /test e2e-gcp-op-single-node
ci/prow/e2e-gcp-single-node 8d73a1f link false /test e2e-gcp-single-node

Full PR test history. Your PR dashboard.

Details

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.

@jkyros
Copy link
Copy Markdown
Member

jkyros commented Apr 5, 2022

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

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 5, 2022
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 5, 2022

[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

Details 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-merge-robot openshift-merge-robot merged commit 151927b into openshift:layering Apr 5, 2022
@mkenigs mkenigs deleted the layering-rpm-ostree branch April 5, 2022 17:02
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. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants