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

Make get secrets permissions optional in Metric Adapter #3081

Closed
sbuliarca opened this issue May 30, 2022 · 11 comments
Closed

Make get secrets permissions optional in Metric Adapter #3081

sbuliarca opened this issue May 30, 2022 · 11 comments
Labels
feature-request All issues for new features that have not been committed to needs-discussion

Comments

@sbuliarca
Copy link

Proposal

In version 2.7.1, keda-metrics-apiserver requires the permissions to get secrets for resolving the container's environment for a targetted deployment( code is here) without actually needing it. If it doesn't have the permissions, the metric for the scaled object won't be resolved.

We would like to be able to run keda without the metrics-apiserver having access to secrets.

Proposed solution:

  1. Resolve the target's container environment only when keys from it are referenced by the authentication mechanism
  2. This is more of a workaround: do not fail when a secret can not be resolved in scale_resolver. This way the scaler should work if it doesn't need authentication, as in our case.

More details in the use-case description.

Use-Case

We're running a self-managed Kubernetes cluster where we use isolated namespaces for security and logical separation of the applications.
We are using the Principle of Least privilege across our namespaces to achieve a tight security.
For running Keda we plan to deploy the keda-metrics-apiserver that watches all namespaces in a separate namespace, since it can be deploied only once per cluster, and the keda-operator in the individual namespaces where we want to enable event based scaling.
Having keda-metrics-apiserver being able to read the other namespaces secrets poses a big risk for us, so we trimmed down the rbac config that Keda comes with, and we removed the access to secrets for it. We accepted the fact that we won't be able to use TriggerAuthentications throught secrets & env vars, only through Hashicorp's Vault.

But we hit this limitation as keda-metrics-apiserver wants to read the secrets of the targetted deployment, although the ScaledObject doesn't require any authentication for the scaler, and it doesn't work without it. Due to this we are not able to use scalers on targets that rerefence secrets.

Anything else?

No response

@sbuliarca sbuliarca added feature-request All issues for new features that have not been committed to needs-discussion labels May 30, 2022
@tomkerkhove tomkerkhove moved this to Proposed in Roadmap - KEDA Core May 30, 2022
@tomkerkhove tomkerkhove changed the title keda-metrics-apiserver: do not require permissions to get secrets Make get secrets permissions potional in metric adapter May 30, 2022
@tomkerkhove
Copy link
Member

That's a fair ask, but I don't know if we can do that. @zroubalik ?

@zroubalik zroubalik changed the title Make get secrets permissions potional in metric adapter Make get secrets permissions optional in Metric Adapter May 30, 2022
@zroubalik
Copy link
Member

Reading Secrets from KEDA Operator is acceptable for you?

I think it is a fair ask, I prefer to 1. solution, the latter is not ideal imho.

@sbuliarca
Copy link
Author

Reading Secrets from KEDA Operator is acceptable for you?

Indeed this is acceptable, as the operator would run in the namespace it manages, so it would be ok to have access to the secrets in that namespace

@tomkerkhove
Copy link
Member

That's not possible though, see #2654 where we are tracking this.

But I presume you are interested in the multi-tenancy model there?

@sbuliarca
Copy link
Author

Indeed, we're after the multi-tenancy model.

And we almost got to an acceptable solution with the current code, this being the only issue & the limitation of not being able to use TriggerAuthentications throught secrets & env vars, only through Hashicorp's Vault, as stated before.

@stale
Copy link

stale bot commented Jul 29, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Jul 29, 2022
@stale
Copy link

stale bot commented Aug 5, 2022

This issue has been automatically closed due to inactivity.

@stale stale bot closed this as completed Aug 5, 2022
Repository owner moved this from Proposed to Ready To Ship in Roadmap - KEDA Core Aug 5, 2022
@tomkerkhove tomkerkhove reopened this Aug 8, 2022
Repository owner moved this from Ready To Ship to Proposed in Roadmap - KEDA Core Aug 8, 2022
@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Aug 8, 2022
@stale
Copy link

stale bot commented Oct 7, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Oct 7, 2022
@tomkerkhove
Copy link
Member

@sbuliarca Can you check if #3668 helps you? This feels like a duplicate

@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Oct 10, 2022
@sbuliarca
Copy link
Author

Hey @tomkerkhove ! Indeed I think that issue would solve ours too. Thank you for pointing it out

@tomkerkhove
Copy link
Member

Duplicate of #3668

@tomkerkhove tomkerkhove marked this as a duplicate of #3668 Oct 12, 2022
@tomkerkhove tomkerkhove closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2022
Repository owner moved this from Proposed to Ready To Ship in Roadmap - KEDA Core Oct 12, 2022
@JorTurFer JorTurFer moved this from Ready To Ship to Done in Roadmap - KEDA Core Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request All issues for new features that have not been committed to needs-discussion
Projects
Archived in project
Development

No branches or pull requests

3 participants