-
Notifications
You must be signed in to change notification settings - Fork 180
fix log value dedupe in reconciler.go #57
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
Conversation
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.
👍
| "role", roleARN, | ||
| "region", region, | ||
| // All the fields for a resource that do not change during reconciliation | ||
| // can be initialized during resourceLogger creation |
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.
does this comment also apply to the three value pairs above it?
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.
Yes, but they are constant but at controller level.
I made the comment for fields we were deriving from the resource every time earlier
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.
Actually account, role and region can all change based on the namespace for a resource :)
Super weird. Would love to figure out that one, but some other day. Great detective work! |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jaypipes, RedbackThomson, vijtrip2 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 |
Issue #, if available: aws-controllers-k8s/community#1001 Description of changes: * "Kind" value in logs was empty because `Get` from K8s typed client does not unmarshall GVK fields. We need to use dynamic client OR deduce GVK from `scheme` object. However to set "Kind" field in logs, resource-descriptor can be used and easily fix this bug. * Other resource fields(name, namespace, generation) were getting duped in logs because resourceLogger constructor was deducing them and setting them in `r.log` values. When INFO or DEBUG method was called, they were getting deduced again and added as additional values. To fix this, during construction, we do not deduce fields from resource. Additional changes: * Fields like name, namespace, kind do not change during reconciliation of the object so we can set them once during construction of resource logger * Only generation field is calculated on INFO/DEBUG methods * Adoption reconciler logger did not have these bugs. Adoption reconciler finds Kind from "adoptedResource.Spec" and does not use constructor for resource logger. Tested locally and validated the logs. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: aws-controllers-k8s/community#1001
Description of changes:
Getfrom K8s typed client does not unmarshall GVK fields. We need to use dynamic client OR deduce GVK fromschemeobject. However to set "Kind" field in logs, resource-descriptor can be used and easily fix this bug.r.logvalues. When INFO or DEBUG method was called, they were getting deduced again and added as additional values. To fix this, during construction, we do not deduce fields from resource.Additional changes:
Tested locally and validated the logs.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.