-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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: add logs for policy ignores #4816
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @davhdavh. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
At first glance, it looks like it will generate (potentially) many logs for the same CLI switch. |
Don't think you missed anything. External-dns is already extremely spammy at debug level, and this certainly would not help with that. |
… do them after the endpoint filtering, so that the logs does not contain things that get filtered out anyway
/ok-to-test |
@@ -53,6 +62,17 @@ type CreateOnlyPolicy struct{} | |||
|
|||
// Apply applies the create-only policy which strips out updates and deletions. | |||
func (p *CreateOnlyPolicy) Apply(changes *Changes) *Changes { | |||
if log.GetLevel() == log.DebugLevel { |
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.
Shell we consider something like that. To avoid code duplication and improve readability, you can extract the logging logic to a separate function.
if log.GetLevel() == log.DebugLevel {
logSkippedEndpoints("deletion", changes.Delete)
logSkippedEndpoints("update-old", changes.UpdateOld)
logSkippedEndpoints("update-new", changes.UpdateNew)
}
func logSkippedEndpoints(action string, endpoints []*endpoint.Endpoint) {
for _, ep := range endpoints {
log.Debugf(`Skipping %s of endpoint %v due to "create-only" policy`, action, ep)
}
}
@@ -257,6 +253,10 @@ func (p *Plan) Calculate() *Plan { | |||
changes.UpdateNew = endpoint.FilterEndpointsByOwnerID(p.OwnerID, changes.UpdateNew) | |||
} | |||
|
|||
for _, pol := range p.Policies { |
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.
is order matter?
@@ -41,6 +45,11 @@ type UpsertOnlyPolicy struct{} | |||
|
|||
// Apply applies the upsert-only policy which strips out any deletions. | |||
func (p *UpsertOnlyPolicy) Apply(changes *Changes) *Changes { | |||
if log.GetLevel() == log.DebugLevel { |
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.
Any chance to cover all this changes with tests?
Description
Log when endpoints changes are dropped due to policy
Fixes #4815
Checklist