Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions internal/scheduling/nova/cr_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/scheduling/nova/external_scheduler_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 for load balancing
result[i], result[j] = result[j], result[i]
})
slog.Info("shuffled top hosts for evacuation", "k", n, "hosts", result[:n])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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{Requeue: true}, 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
Expand Down