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

[MON-1786] Enable audit logs by default for Prometheus Adapter #1377

Merged
merged 1 commit into from
Nov 9, 2021

Conversation

sthaha
Copy link
Contributor

@sthaha sthaha commented Sep 14, 2021

Enabling audit logs helps troubleshoot issues in Prometheus Adapter. The
details of the audit level can be tweaked by selecting an audit profile
just like in OpenShift API server.

The following profiles are provided which corresponds to Audit Log Levels

  • Request
  • RequestResponse
  • None
  • Metadata (the default audit profile)

User can pick any of the profile by modifying the CMO configmap as follows

apiVersion: v1
kind: ConfigMap
metadata:
  name: cluster-monitoring-config
  namespace: openshift-monitoring
data:
  config.yaml: |
    k8sPrometheusAdapter:
      audit:
        profile: Request

CMO picks up the change and (re)deploys prometheus-adapter with appropriate --audit- flags.

Signed-off-by: Sunil Thaha sthaha@redhat.com

  • I added CHANGELOG entry for this change.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 14, 2021
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 14, 2021
pkg/manifests/config.go Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
Copy link
Contributor

@philipgough philipgough left a comment

Choose a reason for hiding this comment

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

Overall looks good. Would be good to have some link in the commit message, PR or changelog etc as some context as to where the various options are coming from.

Probably needs an e2e test in https://github.com/openshift/cluster-monitoring-operator/blob/master/test/e2e/config_test.go?

pkg/manifests/manifests.go Outdated Show resolved Hide resolved
assets/prometheus-adapter/config-map.yaml Outdated Show resolved Hide resolved
pkg/manifests/config.go Outdated Show resolved Hide resolved
pkg/manifests/manifests.go Outdated Show resolved Hide resolved
pkg/manifests/manifests.go Outdated Show resolved Hide resolved
@sthaha sthaha force-pushed the audit-prom-adapter branch 2 times, most recently from 03dc9d5 to 6878fff Compare September 27, 2021 05:49
@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 27, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 28, 2021
@sthaha sthaha changed the title WIP: [MON-1786] Audit prom adapter [MON-1786] Enable audit logs by default for Prometheus Adapter Sep 28, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 28, 2021
@sthaha sthaha force-pushed the audit-prom-adapter branch 2 times, most recently from 32bead3 to 6058474 Compare September 28, 2021 03:19
Makefile Show resolved Hide resolved
Copy link
Contributor

@arajkumar arajkumar left a comment

Choose a reason for hiding this comment

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

Overall looks good to me with few nits.

jsonnet/components/prometheus-adapter-audit.libsonnet Outdated Show resolved Hide resolved
pkg/manifests/manifests_test.go Show resolved Hide resolved
@sthaha
Copy link
Contributor Author

sthaha commented Sep 28, 2021

@simonpasquier @dgrisonnet , I have removed the WIP. Does this PR require changes to any doc other than the openshift/docs (repo) ?

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 28, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 29, 2021
@sthaha
Copy link
Contributor Author

sthaha commented Oct 21, 2021

Holding ack; till https://issues.redhat.com/browse/MON-1853?focusedCommentId=19171183&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-19171183 is resolved.

@sferich888 We have set the fix version to 4.10. Could you please approve?

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 25, 2021
@simonpasquier
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 28, 2021
@sferich888
Copy link

Who set qe-approved on this? I ask because its not QE acked in https://issues.redhat.com/browse/MON-1988 (as part of the planning processes).

/label px-approved

@openshift-ci openshift-ci bot added px-approved Signifies that Product Support has signed off on this PR needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 4, 2021
@sthaha
Copy link
Contributor Author

sthaha commented Nov 5, 2021

Who set qe-approved on this? I ask because its not QE acked in https://issues.redhat.com/browse/MON-1988 (as part of the planning processes).

If you are asking why QE approval was set rather than who ... I believe it was given based on the previous epic. MON-1988 was created recently to narrow down the scope of otherwise a large/never-ending epic

@openshift-ci openshift-ci bot removed lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 5, 2021
@sthaha
Copy link
Contributor Author

sthaha commented Nov 8, 2021

/retest

Enabling audit logs helps troubleshoot issues in Prometheus Adapter. The
details of the audit level can be tweaked by selecting an audit profile
which corresponds to audit Log Level.
See: https://kubernetes.io/docs/tasks/debug-application-cluster/audit/#audit-policy

The following profiles are provided:
  - Metadata:  The default audit profile
  - None
  - Request
  - RequestResponse

User can pick any of the profile by modifying the CMO configmap as
follows

```
apiVersion: v1
kind: ConfigMap
metadata:
  name: cluster-monitoring-config
  namespace: openshift-monitoring
data:
  config.yaml: |
    k8sPrometheusAdapter:
      audit:
        profile: Request
```

Signed-off-by: Sunil Thaha <sthaha@redhat.com>
@sthaha
Copy link
Contributor Author

sthaha commented Nov 9, 2021

/retest

@simonpasquier
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 9, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 9, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dgrisonnet, simonpasquier, sthaha

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:
  • OWNERS [simonpasquier,sthaha]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@simonpasquier
Copy link
Contributor

/label docs-approved

as per agreement with the docs team

@openshift-ci openshift-ci bot added the docs-approved Signifies that Docs has signed off on this PR label Nov 9, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 9, 2021

@sthaha: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-single-node ce499ef link false /test e2e-aws-single-node

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@simonpasquier
Copy link
Contributor

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 9, 2021
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 32334d9 into openshift:master Nov 9, 2021
sthaha added a commit to sthaha/must-gather that referenced this pull request Nov 10, 2021
This PR is part of the Monitoring story[1] to enable audit logs for
Prometheus Adapter[2]. The patch adds the functionality to gather
audit logs from prometheus-adapter pod which is available from
OpenShift version 4.10.

Running `oc adm must-gather -- /usr/bin/gather_audit_logs` will now
gather prometheus-adapter audit logs and will be stored under
`monitoring/<prometheus-adapter-pod>` directory.

[1]: JIRA: https://issues.redhat.com/browse/MON-1786
[2]: openshift/cluster-monitoring-operator#1377

Signed-off-by: Sunil Thaha <sthaha@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. docs-approved Signifies that Docs has signed off on this PR lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.