Skip to content

Expose API for blocking and initiating reboots #662

Closed

Description

@cgwalters

We have multiple requests for a way for external components to initiate the drain+reboot. Other software can do this but if it's not coordinated with the MCO problems will arise.

We face a tension for whether some of this functionality should be part of the MCO itself, but anyways here's a strawman:

/run/machine-config-operator/rebooting is a flag file the MCO writes when it starts a drain+reboot.

/run/machine-config-operator/reboot-lock.d/
is a directory, and a component can do e.g.:
echo preparing new kernel module > /run/machine-config-operator/reboot-lock.d/nvidia

As long as at least 1 entry exists, the MCO will not initiate a drain + reboot. However in order to avoid a race condition, external components must check if /run/machine-config-operator/rebooting exists after they wrote a lock file - if it does, they lost a race and should not attempt any host modifications.

/run/machine-config-operator/reboot-start.d/

When the app has completed its preparation, it does:
mv /run/machine-config-operator/reboot-{lock,start}.d/nvidia

And the MCD will start a drain+reboot when there is at least 1 entry in .start.d and no locks.

Activity

  1. pliurh commented on Apr 25, 2019

    @pliurh

    I have a use case for this API. Now we are working on an operator which can setup the SRIOV NIC on baremetal hosts. We plan to support NICs from Intel and Mellanox.

    However, for Mellanox NICs, to enable the SRIOV and set the max number of VFs, it requires to use 'mstconfig' tool to configure the firmware, then to reboot the node to take effect[1]. So we would like to have this API so that rebooting can be better coordinated among the cluster. So that we don't need to implement the drain+reboot logic in our own daemon.

    [1]https://access.redhat.com/articles/3082811

  2. jeremyeder commented on Apr 25, 2019

    @jeremyeder

    The tuned use-case for needing to trigger reboots is when tuned adds kernel command line options that are part of a tuned profile. Several discussions occurred with the perf team and MCO team over the last 6 months about ensuring tunings delivered via tuned are clearly & cleanly coordinated with the MCO and MCD.

    /cc @runcom @jmencak

  3. cgwalters commented on Apr 25, 2019

    @cgwalters
    MemberAuthor

    The tuned use-case for needing to trigger reboots is when tuned adds kernel command line options that are part of a tuned profile.

    I really rather strongly think only the MCO should be writing kernel arguments. See #388

  4. pliurh commented on May 10, 2019

    @pliurh

    @cgwalters #388 is for RHCOS only, right? What is the plan for BYOH case?

  5. cgwalters commented on Jun 27, 2019

    @cgwalters
    MemberAuthor

    I was thinking more about this recently and I think there are even cases where we want this inside the MCO itself effectively.

    This is related to work on early kargs but it's really generic to the situation where the MCD detects "drift" from the desired state. In that case if the MCD wants to reconcile, it needs to coordinate with the node controller by requesting a reboot.

  6. cgwalters commented on Jun 27, 2019

    @cgwalters
    MemberAuthor

    @cgwalters #388 is for RHCOS only, right? What is the plan for BYOH case?

    Sorry I didn't follow up on this. I think the general consensus is that we shouldn't try to get the MCO too much into the "grey area" of "we'll partially manage this node". So if we had this API it would allow e.g. someone to use Puppet/Ansible or whatever on a traditional RHEL system and change kargs, then request a reboot coordinating with the MCO.

  7. cgwalters commented on Jul 2, 2019

    @cgwalters
    MemberAuthor

    OK let me straw man out a simplistic version of this.

    If /run/machine-config-operator-reboot exists, the MCD will add a machineconfiguration.openshift.io/reboot-requested annotation. The node controller will create a machineconfiguration.openshift.io/reboot-approved annotation on at most one node at a time.

    This would happen even for MCO-initiated upgrades; today, the controller setting desiredConfig is implicitly taken by the MCD as permission to reboot.

    Probably, the controller should for now set reboot-approved and desiredConfig at the same time. But you could imagine that e.g. semantics for desiredConfig but not reboot-approved is that we try to "prepare" for an update..e.g. we can pull the oscontainer at least.

    Anyways, the MCD would react to having both reboot-requested and reboot-approved as permission to drain+reboot.

    If reboot-requested exists but the file in /run doesn't, the MCD would simply delete both annotations (if they exist) and not reboot.

    This version of the proposal doesn't have any locking; we can add that later.

  8. cgwalters commented on Jul 2, 2019

    @cgwalters
    MemberAuthor

    Side note...it sure seems like kebab-case is the most prevalent for values such as container names, annotations and labels etc., and currentConfig and desiredConfig should really be current-config and desired-config...

  9. cgwalters commented on Jul 2, 2019

    @cgwalters
    MemberAuthor

    Aaah now that I look e.g. this Node object has

    labels:
        node.openshift.io/os_version: "4.1"
        ...
    spec:
      providerID: aws:///us-east-2a/i-059faef34eb25024b
      taints:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
    

    Which includes camelCase, PascalCase, kebab-case, and snake_case (which seems to be our fault). Anyways I can't unsee it send help

  10. cgwalters commented on Jul 8, 2019

    @cgwalters
    MemberAuthor

    PR for this in #926

  11. runcom commented on Jul 10, 2019

    @runcom
    Member

    To add on the Ceph storage requirements, their scenario is as follows:

    • upgrade (or config change is initiated)
    • despite the maxUnavailable set for a pool, the storage operator has an additional requirement to avoid draining+rebooting the next node unless the previous being updated is healthy && the ceph cluster becomes healthy as well
    • the above means there must be something which controls the upgrade/config change steps

    This issue/proposal looks like it could solve the issue above, by providing an API for external component to control whether to go ahead and drain+reboot a node (this is limited to reboot right?).

    They can drive the "hold" through an annotation maybe and MCD respects that as well

  12. rohantmp commented on Jul 10, 2019

    @rohantmp

    Yup, that description of the ceph use case is accurate!

  13. cgwalters commented on Jul 10, 2019

    @cgwalters
    MemberAuthor

    OK, currently our definition of "healthy" is "kubelet is up and MCD running". If we had a mechanism for other pods or daemonsets to register with us and block completion, that seems like it'd be sufficient right?

    I guess one example here is - until the SDN pod lands in practice no other workloads are going to function - should the MCO know about this and avoid starting to drain other nodes until SDN is up?

    Hmm. Are these ceph pods pinned to nodes? For example they are using a raw block device attached to the machine?

  14. runcom commented on Jul 10, 2019

    @runcom
    Member

    OK, currently our definition of "healthy" is "kubelet is up and MCD running". If we had a mechanism for other pods or daemonsets to register with us and block completion, that seems like it'd be sufficient right?

    this is indeed super helpful - I thought about that above being driven by annotation but maybe you have another idea? The issue here could be "who removes the "hold" annotation" probably

  15. rohantmp commented on Jul 10, 2019

    @rohantmp

    OK, currently our definition of "healthy" is "kubelet is up and MCD running".

    For our requirement, it's ceph cluster reports healthy.

    If we had a mechanism for other pods or daemonsets to register with us and block completion, that seems like it'd be sufficient right?

    If by completion, you mean proceeding with any reboots, then yeah. Making the reasonable assumption that we can block before you proceed to the next node.

    Hmm. Are these ceph pods pinned to nodes? For example they are using a raw block device attached to the machine?

    In baremetal environments they would be.

  16. 12 remaining items

  17. jmencak commented on Aug 6, 2019

    @jmencak
    Contributor

    The tuned use-case for needing to trigger reboots is when tuned adds kernel command line options that are part of a tuned profile.

    I really rather strongly think only the MCO should be writing kernel arguments. See #388

    If only MCO should be writing "kernel arguments"/bootloader config, is there any plan to support this on RHEL7/8 hosts too? The functionality is needed by other operators and some are already taking matters into their hands.

  18. mhrivnak commented on Sep 16, 2019

    @mhrivnak
    Member

    I'll describe some problems from the KNI perspective, which includes ceph on bare metal hyperconverged (running on all nodes, including masters).

    MachineConfigPools are not a useful boundary for preserving availability. While we configure masters and workers differently, we need something like MaxUnavailable to apply across all machines because relevant workloads like ceph run across all machines.

    Node readiness is not the best metric for availability. In the course of recovering from a failure, a Node may be deleted and replaced. From an availability perspective, the Node's absence may be just as significant as its lack of readiness. It would be a shame for it to no longer be counted in the unavailability calculation after it gets deleted. It would be better to use something like the cluster-api's MachineSet to know how many Machines and Nodes should exist vs. do exist.

    The "paused" feature might help, but something will need to actively manage it. We have at least two reasons so far to pause a pool: 1) only one pool at a time can be un-paused, because we can't have two nodes taken down at the same time even if they're in different pools. 2) we would need to pause all pools any time ceph is unhealthy.

    Perhaps the MachineConfigPool is not the best place to express availability limits. Something like the MachineDisruptionBudget could be a better choice. Of course that would require MCO to integrate with the cluster-api, but that could have a lot of advantages. Is there a particular design argument for why these limits should be expressed on the MachineConfigPool? Or was that a matter of not having sufficient reason at the time to put it somewhere else?

    Ultimately it's hard to express the kind of availability constraints that ceph has through any of MachineConfigPools, PodDisruptionBudgets, or MachineDisruptionBudgets.

    Potentially helpful docs from rook:

    @beekhof FYI

  19. beekhof commented on Oct 14, 2019

    @beekhof

    MCO drains prior to rebooting nodes, however on bare metal there is much more value in triage and repair of problems - so we're interested in something that just does drain.
    As discussed on aos-devel, MCO's co-operative reboot mechanism isn't usable for fencing/remediation because we've lost the ability to communicate with it. However it would be desirable for MCO and machine health check to respect the same "leave this node alone" mechanism/annotation.

  20. openshift-bot commented on Sep 18, 2020

    @openshift-bot
    Contributor

    Issues go stale after 90d of inactivity.

    Mark the issue as fresh by commenting /remove-lifecycle stale.
    Stale issues rot after an additional 30d of inactivity and eventually close.
    Exclude this issue from closing by commenting /lifecycle frozen.

    If this issue is safe to close now please do so with /close.

    /lifecycle stale

  21. added
    lifecycle/stale
    on Sep 18, 2020
  22. openshift-bot commented on Oct 20, 2020

    @openshift-bot
    Contributor

    Stale issues rot after 30d of inactivity.

    Mark the issue as fresh by commenting /remove-lifecycle rotten.
    Rotten issues close after an additional 30d of inactivity.
    Exclude this issue from closing by commenting /lifecycle frozen.

    If this issue is safe to close now please do so with /close.

    /lifecycle rotten
    /remove-lifecycle stale

  23. added
    lifecycle/rotten
    and removed
    lifecycle/stale
    on Oct 20, 2020
  24. openshift-bot commented on Nov 19, 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

  25. openshift-ci-robot commented on Nov 19, 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.

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/rotten

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions