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

Add group and version to constraint logs and events #855

Merged
merged 4 commits into from
Sep 30, 2020

Conversation

mmirecki
Copy link
Contributor

@mmirecki mmirecki commented Sep 25, 2020

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #748

Special notes for your reviewer:

@codecov-commenter
Copy link

codecov-commenter commented Sep 25, 2020

Codecov Report

Merging #855 into master will decrease coverage by 0.61%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #855      +/-   ##
==========================================
- Coverage   43.96%   43.34%   -0.62%     
==========================================
  Files          47       47              
  Lines        3146     3170      +24     
==========================================
- Hits         1383     1374       -9     
- Misses       1569     1598      +29     
- Partials      194      198       +4     
Flag Coverage Δ
#unittests 43.34% <0.00%> (-0.62%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/audit/manager.go 0.00% <0.00%> (ø)
pkg/controller/constraint/constraint_controller.go 4.26% <0.00%> (-0.13%) ⬇️
pkg/webhook/policy.go 28.64% <0.00%> (-1.16%) ⬇️
...onstrainttemplate/constrainttemplate_controller.go 52.76% <0.00%> (-2.94%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09b042f...3ca35bd. Read the comment docs.

@@ -714,6 +714,8 @@ func logConstraint(l logr.Logger, constraint *unstructured.Unstructured, enforce
l.Info(
"audit results for constraint",
logging.EventType, "constraint_audited",
logging.ConstraintGroup, constraint.GroupVersionKind().Group,
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

logging.ConstraintName: constraint.GetName(),
logging.ConstraintNamespace: constraint.GetNamespace(),
logging.ConstraintAction: enforcementAction,
logging.ResourceKind: rkind,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be logging resource group/version for the violating resource as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: mmirecki <mmirecki@redhat.com>
Copy link
Contributor

@maxsmythe maxsmythe left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ritazh ritazh left a comment

Choose a reason for hiding this comment

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

lgtm

@maxsmythe maxsmythe merged commit aa64e74 into open-policy-agent:master Sep 30, 2020
RnkeZ pushed a commit to RnkeZ/gatekeeper that referenced this pull request Oct 9, 2020
…t#855)

Signed-off-by: mmirecki <mmirecki@redhat.com>

Co-authored-by: Max Smythe <smythe@google.com>
Signed-off-by: Matej Kern <matej.kern@infobip.com>
@mmirecki mmirecki deleted the LogGroup branch October 15, 2020 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log Group for Constraint Violations
4 participants