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

Ensure that an unchanged image is not in update result #144

Merged
merged 3 commits into from
Apr 6, 2021

Commits on Apr 6, 2021

  1. Test that an unchanged image is not in result

    With reference to
    
        #133
    
    this commit adapts the update->result test so that it checks an
    additional case: that a field with an update marker that _does_
    correspond to a policy, but _doesn't_ get changed, is not included in
    the results.
    
    This test fails at present, because the method for determining the
    result is to count which setters are referenced, rather than which
    fields were changed.
    
    Signed-off-by: Michael Bridgen <michael@weave.works>
    squaremo committed Apr 6, 2021
    Configuration menu
    Copy the full SHA
    9caa3b4 View commit details
    Browse the repository at this point in the history
  2. Reimplement kyaml filter to record only changes

    The update procedure is obliged to return a Result struct with all the
    objects that were changed, for filling in the commit template. At
    present, the result is collated by running each setter on each object
    and seeing if the setter is used. This uses the `Set` from kyaml, with
    a small amount of glue.
    
    It doesn't quite work, however, because a setter may be used for a
    field without changing the value. The result gets an entry for each
    policy _mentioned_, whether or not it had a new value. There is no way
    to see whether a setter actually changed a field from the outside,
    other than by comparing a copy of the object before using the setter
    with the object after (which yaml.v3 does not make easy).
    
    A better approach is to get the setter to record whether it changed
    anything, since it is there doing the changing. This means
    reimplementing kyaml's `Set`. I have stripped it down to the parts
    needed for image updates -- so e.g., only field values are examined.
    
    Signed-off-by: Michael Bridgen <michael@weave.works>
    squaremo committed Apr 6, 2021
    Configuration menu
    Copy the full SHA
    c5cfe91 View commit details
    Browse the repository at this point in the history
  3. Simplify callback bookkeeping

    This commit removes an unnecessary indirection through a closure.
    
    Signed-off-by: Michael Bridgen <michael@weave.works>
    squaremo committed Apr 6, 2021
    Configuration menu
    Copy the full SHA
    018e9e8 View commit details
    Browse the repository at this point in the history