Skip to content

Conversation

mburke5678
Copy link
Contributor

@mburke5678 mburke5678 commented Jul 18, 2025

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:

  • QE has approved this change.

@mburke5678 mburke5678 added this to the Continuous Release milestone Jul 18, 2025
@openshift-ci openshift-ci bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 18, 2025
@mburke5678 mburke5678 changed the title CMA should support bound service account tokens/default Keda Controller CMA should support bound service account tokens Jul 18, 2025
@mburke5678
Copy link
Contributor Author

@maxcao13 Can you PTAL?

@maxcao13
Copy link
Member

Thanks! I believe we should wait for QE to verify this feature before oking this.
I just created a card for it: https://issues.redhat.com/browse/AUTOSCALE-311

@mburke5678
Copy link
Contributor Author

@prozehna PTAL

@mburke5678 mburke5678 marked this pull request as draft July 30, 2025 20:48
@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 Jul 30, 2025
@mburke5678 mburke5678 removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 30, 2025
@mburke5678 mburke5678 marked this pull request as ready for review July 30, 2025 20:49
@mburke5678 mburke5678 marked this pull request as draft July 30, 2025 20:49
@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 Jul 30, 2025
@mburke5678 mburke5678 marked this pull request as ready for review July 30, 2025 20:49
@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 Jul 30, 2025
@mburke5678 mburke5678 added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jul 30, 2025
* 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:
Copy link
Contributor

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.
Copy link
Contributor

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' ?

@mburke5678 mburke5678 force-pushed the podauto-cma-2172-updates branch from ad6daf6 to e0192cf Compare July 31, 2025 21:58
@mburke5678 mburke5678 changed the title CMA should support bound service account tokens OSDOCS 12581 CMA should support bound service account tokens Aug 5, 2025
@mburke5678 mburke5678 added the merge-review-needed Signifies that the merge review team needs to review this PR label Aug 5, 2025
name: my-basic-secret
namespace: default
data:
username: "dXNlcm5hbWU=" <1>
Copy link
Contributor

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.

Copy link
Contributor Author

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>
Copy link
Contributor

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.

@xenolinux xenolinux added merge-review-in-progress Signifies that the merge review team is reviewing this PR and removed merge-review-needed Signifies that the merge review team needs to review this PR labels Aug 6, 2025
Copy link
Contributor

@xenolinux xenolinux left a 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.

@xenolinux xenolinux removed the merge-review-in-progress Signifies that the merge review team is reviewing this PR label Aug 6, 2025
Copy link
Member

@maxcao13 maxcao13 left a 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

Copy link
Member

@maxcao13 maxcao13 left a 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

@mburke5678
Copy link
Contributor Author

@prozehna Can you PTAL at my changes in response to Max's comments. The changes are in three commits:

0bae1b5
ea9b253
7e8414a

@prozehna
Copy link
Contributor

prozehna commented Aug 28, 2025

Sorry for the delay.
The 3 commit are all legit. lgtm!

@mburke5678 mburke5678 force-pushed the podauto-cma-2172-updates branch from 7e8414a to 264ce93 Compare September 17, 2025 17:48
Copy link

openshift-ci bot commented Sep 17, 2025

@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.

@mburke5678
Copy link
Contributor Author

Closed in favor of #99294

@mburke5678 mburke5678 closed this Sep 18, 2025
@mburke5678 mburke5678 deleted the podauto-cma-2172-updates branch September 19, 2025 12:29
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.

5 participants