Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors exporter rendering and reconciliation to support clean disable flows (v2), unifying naming conventions and switching from error returns to cleanup methods.
- Removed error returns for disabled exporters; controllers now call
Cleanupwhen disabled. - Renamed unexported helper functions (
buildExporter*) to exported (BuildExporter*) for consistency. - Updated all controller reconcile loops to use value‐based
Reconcilesignatures and newCleanupmethods.
Reviewed Changes
Copilot reviewed 20 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/render/exporter/pod_monitor.go | Changed RenderPodMonitor to return value and removed error path for disabled state. |
| internal/render/exporter/names.go | Renamed helper functions to exported BuildExporter*. |
| internal/controller/reconciler/pod_monitor.go | Switched reconcile to use Cleanup and removed nil‐check branch. |
| internal/controller/reconciler/k8s_* | Unified Reconcile signatures to accept values, added Cleanup methods. |
| internal/controller/clustercontroller/soperator_exporter.go | Added enable/disable branches to call Reconcile or Cleanup. |
Comments suppressed due to low confidence (2)
internal/controller/reconciler/k8s_rolebinging.go:1
- Filename has a typo 'rolebinging'; consider renaming it to 'k8s_rolebinding.go' to match the RoleBinding resource and maintain consistency.
package reconciler
internal/controller/reconciler/pod_monitor.go:63
- Add import for "k8s.io/apimachinery/pkg/api/errors" as apierrors; without it,
apierrors.IsNotFoundwill not be recognized and the code will not compile.
if apierrors.IsNotFound(err) {
asteny
approved these changes
Jun 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented proper cleanup of exporter resources when the Slurm exporter is disabled. Previously, when
SlurmExporter.Enabledwas set to false, the reconciliation would skip creating new resources but wouldn't remove existing ones, leading to inconsistent cluster state.Changes
ReconcileSoperatorExporterto properly handle both enabled and disabled statesCleanupmethods to reconcilers for ServiceAccount, Role, RoleBinding, PodMonitor, and Deployment resourcesReconcilemethodsIssue
#1024