Skip to content

Add annotations to exclude labels from generated HPA and Job objects#6851

Merged
JorTurFer merged 8 commits intokedacore:mainfrom
skgsergio:6849-exclude-labels-from-generated-objects
Jul 11, 2025
Merged

Add annotations to exclude labels from generated HPA and Job objects#6851
JorTurFer merged 8 commits intokedacore:mainfrom
skgsergio:6849-exclude-labels-from-generated-objects

Conversation

@skgsergio
Copy link
Contributor

@skgsergio skgsergio commented Jun 19, 2025

Implement scaledobject.keda.sh/hpa-excluded-labels and scaledjob.keda.sh/job-excluded-labels annotations to allow excluding labels from being propagated to HPA and Job generated objects.

Checklist

Fixes #6849

Relates to kedacore/keda-docs#1579

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

I like this feature! Could you cover the change of the ScaledJob also in the already existing e2e test (scaled_job_validation_test)?

Please open another PR to docs documenting this new annotation https://github.com/kedacore/keda-docs

@skgsergio
Copy link
Contributor Author

I like this feature! Could you cover the change of the ScaledJob also in the already existing e2e test (scaled_job_validation_test)?

Oops! Forgot about it because I added the Scaled Job logic later. On it.

Please open another PR to docs documenting this new annotation https://github.com/kedacore/keda-docs

It is already done: kedacore/keda-docs#1579

@skgsergio skgsergio force-pushed the 6849-exclude-labels-from-generated-objects branch from c318fda to 7b678c4 Compare July 7, 2025 11:27
@skgsergio skgsergio force-pushed the 6849-exclude-labels-from-generated-objects branch from 7b678c4 to a8ffa37 Compare July 7, 2025 11:32
@skgsergio
Copy link
Contributor Author

@JorTurFer added the test for the ScaledJob (took me a while 😓) and improved how is tested (didn't make sense to count labels and test the remaining one so I tested the ones I didn't want are not present).

To be honest I don't know if the e2e tests work as I didn't find a way to run them locally.

@skgsergio skgsergio force-pushed the 6849-exclude-labels-from-generated-objects branch from d347829 to 72c84fc Compare July 7, 2025 11:44
@zroubalik
Copy link
Member

zroubalik commented Jul 7, 2025

/run-e2e internal
Update: You can check the progress here

@skgsergio
Copy link
Contributor Author

🤦🏻‍♂️ test failed due to lack of quotes in the value of a label that is a number, damn YAML. Fixed.

@rickbrouwer
Copy link
Member

rickbrouwer commented Jul 9, 2025

/run-e2e internal
Update: You can check the progress here

@skgsergio skgsergio force-pushed the 6849-exclude-labels-from-generated-objects branch from 69491ba to 8d06ebf Compare July 10, 2025 07:11
@skgsergio
Copy link
Contributor Author

I think I fixed the e2e tests for good, I'm sorry for all the running around

@rickbrouwer
Copy link
Member

I think I fixed the e2e tests for good, I'm sorry for all the running around

Thanks and no problem! I will run the e2e test :)

@rickbrouwer
Copy link
Member

rickbrouwer commented Jul 10, 2025

/run-e2e internal
Update: You can check the progress here

@skgsergio
Copy link
Contributor Author

🤦🏼 I hope this is the last one.

@rickbrouwer
Copy link
Member

🤦🏼 I hope this is the last one.

the fossa build failed.
can you do a git commit --amend --no-edit and a git push so the checks are triggered to run again?

@skgsergio skgsergio force-pushed the 6849-exclude-labels-from-generated-objects branch from cd124c5 to 79de40d Compare July 10, 2025 09:37
@skgsergio
Copy link
Contributor Author

Done!

@rickbrouwer
Copy link
Member

Thanks!
Can you also please mention the docs PR kedacore/keda-docs#1579 in the description of this PR?

@rickbrouwer
Copy link
Member

rickbrouwer commented Jul 10, 2025

/run-e2e internal
Update: You can check the progress here

…HPA and Job objects

Signed-off-by: Sergio Conde <skgsergio@gmail.com>
Signed-off-by: Sergio Conde <skgsergio@gmail.com>
Signed-off-by: Sergio Conde <skgsergio@gmail.com>
Signed-off-by: Sergio Conde <skgsergio@gmail.com>
Signed-off-by: Sergio Conde <skgsergio@gmail.com>
Signed-off-by: Sergio Conde <skgsergio@gmail.com>
Signed-off-by: Sergio Conde <skgsergio@gmail.com>
Signed-off-by: Sergio Conde <skgsergio@gmail.com>
@skgsergio skgsergio force-pushed the 6849-exclude-labels-from-generated-objects branch from d103582 to 7aeeba0 Compare July 10, 2025 11:54
@skgsergio
Copy link
Contributor Author

Ok I'm confident this is the one. 🤞🏼

The ScaledObject tests worked and the ScaledJob had an incorrect anotation in the text fixture but actually worked.

To be honest I should have invested some time in trying to get the e2e tests to run locally, but not sure how feasible is.

@rickbrouwer
Copy link
Member

rickbrouwer commented Jul 10, 2025

/run-e2e internal
Update: You can check the progress here

@JorTurFer JorTurFer merged commit ef7da8d into kedacore:main Jul 11, 2025
25 checks passed
@JorTurFer
Copy link
Member

thanks for the contribution!

@skgsergio skgsergio deleted the 6849-exclude-labels-from-generated-objects branch July 11, 2025 15:52
dpochopsky pushed a commit to dpochopsky/keda that referenced this pull request Sep 12, 2025
…edacore#6851)

* Add annotations to exclude labels from being propagated to generated HPA and Job objects

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Improve testing

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Fix tests label type

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Fix job fetch helper function for e2e tests

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Fix scaled object excluded labels tests

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Use cron trigger instead of cpu on e2e test

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Use a job without secret dependencies in e2e tests

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Fix annotation in tests

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

---------

Signed-off-by: Sergio Conde <skgsergio@gmail.com>
Signed-off-by: David Pochopsky <david.pochopsky@united.com>
skgsergio added a commit to skgsergio/keda that referenced this pull request Sep 12, 2025
…edacore#6851)

* Add annotations to exclude labels from being propagated to generated HPA and Job objects

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Improve testing

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Fix tests label type

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Fix job fetch helper function for e2e tests

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Fix scaled object excluded labels tests

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Use cron trigger instead of cpu on e2e test

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Use a job without secret dependencies in e2e tests

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

* Fix annotation in tests

Signed-off-by: Sergio Conde <skgsergio@gmail.com>

---------

Signed-off-by: Sergio Conde <skgsergio@gmail.com>
@houman-moallemi
Copy link

Thank you for this PR!
It's worth considering hpa-excluded-annotations as ScaledObject passes helm annotations to HPA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow filtering labels out to avoid interactions with other stuff like tanka

5 participants