Files
cozystack/internal/gpu/controller/setup_test.go
T
Aleksei Sviridkin a11737a2dd feat(gpu): fix the shared GPU keys, settings and binding contract
The binder, the admission webhooks, the tenant chart, the policies and
cozystack-api all have to agree on the same label, annotation,
finalizer and quota keys and on the settings ConfigMap the policies
take as a parameter, so they are defined once here.

The binder in the leader is the only writer of placement; webhooks
running in every replica record an attachment and a bind request in
the device status and wait for the binder's answer, so capacity and
budgets are decided in one serialized loop. Status is the carrier
because no tenant role can write it.

Register and Setup exist as no-ops so the controller can be wired to
them before the webhooks and reconcilers land.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-10-20 15:35:57 +03:00

32 lines
952 B
Go

/*
Copyright 2026 The Cozystack Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package controller
import (
"testing"
"github.com/cozystack/cozystack/internal/gpu"
)
// Setup is wired into cozystack-controller before any reconciler exists:
// it must succeed and touch nothing, so it accepts a nil manager.
func TestSetupWithoutReconcilersIsANoOp(t *testing.T) {
if err := Setup(nil, gpu.Config{Enabled: true}); err != nil {
t.Fatalf("Setup: %v", err)
}
}