-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: Enable config to log diff on objects when updating #583
Conversation
Use the experimental features flag to enable additional logging when updating objects on the cluster. If experimental features are enabled and a spec object is found to be different from the cluster one, log a diff between the two. This can potentially be useful for diagnosing reconcile loops. Due to json-structured logging, the formatted message is escaped into a string, and so must be parsed for reading (e.g. by piping through sed: make run 2>&1 | sed -e 's|\\n|\n|g; s|\\t| |g' for quick checking, the .msg can be copy-pasted as the argument the printf to interpret \t and \n Signed-off-by: Angel Misevski <amisevsk@redhat.com>
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.
LGTM
Just assume that the object name may be useful as well in logs.
@@ -55,6 +55,10 @@ func (r *DevWorkspaceRoutingReconciler) syncRoutes(routing *controllerv1alpha1.D | |||
if contains, idx := listContainsRouteByName(specRoute, clusterRoutes); contains { | |||
clusterRoute := clusterRoutes[idx] | |||
if !cmp.Equal(specRoute, clusterRoute, routeDiffOpts) { | |||
r.Log.Info("Updating route") |
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.
Route name is not in log context only workspace id and probably name/namespace.
So, maybe adding object name makes sense as well.
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.
Added
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
0eecdb5
to
a6c4e32
Compare
/test v8-devworkspace-operator-e2e, v8-che-happy-path |
@@ -121,7 +121,7 @@ func SyncDeploymentToCluster( | |||
} | |||
|
|||
if clusterDeployment == nil { | |||
clusterAPI.Logger.Info("Creating deployment...") | |||
clusterAPI.Logger.Info("Creating deployment") |
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.
deployment name can be useful here as well, but since ATM we have only one and one deployment, that's OK
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, JPinkney, sleshchenko 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 |
What does this PR do?
Use the experimental features flag to enable additional logging when updating objects on the cluster. If experimental features are enabled and a spec object is found to be different from the cluster one, log a
diff between the two.
What issues does this PR fix or reference?
Fixes #581
Is it tested? How?
Note that since the controller uses json-structured logging, newlines and tabs are escaped in log messages. An easy way to work around this is to pipe to
sed -e 's|\\n|\n|g; s|\\t| |g'
-- though, note if usingmake run
it's also necessary to pipe stderr to stdout, i.e.make run 2>&1 | sed -e 's|\\n|\n|g; s|\\t| |g'
. Another option is to copy paste amsg
and feed it toprintf
.PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che