Skip to content

Conversation

@yp969803
Copy link
Contributor

Description

Remove invaldBindings from smon status

Closes: #7834

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 25, 2025 14:00
@yp969803
Copy link
Contributor Author

@simonpasquier PTAL

…igResWorkloadBindingCleanup functions for improved workload binding management
@pull-request-size pull-request-size bot added size/L and removed size/M labels Aug 27, 2025
@yp969803
Copy link
Contributor Author

@simonpasquier review and merge requests

return err
}

// RemoveStatus remove the Prometheus or PrometheusAgent binding from the status
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit)

Suggested change
// RemoveStatus remove the Prometheus or PrometheusAgent binding from the status
// RemoveServiceMonitorBinding removes the Prometheus or PrometheusAgent binding from the status

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

require.NoError(t, err)
}

// testInvalidBindingCleanupFromSmonStatus validates ServiceMonitor status removes Prometheus refrence when the selectors are changed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// testInvalidBindingCleanupFromSmonStatus validates ServiceMonitor status removes Prometheus refrence when the selectors are changed.
// testInvalidBindingCleanupFromSmonStatus validates that the operator removes the reference to the Prometheus resource when the ServiceMonitor isn't selected anymore by the workload.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

}

// testInvalidBindingCleanupFromSmonStatus validates ServiceMonitor status removes Prometheus refrence when the selectors are changed.
func testInvalidBindingCleanupFromSmonStatus(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit)

Suggested change
func testInvalidBindingCleanupFromSmonStatus(t *testing.T) {
func testGarbageCollectionOfServiceMonitorBinding(t *testing.T) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@yp969803
Copy link
Contributor Author

@simonpasquier done the changes

return true
}

// RemoveServiceMonitorBinding removes the Prometheus or PrometheusAgent binding from the status remove the Prometheus or PrometheusAgent binding from the status
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The function is only present at once !!

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for being dense, I meant that the comment stutters.

@simonpasquier simonpasquier merged commit 3110665 into prometheus-operator:main Aug 27, 2025
21 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.

Remove invalid bindings from smon status subresource

2 participants