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

fix: Use roles instead of cluster roles for SBJ #301

Merged
merged 1 commit into from Apr 24, 2024

Conversation

Gregory-Pereira
Copy link
Contributor

/cc @securesign/qe @lance

@openshift-ci openshift-ci bot requested a review from lance April 2, 2024 20:07
Copy link

openshift-ci bot commented Apr 2, 2024

@Gregory-Pereira: GitHub didn't allow me to request PR reviews from the following users: securesign/qe.

Note that only securesign members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @securesign/qe @lance

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.

Copy link

openshift-ci bot commented Apr 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Gregory-Pereira

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-ci openshift-ci bot added the approved label Apr 2, 2024
@lance
Copy link
Member

lance commented Apr 2, 2024

@Gregory-Pereira I am seeing this in the e2e test logs

error: the namespace from the provided object "rhtas-operator" does not match the namespace "securesign". You must pass '--namespace=rhtas-operator' to perform this operation.

@lance
Copy link
Member

lance commented Apr 2, 2024

The konflux build failed on build-source-image with this error, which I suspect may be transient.

Copying blob sha256:5038e19ffe9670630d6f85c37de580326cf0a715f5bac4dfbceee8ccb3236c12
time="2024-04-02T20:12:53Z" level=fatal msg="reading blob sha256:aea816dcd21789d1ec292c9318fb768591fd6e5a00baa492582a39d332b306c2: fetching blob: received unexpected HTTP status: 502 Bad Gateway"
2024-04-02 20:12:53,178:source-build:ERROR:failed to build source image

@Gregory-Pereira
Copy link
Contributor Author

These errors I think are due to the wrong default toggle in the api/v1/common/monitoring.go. Fixing

@Gregory-Pereira
Copy link
Contributor Author

Gregory-Pereira commented Apr 2, 2024

Owner references have to be dropped:

ERROR ensure RBAC for segment job error during action execution {"controller": "securesign", "controllerGroup": "rhtas.redhat.com", "controllerKind": "Securesign", "Securesign": {"name":"securesign-sample-testing","namespace":"testing"}, "namespace": "testing", "name": "securesign-sample-testing", "reconcileID": "d4855b74-a45c-460e-9650-bab52d833aa5", "error": "could not set controll reference for role: cross-namespace owner references are disallowed, owner's namespace testing, obj's namespace openshift-monitoring"}

For more information see the Note: section of: https://kubernetes.io/docs/concepts/overview/working-with-objects/owners-dependents/#owner-references-in-object-specifications

@Gregory-Pereira Gregory-Pereira force-pushed the sbj-demote-cluster-rbac branch 2 times, most recently from 01d7ed8 to 91fcf37 Compare April 3, 2024 03:14
Copy link
Contributor

@bouskaJ bouskaJ left a comment

Choose a reason for hiding this comment

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

You can remove resources without ownership in the finalizer section (see https://github.com/securesign/secure-sign-operator/blob/main/controllers/securesign/securesign_controller.go#L97)

controllers/securesign/actions/rbac.go Outdated Show resolved Hide resolved
controllers/securesign/actions/rbac.go Outdated Show resolved Hide resolved
@JasonPowr
Copy link
Contributor

@Gregory-Pereira Just a thought feel free to ignore if I'm wrong (I probably am), Is there a reason we need to check these config maps to see if telemetry is enabled, Can we just add a field to the API, maybe securesign.telemetry: bool can also do a check to see if monitoring is enabled, if it is then make the calls to segment? It would at least remove the calls to cluster-monitoring-config and the console resource, for enable_user_workload_monitoring_if_does_not_exist it could just be a INFO:msg mentioning that User workload monitoring is not enabled, please enable it, with a link to docs?

@Gregory-Pereira
Copy link
Contributor Author

@Gregory-Pereira Just a thought feel free to ignore if I'm wrong (I probably am), Is there a reason we need to check these config maps to see if telemetry is enabled, Can we just add a field to the API, maybe securesign.telemetry: bool can also do a check to see if monitoring is enabled, if it is then make the calls to segment? It would at least remove the calls to cluster-monitoring-config and the console resource, for enable_user_workload_monitoring_if_does_not_exist it could just be a INFO:msg mentioning that User workload monitoring is not enabled, please enable it, with a link to docs?

I am not sure that would work, these checks to see how / if monitoring were disabled were explicitly shared with me at product management (see jira: https://issues.redhat.com/browse/CONSOLE-3944 ). I think we are required to check in these pre-established ways to see if monitoring is disabled.

@JasonPowr
Copy link
Contributor

@Gregory-Pereira Just a thought feel free to ignore if I'm wrong (I probably am), Is there a reason we need to check these config maps to see if telemetry is enabled, Can we just add a field to the API, maybe securesign.telemetry: bool can also do a check to see if monitoring is enabled, if it is then make the calls to segment? It would at least remove the calls to cluster-monitoring-config and the console resource, for enable_user_workload_monitoring_if_does_not_exist it could just be a INFO:msg mentioning that User workload monitoring is not enabled, please enable it, with a link to docs?

I am not sure that would work, these checks to see how / if monitoring were disabled were explicitly shared with me at product management (see jira: https://issues.redhat.com/browse/CONSOLE-3944 ). I think we are required to check in these pre-established ways to see if monitoring is disabled.

Ahhhhhhh Ok yea, I figured something like this applied, just wanted to make sure, thanks.

@JasonPowr JasonPowr changed the title swapping cr and crbs to r and rbs fix: Use roles instead of cluster roles for SBJ Apr 17, 2024
Copy link
Contributor

@kahboom kahboom left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot removed the lgtm label Apr 17, 2024
Copy link
Contributor

@osmman osmman left a comment

Choose a reason for hiding this comment

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

I think that we should use only one method to decide if analytics should be enabled. Right now CanHandle and Handle method uses different method (annotation/spec api).

I do not know what was the reason to introduce spec.Analytics into API, if original purpose was to disable analytics by default than it could be removed and we can depend only on annotation.

controllers/securesign/actions/rbac.go Outdated Show resolved Hide resolved
@JasonPowr
Copy link
Contributor

@osmman I've removed the patch from the config map, will update the image with the proper one on monday, if you want to test you can use this one: quay.io/redhat-user-workloads/rhtas-tenant/segment-backup-job/segment-backup-job:on-pr-5df9ba8ea1c4a42cb85ff12afc4102ff83825e17

@JasonPowr
Copy link
Contributor

/hold

@osmman
Copy link
Contributor

osmman commented Apr 23, 2024

I tested it and it works without problem for me

@JasonPowr
Copy link
Contributor

JasonPowr commented Apr 23, 2024

@osmman Sorry, when you say it worked, are you referring to the pr as a whole? I'm just not sure if you are referring to #301 (comment) or not?

@osmman
Copy link
Contributor

osmman commented Apr 23, 2024

@osmman Sorry, when you say it worked, are you referring to the pr as a whole? I'm just not sure if you are referring to #301 (comment) or not?

As a whole PR

@JasonPowr
Copy link
Contributor

/unhold

Signed-off-by: greg pereira <grpereir@redhat.com>
@osmman
Copy link
Contributor

osmman commented Apr 24, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Apr 24, 2024
@JasonPowr JasonPowr merged commit c559092 into main Apr 24, 2024
11 of 12 checks passed
@osmman osmman deleted the sbj-demote-cluster-rbac branch April 24, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants