From a344a4bc5a3a04e760da0872cccb410ca6b96b02 Mon Sep 17 00:00:00 2001 From: Markus Wieland Date: Thu, 20 Aug 2026 14:44:20 +0200 Subject: [PATCH 1/2] fix: issues introduced with new linter version Signed-off-by: Markus Wieland --- .../datasources/plugins/openstack/controller_test.go | 8 +++----- .../datasources/plugins/prometheus/controller_test.go | 7 +++---- internal/scheduling/nova/cr_metrics_test.go | 4 +--- internal/scheduling/nova/external_scheduler_api.go | 2 +- .../reservations/commitments/reservation_controller.go | 2 +- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/internal/knowledge/datasources/plugins/openstack/controller_test.go b/internal/knowledge/datasources/plugins/openstack/controller_test.go index a809e099b..5e0bb69d1 100644 --- a/internal/knowledge/datasources/plugins/openstack/controller_test.go +++ b/internal/knowledge/datasources/plugins/openstack/controller_test.go @@ -9,7 +9,6 @@ import ( "github.com/cobaltcore-dev/cortex/api/v1alpha1" - "github.com/cobaltcore-dev/cortex/internal/knowledge/datasources" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -29,10 +28,9 @@ func TestOpenStackDatasourceReconciler_Creation(t *testing.T) { client := fake.NewClientBuilder().WithScheme(scheme).Build() reconciler := &OpenStackDatasourceReconciler{ - Client: client, - Scheme: scheme, - Monitor: datasources.Monitor{}, - conf: config{SchedulingDomain: "test-operator"}, + Client: client, + Scheme: scheme, + conf: config{SchedulingDomain: "test-operator"}, } if reconciler.Client == nil { diff --git a/internal/knowledge/datasources/plugins/prometheus/controller_test.go b/internal/knowledge/datasources/plugins/prometheus/controller_test.go index 9dfba9f3e..af2f32c0c 100644 --- a/internal/knowledge/datasources/plugins/prometheus/controller_test.go +++ b/internal/knowledge/datasources/plugins/prometheus/controller_test.go @@ -29,10 +29,9 @@ func TestPrometheusDatasourceReconciler_Creation(t *testing.T) { client := fake.NewClientBuilder().WithScheme(scheme).Build() reconciler := &PrometheusDatasourceReconciler{ - Client: client, - Scheme: scheme, - conf: config{SchedulingDomain: "test-operator"}, - Monitor: datasources.Monitor{}, + Client: client, + Scheme: scheme, + conf: config{SchedulingDomain: "test-operator"}, } if reconciler.Client == nil { diff --git a/internal/scheduling/nova/cr_metrics_test.go b/internal/scheduling/nova/cr_metrics_test.go index 6402950e9..2aa7a2cce 100644 --- a/internal/scheduling/nova/cr_metrics_test.go +++ b/internal/scheduling/nova/cr_metrics_test.go @@ -235,14 +235,12 @@ func TestLogNoHostFound(t *testing.T) { reg.MustRegister(counter) controller := &FilterWeigherPipelineController{ - BasePipelineController: lib.BasePipelineController[lib.FilterWeigherPipeline[api.ExternalSchedulerRequest]]{ - Client: fakeClient, - }, CRRecorder: crs.Recorder{ Client: fakeClient, NoHostFoundCounter: counter, }, } + controller.Client = fakeClient requestFlavorName := flavorName if tt.payg { diff --git a/internal/scheduling/nova/external_scheduler_api.go b/internal/scheduling/nova/external_scheduler_api.go index 5773da9c7..bd57885fd 100644 --- a/internal/scheduling/nova/external_scheduler_api.go +++ b/internal/scheduling/nova/external_scheduler_api.go @@ -134,7 +134,7 @@ func shuffleTopHosts(hosts []string, k int) []string { } result := make([]string, len(hosts)) copy(result, hosts) - rand.Shuffle(n, func(i, j int) { + rand.Shuffle(n, func(i, j int) { //nolint:gosec non-crypto shuffle, safe to suppress result[i], result[j] = result[j], result[i] }) slog.Info("shuffled top hosts for evacuation", "k", n, "hosts", result[:n]) diff --git a/internal/scheduling/reservations/commitments/reservation_controller.go b/internal/scheduling/reservations/commitments/reservation_controller.go index a5fd5cd2d..08dd960c8 100644 --- a/internal/scheduling/reservations/commitments/reservation_controller.go +++ b/internal/scheduling/reservations/commitments/reservation_controller.go @@ -200,7 +200,7 @@ func (r *CommitmentReservationController) Reconcile(ctx context.Context, req ctr logger.Info("marked pre-allocated reservation as ready", "host", res.Status.Host) // Requeue immediately to run verification in next reconcile loop - return ctrl.Result{Requeue: true}, nil + return ctrl.Result{RequeueAfter: time.Millisecond}, nil } // Sync Spec values to Status fields for non-pre-allocated reservations From 43a407a3154e00315d6e6dd2cc49f604d6d1660b Mon Sep 17 00:00:00 2001 From: Markus Wieland Date: Thu, 20 Aug 2026 14:49:11 +0200 Subject: [PATCH 2/2] fix: reason Signed-off-by: Markus Wieland --- internal/scheduling/nova/external_scheduler_api.go | 2 +- .../reservations/commitments/reservation_controller.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/scheduling/nova/external_scheduler_api.go b/internal/scheduling/nova/external_scheduler_api.go index bd57885fd..4464c46a0 100644 --- a/internal/scheduling/nova/external_scheduler_api.go +++ b/internal/scheduling/nova/external_scheduler_api.go @@ -134,7 +134,7 @@ func shuffleTopHosts(hosts []string, k int) []string { } result := make([]string, len(hosts)) copy(result, hosts) - rand.Shuffle(n, func(i, j int) { //nolint:gosec non-crypto shuffle, safe to suppress + rand.Shuffle(n, func(i, j int) { //nolint:gosec // non-crypto shuffle for load balancing result[i], result[j] = result[j], result[i] }) slog.Info("shuffled top hosts for evacuation", "k", n, "hosts", result[:n]) diff --git a/internal/scheduling/reservations/commitments/reservation_controller.go b/internal/scheduling/reservations/commitments/reservation_controller.go index 08dd960c8..6541d143a 100644 --- a/internal/scheduling/reservations/commitments/reservation_controller.go +++ b/internal/scheduling/reservations/commitments/reservation_controller.go @@ -199,8 +199,8 @@ func (r *CommitmentReservationController) Reconcile(ctx context.Context, req ctr } logger.Info("marked pre-allocated reservation as ready", "host", res.Status.Host) - // Requeue immediately to run verification in next reconcile loop - return ctrl.Result{RequeueAfter: time.Millisecond}, nil + // The status patch triggers a re-reconcile via the Reservation watch; allocation verification runs in that cycle. + return ctrl.Result{}, nil } // Sync Spec values to Status fields for non-pre-allocated reservations