Skip to content
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

DaemonSet controller respects MaxSurge during update #96441

Merged
merged 5 commits into from Mar 6, 2021

Commits on Mar 1, 2021

  1. daemonset: Prevent accidental omissions of test condition checks

    It is too easy to omit checking the return value for the
    syncAndValidateDaemonSet test in large suites. Switch the method
    type to be a test helper and fatal/error directly. Also rename
    a method that referenced the old name 'Rollback' instead of
    'RollingUpdate'.
    smarterclayton committed Mar 1, 2021
    Configuration menu
    Copy the full SHA
    8e6f58b View commit details
    Browse the repository at this point in the history
  2. podutil: Use parenthesis for clarity around the pod ready condition

    While this is correct in order of operations, it is harder to read
    and masks the intent of the user without the parenthesis.
    smarterclayton committed Mar 1, 2021
    Configuration menu
    Copy the full SHA
    6bac501 View commit details
    Browse the repository at this point in the history
  3. daemonset: Implement MaxSurge on daemonset update

    If MaxSurge is set, the controller will attempt to double up nodes
    up to the allowed limit with a new pod, and then when the most recent
    (by hash) pod is ready, trigger deletion on the old pod. If the old
    pod goes unready before the new pod is ready, the old pod is immediately
    deleted. If an old pod goes unready before a new pod is placed on that
    node, a new pod is immediately added for that node even past the MaxSurge
    limit.
    
    The backoff clock is used consistently throughout the daemonset controller
    as an injectable clock for the purposes of testing.
    smarterclayton committed Mar 1, 2021
    Configuration menu
    Copy the full SHA
    18f43e4 View commit details
    Browse the repository at this point in the history
  4. daemonset: Simplify the logic for calculating unavailable pods

    In order to maintain the correct invariants, the existing maxUnavailable
    logic calculated the same data several times in different ways. Leverage
    the simpler structure from maxSurge and calculate pod availability only
    once, as well as perform only a single pass over all the pods in the
    daemonset. This changed no behavior of the current controller, and
    has a structure that is almost identical to maxSurge.
    smarterclayton committed Mar 1, 2021
    Configuration menu
    Copy the full SHA
    9f296c1 View commit details
    Browse the repository at this point in the history
  5. daemonset: Remove unnecessary error returns in strategy code

    The nodeShouldRunDaemonPod method does not need to return an error
    because there are no scenarios under which it fails. Remove the
    error return path for its direct calls as well.
    smarterclayton committed Mar 1, 2021
    Configuration menu
    Copy the full SHA
    8d8884a View commit details
    Browse the repository at this point in the history