Commit Graph

4 Commits

Author SHA1 Message Date
Michael Bridgen f011f2334e Thread debug/tracing through controller and pkg/
This commit finesses the use of the debug log a little, and introduces
a trace log. The trace log gets threaded through calls to utility
procedures -- it's a little awkward putting loggers into func
parameters and structs, but it always is.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-23 10:57:04 +01:00
Aurel Canciu 7ad4047319
Switch to kube-openapi/spec flavor
Upgraded kyaml to v0.10.19

Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
2021-05-06 14:03:49 +03:00
Michael Bridgen 018e9e8a59 Simplify callback bookkeeping
This commit removes an unnecessary indirection through a closure.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-04-06 10:04:08 +01:00
Michael Bridgen c5cfe9170e 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>
2021-04-06 10:04:08 +01:00