-
Notifications
You must be signed in to change notification settings - Fork 1.8k
OSDOCS 12581 CMA should support bound service account tokens #96335
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
Conversation
@maxcao13 Can you PTAL? |
Thanks! I believe we should wait for QE to verify this feature before oking this. |
@prozehna PTAL |
* If you are using a cluster trigger authentication, specify the `openshift-keda` project. | ||
|
||
. Create a service account and token, if your cluster does not have one: | ||
. Create a service account, if your cluster does not have one: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I'd probably remove the comma on this line.
<2> Specifies that this trigger authentication uses a secret for authorization when connecting to the metrics endpoint. | ||
<3> Specifies the type of authentication to use. | ||
<4> Specifies the name of the secret to use. | ||
<4> Specifies the name of the secret to use. See the following example secret with a bearer token. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably all the lines saying 'with a bearer token' should be replaced with 'using a bearer token' ?
ad6daf6
to
e0192cf
Compare
name: my-basic-secret | ||
namespace: default | ||
data: | ||
username: "dXNlcm5hbWU=" <1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be established best practices by now for example usernames and passwords, my nit here is that "dXNlcm5hbWU=" is not beautiful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@prozehna the username and password here are base64 encoded. Those are never pretty. I want to show a base64 example for emphasis. (It's likely username and password in base64.)
namespace: my-namespace | ||
data: | ||
bearerToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV" <1> | ||
ca-cert.pem: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0... <1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in regard to my other comment, i'm also curious if there are best practices that apply here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! lgtm
Skipping the merge at this point because the PR awaits the Custom Metrics Autoscaler release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing, is that we are actually missing a step, and sorry that I caught this late in the review and release, but user's need to create their own rbac in order for keda-operator to be able to request service account tokens from service accounts. Otherwise the feature won't work. (QE verifying this feature was able to catch this).
e.g.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: keda-operator-token-creator
namespace: <namespace_name> # Replace with the namespace of the service account
rules:
- apiGroups:
- ""
resources:
- serviceaccounts/token
verbs:
- create
resourceNames:
- thanos # Replace with the name of the service account
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: keda-operator-token-creator-binding
namespace: <namespace_name> # Replace with the namespace of the service account
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: keda-operator-token-creator
subjects:
- kind: ServiceAccount
name: keda-operator
namespace: openshift-keda
I've documented the details and sort of why in this part of the upstream docs: https://keda.sh/docs/2.17/authentication-providers/bound-service-account-token/#permissions-for-keda-to-request-service-account-tokens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final things, but otherwise lgtm. Again sorry for bringing this up last minute
Sorry for the delay. |
7e8414a
to
264ce93
Compare
@mburke5678: all tests passed! 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-sigs/prow repository. I understand the commands that are listed here. |
Closed in favor of #99294 |
READY TO MERGE WHEN CUSTOM METRICS AUTOSCALER 2.17.2 RELEASES
https://issues.redhat.com/browse/OSDOCS-12581
Link to docs preview:
Understanding custom metrics autoscaler trigger authentications -- Added three example trigger authentications that use bound service account tokens. Moved example secret to after the associated trigger auth example. Current docs for comparison.
Using trigger authentications -- Updated example trigger auth to use bound service token. Current docs
Configuring the custom metrics autoscaler to use OpenShift Container Platform monitoring -- Updated example trigger auth to use bound service token; removed prereq to have a secret (not needed for new token). Current docs.
QE review: