Skip to content
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

endpoint: Add DebugPolicy option #14112

Merged
merged 2 commits into from
Nov 24, 2020
Merged

Conversation

jrajahalme
Copy link
Member

Add endpoint DebugPolicy option that, if enabled, logs endpoint policy
map update details to /var/run/cilium/state/endpoint-policy.log.

The new DebugPolicy option is enabled if the new flag
--debug-verbose=policy is set, but can be enabled also independently
via:

cilium endpoint config DebugPolicy=true

This feature was first developed in the v1.7 branch, so no 1.7 backport is needed.

Signed-off-by: Martynas Pumputis m@lambda.lt
Signed-off-by: Jarno Rajahalme jarno@covalent.io

Added new Cilium agent option --debug-verbose=policy to log policy map updates.

@jrajahalme jrajahalme added sig/policy Impacts whether traffic is allowed or denied based on user-defined policies. area/bugtool Impacts gathering of data for debugging purposes. release-note/misc This PR makes changes that have no direct user impact. needs-backport/1.8 labels Nov 20, 2020
@jrajahalme jrajahalme requested review from a team November 20, 2020 22:45
@jrajahalme jrajahalme requested review from a team as code owners November 20, 2020 22:45
@jrajahalme jrajahalme requested review from a team, nebril, jrfastab and kaworu November 20, 2020 22:45
@maintainer-s-little-helper maintainer-s-little-helper bot added this to In progress in 1.10.0 Nov 20, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.9.1 Nov 20, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.8.6 Nov 20, 2020
@jrajahalme
Copy link
Member Author

test-me-please

Copy link
Member

@ianvernon ianvernon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid - hope you can use this to debug issues more easily in the future :-)

@jrajahalme
Copy link
Member Author

test-me-please

@jrajahalme
Copy link
Member Author

retest-4.9

@@ -114,3 +139,61 @@ func (e *Endpoint) UpdateLogger(fields map[string]interface{}) {

atomic.StorePointer(&e.logger, unsafe.Pointer(l))
}

func (e *Endpoint) updatePolicyLogger(fields map[string]interface{}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The caller need to hold Endpoint.mutex for writing correct? If yes, can we add a comment please?

About UpdateLogger comment on holding the mutex, my understanding is that the caller must hold Endpoint.mutex (not Endpoint.Mutex) for writing (not for reading) even when fields is nil as we can reach the atomic.StorePointer at line 140.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the locking comments ;-)

brb and others added 2 commits November 24, 2020 11:17
Add endpoint DebugPolicy option that, if enabled, logs endpoint policy
map update details to /var/run/cilium/state/endpoint-policy.log.

The new DebugPolicy option is enabled if the new flag
--debug-verbose=policy is set, but can be enabled also independently
via:

  cilium endpoint config <EPID> DebugPolicy=true

Signed-off-by: Martynas Pumputis <m@lambda.lt>
Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
Endpoint's Mutex has been renamed as 'mutex'. Update comments to
reflect this and also the lock level requirement (Lock for writing,
RLock for reading).

Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
@jrajahalme
Copy link
Member Author

All tests passed before adding changes to comments only, no need to retest.

@jrajahalme jrajahalme added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Nov 24, 2020
@aditighag aditighag merged commit 8704e85 into master Nov 24, 2020
@aditighag aditighag deleted the pr/jrajahalme/log-sync-policy branch November 24, 2020 19:30
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Backport done to v1.7 in 1.7.12 Nov 25, 2020
This was referenced Nov 30, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.8 in 1.8.6 Nov 30, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.9 in 1.9.1 Nov 30, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.9 in 1.9.1 Nov 30, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.9 to Backport done to v1.9 in 1.9.1 Dec 2, 2020
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.8 to Backport done to v1.8 in 1.8.6 Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bugtool Impacts gathering of data for debugging purposes. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies.
Projects
No open projects
1.7.12
Backport done to v1.7
1.8.6
Backport done to v1.8
1.9.1
Backport done to v1.9
Development

Successfully merging this pull request may close these issues.

None yet