-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add diff logging #191
Add diff logging #191
Conversation
9d989d3
to
288d254
Compare
Particularly special thanks to @JustinKuli for the initial legwork on this PR. 😄 |
a86850f
to
ff59b81
Compare
/hold Okay, this is ready for review now! |
This looks good. I only had one minor comment. Thanks Dale! |
ff59b81
to
2bd73a2
Compare
These tests are flaky on the minimum K8s version: - operator policy compliance check - alternative kubeconfig in hosted mode Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
d717eb7
to
cd5d597
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold depending on if you want to support OCP 3.11
19299b9
to
691d175
Compare
691d175
to
0a3a654
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold for fixing the typo in the log message
Adds a `recordDiff` enum parameter to the `ConfigurationPolicy`. When set to `Log`, it uses the `go-difflib` package to compare the YAML marshalled into strings. While `go-difflib` is unmaintained, it's extensively imported, in particular by the `stretchr/testify` package here. For simplicity, the diff for objectDefinitions without a name specified are not logged. ref: https://issues.redhat.com/browse/ACM-9072 Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
0a3a654
to
baface8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/unhold
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dhaiducek, mprahl The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
2b3fab1
into
open-cluster-management-io:main
Adds a
recordDiff
enum parameter to theConfigurationPolicy
. When set toLog
, it uses thego-difflib
package to compare the YAML marshalled into strings, with unified output similar to thediff
command in the shell. Whilego-difflib
is unmaintained, it's extensively imported, in particular by thestretchr/testify
package here.For simplicity, the diff for objectDefinitions without a name specified are not logged.
Further enhancements could be made by making the diff object-aware. For instance, the ArgoCD diff goes so far as to hack around the Kubernetes library that implements
apply
. However, I think this is a good, simple implementation as far as an MVP goes and is likely more performant than an object-aware implementation.ref: https://issues.redhat.com/browse/ACM-9072