Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
run: make verify-codegen

- name: Lint
run: make lint
run: make lint-changed

- name: Build
run: make build
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ test-integration: ## Run integration tests.
lint: ## Run golangci-lint.
golangci-lint run ./...

.PHONY: lint-changed
lint-changed: REVISION ?= HEAD~1
lint-changed: ## Run golangci-lint on changed files only.
golangci-lint run --new-from-rev=$(REVISION) ./...

.PHONY: clean
clean: ## Remove generated artifacts.
@echo "Cleaning generated artifacts..."
Expand Down
6 changes: 6 additions & 0 deletions api/device/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
)

var SchemeGroupVersion = schema.GroupVersion{Group: "device.nvidia.com", Version: "v1alpha1"}
var internalSchemeGroupVersion = schema.GroupVersion{Group: "device.nvidia.com", Version: runtime.APIVersionInternal}

func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
Expand All @@ -40,6 +41,11 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&GPUList{},
)

scheme.AddKnownTypes(internalSchemeGroupVersion,
&GPU{},
&GPUList{},
)

metav1.AddToGroupVersion(scheme, SchemeGroupVersion)

return nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/device-apiserver/app/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestRun(t *testing.T) {

localSocket := testutils.NewUnixAddr(t)
kineSocket := fmt.Sprintf("unix://%s", testutils.NewUnixAddr(t))
healthAddr := testutils.GetFreeTCPAddress(t)
healthAddr := testutils.MustGetFreeTCPAddress(t)

opts.GRPC.BindAddress = "unix://" + localSocket
opts.HealthAddress = healthAddr
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestRun_StorageFailure(t *testing.T) {
opts.Storage.KineSocketPath = filepath.Join(readOnlyDir, "kine.sock")
opts.Storage.KineConfig.Endpoint = fmt.Sprintf("sqlite://%s/db.sqlite", readOnlyDir)

opts.HealthAddress = testutils.GetFreeTCPAddress(t)
opts.HealthAddress = testutils.MustGetFreeTCPAddress(t)
opts.GRPC.BindAddress = "unix://" + filepath.Join(tmpDir, "api.sock")

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
Expand Down
4 changes: 2 additions & 2 deletions pkg/controlplane/apiserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func TestDeviceAPIServer(t *testing.T) {
dbPath := filepath.Join(tmpDir, "test.db")
kineSocket := testutils.NewUnixAddr(t)
apiSocket := testutils.NewUnixAddr(t)
healthAddr := testutils.GetFreeTCPAddress(t)
metricsAddr := testutils.GetFreeTCPAddress(t)
healthAddr := testutils.MustGetFreeTCPAddress(t)
metricsAddr := testutils.MustGetFreeTCPAddress(t)

storage := &storagebackend.Storage{
KineSocketPath: "unix://" + kineSocket,
Expand Down
20 changes: 14 additions & 6 deletions pkg/services/device/v1alpha1/gpu_provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 57 additions & 41 deletions pkg/services/device/v1alpha1/gpu_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading