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

Added permissions to resources for metrics exporter #2322

Conversation

aruniiird
Copy link
Contributor

@aruniiird aruniiird commented Dec 13, 2023

Remove an accidental role permissions added to prometheus.
Add the same (missing) permissions to metrics exporter.

A minor code refactor to optimize role/rolebinding addition to metrics exporter
and a minor bug fix

@aruniiird aruniiird force-pushed the fix-metrics-exporter-pvc-permission-error branch from a8b610a to 8a2a755 Compare December 13, 2023 13:35
Added the received image health status message from the cluster.
Helps user in debugging.

Signed-off-by: Arun Kumar Mohan <[email protected]>
@aruniiird aruniiird force-pushed the fix-metrics-exporter-pvc-permission-error branch 2 times, most recently from 024a88e to 23670dc Compare December 13, 2023 14:28
@aruniiird aruniiird changed the title Add 'persistentvolumeclaims' access permission for exporter Added permissions to resources for metrics exporter Dec 13, 2023
@aruniiird
Copy link
Contributor Author

@umangachapagain , we are not seeing any *v1.StorageClass errors anymore.
Fixing other permission issues as seen in the ocs-metrics-exporter logs.
Please take a look.

@aruniiird aruniiird force-pushed the fix-metrics-exporter-pvc-permission-error branch 5 times, most recently from cbd79f0 to 1dd4603 Compare December 14, 2023 07:56
@aruniiird
Copy link
Contributor Author

Still seeing error messages, like the following,

failed to get PVC appset1/busybox-pvc: persistentvolumeclaims "busybox-pvc" is forbidden:
User "system:serviceaccount:openshift-storage:ocs-metrics-exporter" cannot get resource "persistentvolumeclaims" in API group "" in the namespace "appset1"

This is an expected error message, as we are granting ocs-metrics-exporter permissions to watch only the namespace it is currently deployed (here it is openshift-storage).

Question here is, above error message popped up in a MCO cluster and is this an expected behavior in this type of scenario?

@umangachapagain
Copy link
Contributor

Still seeing error messages, like the following,

failed to get PVC appset1/busybox-pvc: persistentvolumeclaims "busybox-pvc" is forbidden:
User "system:serviceaccount:openshift-storage:ocs-metrics-exporter" cannot get resource "persistentvolumeclaims" in API group "" in the namespace "appset1"

This is an expected error message, as we are granting ocs-metrics-exporter permissions to watch only the namespace it is currently deployed (here it is openshift-storage).

This shouldn't happen. There's a bug somewhere.

Question here is, above error message popped up in a MCO cluster and is this an expected behavior in this type of scenario?

Not expected in any case. It's a bug.

@aruniiird
Copy link
Contributor Author

Still seeing error messages, like the following,

failed to get PVC appset1/busybox-pvc: persistentvolumeclaims "busybox-pvc" is forbidden:
User "system:serviceaccount:openshift-storage:ocs-metrics-exporter" cannot get resource "persistentvolumeclaims" in API group "" in the namespace "appset1"

This is an expected error message, as we are granting ocs-metrics-exporter permissions to watch only the namespace it is currently deployed (here it is openshift-storage).

This shouldn't happen. There's a bug somewhere.

Question here is, above error message popped up in a MCO cluster and is this an expected behavior in this type of scenario?

Not expected in any case. It's a bug.

Currently unable to repro the error. Raised a separate issue #2327 to track this

Attaching the current metrics exporter log

ocs-metrics-exporter.logs.tar.gz

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 15, 2023
Remove an accidental role permissions added to prometheus.
Add the same (missing) permissions to metrics exporter.

This resolves the following error messages in metrics exporter,

persistentvolumeclaims "db-noobaa-db-pg-0" is forbidden:
User "system:serviceaccount:openshift-storage:ocs-metrics-exporter"
cannot get resource "persistentvolumeclaims" in API group "" in the
namespace "openshift-storage"

pods is forbidden:
User "system:serviceaccount:openshift-storage:ocs-metrics-exporter"
cannot list resource "pods" in API group "" in the namespace
"openshift-storage"

Signed-off-by: Arun Kumar Mohan <[email protected]>
A small optization to exporter role and rolebinding
functions to remove duplicate codes.

Signed-off-by: Arun Kumar Mohan <[email protected]>
We were getting following error message while adding a PV to PVStore
as we were expecting only pointer to PV as arg to PVStore Add() method.

err: unexpected object of type v1.PersistentVolume

Signed-off-by: Arun Kumar Mohan <[email protected]>
@aruniiird aruniiird force-pushed the fix-metrics-exporter-pvc-permission-error branch from 1dd4603 to a63c97a Compare December 18, 2023 05:36
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 18, 2023
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 18, 2023
Copy link
Contributor

openshift-ci bot commented Dec 18, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aruniiird, umangachapagain

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:

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

@openshift-merge-bot openshift-merge-bot bot merged commit 15b8d1c into red-hat-storage:main Dec 18, 2023
14 checks passed
@agarwal-mudit
Copy link
Member

/cherry-pick release-4.15

@openshift-cherrypick-robot

@agarwal-mudit: new pull request could not be created: failed to create pull request against red-hat-storage/ocs-operator#release-4.15 from head openshift-cherrypick-robot:cherry-pick-2322-to-release-4.15: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"No commits between red-hat-storage:release-4.15 and openshift-cherrypick-robot:cherry-pick-2322-to-release-4.15"}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request"}

In response to this:

/cherry-pick release-4.15

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.

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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants