Skip to content

Use map list type for status bindings#7829

Merged
simonpasquier merged 3 commits intoprometheus-operator:mainfrom
yp969803:issue7790
Aug 21, 2025
Merged

Use map list type for status bindings#7829
simonpasquier merged 3 commits intoprometheus-operator:mainfrom
yp969803:issue7790

Conversation

@yp969803
Copy link
Contributor

Description

Use map list type for status bindings

Closes: #7790

Type of change

What type of changes does your code introduce to the Prometheus operator? Put an x in the box that apply.

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Verification

Please check the Prometheus-Operator testing guidelines for recommendations about automated tests.

Changelog entry

Please put a one-line changelog entry below. This will be copied to the changelog file during the release process.


@yp969803 yp969803 requested a review from a team as a code owner August 21, 2025 11:32
@yp969803
Copy link
Contributor Author

@simonpasquier PTAL!

simonpasquier
simonpasquier previously approved these changes Aug 21, 2025
found = true
break

applyCfg := ApplyConfigurationFromServiceMonitor(smon, func(binding monitoringv1.WorkloadBinding) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

In the current form, we don't even need to check for the presence of the binding in the list. The API should do the right thing: insert the item if the key (resource+name+namespace) isn't present otherwise update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@yp969803
Copy link
Contributor Author

@simonpasquier PTAL

Copy link
Contributor

@simonpasquier simonpasquier left a comment

Choose a reason for hiding this comment

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

Let's tackle the next optimization in #7827

@simonpasquier simonpasquier enabled auto-merge (squash) August 21, 2025 13:39
@simonpasquier simonpasquier merged commit 09797ff into prometheus-operator:main Aug 21, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use map list type for status bindings

2 participants