-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push audit logs to loki-audits based on promtail-audit-logs label
- Loading branch information
1 parent
bd17835
commit d016bfa
Showing
5 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: audit-logs-label | ||
annotations: | ||
policies.kyverno.io/title: Control Labelling for pushing to Loki-audits | ||
policies.kyverno.io/subject: Pod | ||
policies.kyverno.io/description: >- | ||
We should be able to control which pods logs will be pushed to Loki-audits. | ||
Since this is selected via a label we should restrict the pods that can use | ||
it. | ||
spec: | ||
validationFailureAction: Enforce | ||
rules: | ||
- name: default | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
validate: | ||
message: >- | ||
Labelling pods with promtail-audit-logs: "true" is not allowed. | ||
deny: | ||
conditions: | ||
all: | ||
- key: "{{ request.object.metadata.labels.promtail-audit-logs || '' }}" | ||
operator: Equals | ||
value: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters