Skip to content

consider making config changes truly transactional on RHCOS #1190

Closed

Description

@cgwalters

With ostree, each deployment (bootable target) has its own copy of /etc.

Today, the MCD writes into the current /etc. This has weird side effects; for example, it means that we may be affecting running static pods for kubelet. We may rewrite the pull secret.

It also means we don't have rollback at the ostree level.

It'd be fairly easy to change the MCD to (on RHCOS) create a new deployment for pure config changes, and write the new changes to /etc there - leaving the booted system untouched.

This would mean that config changes would be fully transactional and offline, the same way OS updates are.

Activity

  1. cgwalters commented on Oct 18, 2019

    @cgwalters
    MemberAuthor

    Another way to look at this is, it'd enforce that config changes require a reboot.

    We could drop the hacks around using journald for which config we're in, because /etc becomes transactional. (And much closer to being immutable - see also coreos/rpm-ostree#702 )

  2. cgwalters commented on Oct 20, 2019

    @cgwalters
    MemberAuthor

    Also a prerequisite is moving the pull secret from /var into /etc - and in general, all MachineConfig changes.

  3. mrunalp commented on Oct 20, 2019

    @mrunalp
    Member

    👍 IIUC, this would prevent new static pod manifests to take effect until we reboot.

  4. sinnykumari commented on Oct 21, 2019

    @sinnykumari
    Contributor

    This proposal looks interesting!
    One question though - will this apply on firstboot of node as well? This question is because today mcd available on host reads MachineConfig and writes /etc/ignition-machine-config-encapsulated.json during firstboot which is later used by mcd to apply kargs in firstboot.

  5. cgwalters commented on Oct 29, 2019

    @cgwalters
    MemberAuthor

    One question though - will this apply on firstboot of node as well?

    I don't see a blocker to doing this on firstboot too.

  6. sinnykumari commented on Nov 4, 2019

    @sinnykumari
    Contributor

    One question though - will this apply on firstboot of node as well?

    I don't see a blocker to doing this on firstboot too.

    Looks like I might have misunderstood little bit making /etc/ changes transactional.

    What will happen with this proposal in place during firstboot? Most likely during firstboot we will have config changes (like new file to be added in /etc/ignition-machine-config-encapsulated.json ) and also new machine-os-content. Today, we create new deployment for mchine-os-content changes which gets applied after reboot. What will happen to files like /etc/ignition-machine-config-encapsulated.json, will it be written to current deployment or in new deployment?

  7. cgwalters commented on Jan 6, 2020

    @cgwalters
    MemberAuthor

    The motivation for filing this issue was the etcd upgrade bug.

    However, we're also now seeing this for kubelet config.

    And see also a related podman config bug.

    One comment I had on the podman bug was:

    The problem is that doing the naive thing and always doing an OS update before config changes would force double reboots for every upgrade.
    We could try to detect "major version" upgrades and force doing the OS update first there...wouldn't be terribly hard, but would add noticeable latency to upgrades.

  8. cgwalters commented on Jan 6, 2020

    @cgwalters
    MemberAuthor

    What will happen with this proposal in place during firstboot?
    ...
    What will happen to files like /etc/ignition-machine-config-encapsulated.json, will it be written to current deployment or in new deployment?

    That's a good question. Note that today, it's Ignition which writes the initial files, not the MCD. So unless we changed how Ignition works too, the answer would be that the files are written in the current root.

    And in fact, we need this to happen because we need the pull secret /var/lib/kubelet/config.json in the current root so that podman can pull the oscontainer. (In general, we need other configs for that too too, such as any image content source policy, certificates, proxy config etc.)

    I think it's OK if we only do this "transactional /etc" for MCD upgrades, because that's where we're actually doing an upgrade, and we have a workload running on the cluster.

  9. cgwalters commented on Jan 6, 2020

    @cgwalters
    MemberAuthor

    Also a prerequisite is moving the pull secret from /var into /etc - and in general, all MachineConfig changes.

    Eh, thinking about this more it's not a hard dependency - we can just make changes to /etc transactional, and say that things outside of it aren't. In practice, the pull secret doesn't change often or in an incompatible way. What we need is transactional changes for the static pods etc. which should be in /etc.

  10. sinnykumari commented on Jan 7, 2020

    @sinnykumari
    Contributor

    That's a good question. Note that today, it's Ignition which writes the initial files, not the MCD. So unless we changed how Ignition works too, the answer would be that the files are written in the current root.

    Ah right, makes sense to me now. thanks for the explanation.

  11. cgwalters commented on Jul 8, 2020

    @cgwalters
    MemberAuthor

    Dropping this here for lack of a better place: A much bigger path we could take would be to have the MCO build a derived OSTree commit from the rendered MachineConfig (like as a build process) and serve that to other nodes in the cluster. This means we're not going into each node and changing config files (or things like the kernel-rt overrides) and also leads more strongly towards having /etc mounted read-only by default.

    But going this path takes us entirely away from supporting traditional RHEL - so we'd also need to do #1592

  12. 4 remaining items

  13. added
    lifecycle/rotten
    on Nov 24, 2020
  14. openshift-bot commented on Dec 24, 2020

    @openshift-bot
    Contributor

    Rotten issues close after 30d of inactivity.

    Reopen the issue by commenting /reopen.
    Mark the issue as fresh by commenting /remove-lifecycle rotten.
    Exclude this issue from closing again by commenting /lifecycle frozen.

    /close

  15. openshift-ci-robot commented on Dec 24, 2020

    @openshift-ci-robot
    Contributor

    @openshift-bot: Closing this issue.

    Details

    In response to this:

    Rotten issues close after 30d of inactivity.

    Reopen the issue by commenting /reopen.
    Mark the issue as fresh by commenting /remove-lifecycle rotten.
    Exclude this issue from closing again by commenting /lifecycle frozen.

    /close

    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.

  16. cgwalters commented on Feb 5, 2021

    @cgwalters
    MemberAuthor

    /lifecycle frozen

  17. added
    lifecycle/frozen
    and removed
    lifecycle/rotten
    on Feb 5, 2021
  18. cgwalters commented on Feb 5, 2021

    @cgwalters
    MemberAuthor
  19. cgwalters commented on Feb 5, 2021

    @cgwalters
    MemberAuthor

    Also of note, rpm-ostree is getting closer to stabilizing our "apply-live" code, xref https://lists.fedoraproject.org/archives/list/[email protected]/thread/MQWBKRFCYH2GB3CW5CG722RGQAEPHHAN/ - once that happens we can also support e.g. live-applying a subset of the changes to /etc - and as well potentially things like "just cherry pick the new kubelet package" and take the kernel update downtime later.

  20. cgwalters commented on Aug 26, 2021

    @cgwalters
    MemberAuthor

    In recent discussion it was realized that a slightly hacky but totally viable way to do this would be for the MCO to take the Ignition config content under filesystem: and synthesize an RPM from it, then rpm-ostree install ./machine-config.rpm.

    We've thought about this some in the context of non-RPM content; some discussion related to that in coreos/rpm-ostree#2326
    And various prep work for it has landed, but it's not going to be soon. Whereas layering RPMs works today.

  21. cgwalters commented on Oct 28, 2021

    @cgwalters
    MemberAuthor

    One thing the MCO could do today is: Before initiating any node level changes to /etc, run ostree admin deploy --not-as-default <current commit> (and we could wrap this in rpm-ostree too, but the ostree API exists today).

    The effect of this is that we snapshot the current /etc before the MCO mutates it, and it would help ensure that rpm-ostree rollback (or just picking the previous bootloader entry) has a consistent state.

    A downside of this approach is that by snapshotting the current /etc, it re-introduces race conditions with any processes besides the MCO that are live-mutating /etc. (Which apparently includes various daemonsets, there's also LVM which writes state in /etc).

  22. sinnykumari commented on Oct 28, 2021

    @sinnykumari
    Contributor

    A downside of this approach is that by snapshotting the current /etc, it re-introduces race conditions with any processes besides the MCO that are live-mutating /etc. (Which apparently includes various daemonsets, there's also LVM which writes state in /etc).

    Right. Another example is SRIOV operator that makes direct changes to node as they perform some per node config changes.

  23. cgwalters commented on Nov 15, 2022

    @cgwalters
    MemberAuthor

    Closing this as a dup of #3137 which we'll hopefully do with layering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/frozen

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions