Skip to content

Commit

Permalink
Rename gpu.nvidia.com/v1alpha1 API to resource.nvidia.com/v1beta1
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Klues <[email protected]>
  • Loading branch information
klueska committed Jan 22, 2025
1 parent ea143c3 commit fa8bce2
Show file tree
Hide file tree
Showing 50 changed files with 180 additions and 180 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ goimports:
find . -name \*.go \
-not -name "zz_generated.deepcopy.go" \
-not -path "./vendor/*" \
-not -path "./pkg/nvidia.com/resource/clientset/versioned/*" \
-not -path "./$(PKG_BASE)/clientset/versioned/*" \
-exec goimports -local $(MODULE) -w {} \;

golangci-lint:
Expand All @@ -101,9 +101,9 @@ coverage: test
cat $(COVERAGE_FILE) | grep -v "_mock.go" > $(COVERAGE_FILE).no-mocks
go tool cover -func=$(COVERAGE_FILE).no-mocks

generate: generate-crds fmt
generate: generate-crds generate-informers fmt

generate-crds: generate-deepcopy
generate-crds: generate-deepcopy .remove-crds
for dir in $(CLIENT_SOURCES); do \
controller-gen crd:crdVersions=v1 \
paths=$(CURDIR)/$${dir} \
Expand All @@ -118,15 +118,15 @@ generate-crds: generate-deepcopy
rm -rf $(CURDIR)/deployments/helm/tmp_crds


generate-deepcopy: generate-informers
generate-deepcopy: .remove-deepcopy
for dir in $(DEEPCOPY_SOURCES); do \
controller-gen \
object:headerFile=$(CURDIR)/hack/boilerplate.go.txt,year=$(shell date +"%Y") \
paths=$(CURDIR)/$${dir}/ \
output:object:dir=$(CURDIR)/$${dir}; \
done

generate-informers: generate-listers
generate-informers: .remove-informers generate-listers
informer-gen \
--go-header-file=$(CURDIR)/hack/boilerplate.go.txt \
--output-package "$(MODULE)/$(PKG_BASE)/informers" \
Expand All @@ -139,7 +139,7 @@ generate-informers: generate-listers
$(CURDIR)/$(PKG_BASE)/informers
rm -rf $(CURDIR)/pkg/tmp_informers

generate-listers: generate-clientset
generate-listers: .remove-listers generate-clientset
lister-gen \
--go-header-file=$(CURDIR)/hack/boilerplate.go.txt \
--output-package "$(MODULE)/$(PKG_BASE)/listers" \
Expand All @@ -150,7 +150,7 @@ generate-listers: generate-clientset
$(CURDIR)/$(PKG_BASE)/listers
rm -rf $(CURDIR)/pkg/tmp_listers

generate-clientset: .remove-informers .remove-listers .remove-clientset .remove-deepcopy .remove-crds
generate-clientset: .remove-clientset
client-gen \
--go-header-file=$(CURDIR)/hack/boilerplate.go.txt \
--clientset-name "versioned" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package v1alpha1
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -24,8 +24,8 @@ import (
)

const (
GroupName = "gpu.nvidia.com"
Version = "v1alpha1"
GroupName = "resource.nvidia.com"
Version = "v1beta1"

GpuConfigKind = "GpuConfig"
MigDeviceConfigKind = "MigDeviceConfig"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package v1alpha1
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
*/

// +k8s:deepcopy-gen=package
// +groupName=gpu.nvidia.com
// +groupName=resource.nvidia.com

package v1alpha1
package v1beta1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package v1alpha1
package v1beta1

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package v1alpha1
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package v1alpha1
package v1beta1

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package v1alpha1
package v1beta1

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package v1alpha1
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package v1alpha1
package v1beta1

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
# limitations under the License.
**/

package v1alpha1_test
package v1beta1_test

import (
"testing"

"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/api/resource"

configapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/gpu/v1alpha1"
configapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/v1beta1"
)

func TestMpsPerDevicePinnedMemoryLimitNormalize(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package v1alpha1
package v1beta1

import (
"fmt"
Expand Down

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

2 changes: 1 addition & 1 deletion cmd/nvidia-dra-gpu-plugin/device_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/kubelet/checkpointmanager"
cdiapi "tags.cncf.io/container-device-interface/pkg/cdi"

configapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/gpu/v1alpha1"
configapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/v1beta1"
)

type OpaqueDeviceConfig struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/nvidia-dra-gpu-plugin/sharing.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
cdiapi "tags.cncf.io/container-device-interface/pkg/cdi"
cdispec "tags.cncf.io/container-device-interface/specs-go"

configapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/gpu/v1alpha1"
configapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/v1beta1"
)

const (
Expand Down
10 changes: 5 additions & 5 deletions cmd/nvidia-dra-imex-controller/computedomain.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"

nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/gpu/v1alpha1"
nvinformers "github.com/NVIDIA/k8s-dra-driver/pkg/nvidia.com/resource/informers/externalversions"
nvlisters "github.com/NVIDIA/k8s-dra-driver/pkg/nvidia.com/resource/listers/gpu/v1alpha1"
nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/v1beta1"
nvinformers "github.com/NVIDIA/k8s-dra-driver/pkg/nvidia.com/informers/externalversions"
nvlisters "github.com/NVIDIA/k8s-dra-driver/pkg/nvidia.com/listers/resource/v1beta1"
)

type ComputeDomainExistsFunc func(uid string) (bool, error)

const (
informerResyncPeriod = 10 * time.Minute

computeDomainLabelKey = "gpu.nvidia.com/computeDomain"
computeDomainLabelKey = "resource.nvidia.com/computeDomain"
computeDomainFinalizer = computeDomainLabelKey
)

Expand All @@ -56,7 +56,7 @@ type ComputeDomainManager struct {
// NewComputeDomainManager creates a new ComputeDomainManager.
func NewComputeDomainManager(config *ManagerConfig) *ComputeDomainManager {
factory := nvinformers.NewSharedInformerFactory(config.clientsets.Nvidia, informerResyncPeriod)
informer := factory.Gpu().V1alpha1().ComputeDomains().Informer()
informer := factory.Resource().V1beta1().ComputeDomains().Informer()
lister := nvlisters.NewComputeDomainLister(informer.GetIndexer())

m := &ComputeDomainManager{
Expand Down
2 changes: 1 addition & 1 deletion cmd/nvidia-dra-imex-controller/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"

nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/gpu/v1alpha1"
nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/v1beta1"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cmd/nvidia-dra-imex-controller/deviceclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"

nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/gpu/v1alpha1"
nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/v1beta1"
)

type DeviceClassManager struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/nvidia-dra-imex-controller/resourceclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"

nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/gpu/v1alpha1"
nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/v1beta1"
)

type ResourceClaimManager struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/nvidia-dra-imex-controller/resourceclaimtemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"k8s.io/client-go/tools/cache"
"k8s.io/klog/v2"

nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/gpu/v1alpha1"
nvapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/v1beta1"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion cmd/nvidia-dra-imex-plugin/device_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/kubelet/checkpointmanager"
cdiapi "tags.cncf.io/container-device-interface/pkg/cdi"

configapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/gpu/v1alpha1"
configapi "github.com/NVIDIA/k8s-dra-driver/api/nvidia.com/resource/v1beta1"
)

type OpaqueDeviceConfig struct {
Expand Down
6 changes: 3 additions & 3 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

VENDOR := nvidia.com

API_BASE := api/$(VENDOR)/resource
PKG_BASE := pkg/$(VENDOR)/resource
API_BASE := api/$(VENDOR)
PKG_BASE := pkg/$(VENDOR)

CLIENT_APIS := gpu/v1alpha1
CLIENT_APIS := resource/v1beta1
CLIENT_SOURCES += $(patsubst %, $(API_BASE)/%, $(CLIENT_APIS))

DEEPCOPY_SOURCES = $(CLIENT_SOURCES)
Expand Down
2 changes: 1 addition & 1 deletion demo/specs/quickstart/gpu-test-mps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
opaque:
driver: gpu.nvidia.com
parameters:
apiVersion: gpu.nvidia.com/v1alpha1
apiVersion: resource.nvidia.com/v1beta1
kind: GpuConfig
sharing:
strategy: MPS
Expand Down
4 changes: 2 additions & 2 deletions demo/specs/quickstart/gpu-test5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
opaque:
driver: gpu.nvidia.com
parameters:
apiVersion: gpu.nvidia.com/v1alpha1
apiVersion: resource.nvidia.com/v1beta1
kind: GpuConfig
sharing:
strategy: TimeSlicing
Expand All @@ -36,7 +36,7 @@ spec:
opaque:
driver: gpu.nvidia.com
parameters:
apiVersion: gpu.nvidia.com/v1alpha1
apiVersion: resource.nvidia.com/v1beta1
kind: GpuConfig
sharing:
strategy: MPS
Expand Down
2 changes: 1 addition & 1 deletion demo/specs/quickstart/gpu-test6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
opaque:
driver: gpu.nvidia.com
parameters:
apiVersion: gpu.nvidia.com/v1alpha1
apiVersion: resource.nvidia.com/v1beta1
kind: GpuConfig
sharing:
strategy: TimeSlicing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: computedomains.gpu.nvidia.com
name: computedomains.resource.nvidia.com
spec:
group: gpu.nvidia.com
group: resource.nvidia.com
names:
kind: ComputeDomain
listKind: ComputeDomainList
plural: computedomains
singular: computedomain
scope: Namespaced
versions:
- name: v1alpha1
- name: v1beta1
schema:
openAPIV3Schema:
description: ComputeDomain prepares a set of nodes to run a multi-node workload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: computedomains.gpu.nvidia.com
name: computedomains.resource.nvidia.com
spec:
group: gpu.nvidia.com
group: resource.nvidia.com
names:
kind: ComputeDomain
listKind: ComputeDomainList
plural: computedomains
singular: computedomain
scope: Namespaced
versions:
- name: v1alpha1
- name: v1beta1
schema:
openAPIV3Schema:
description: ComputeDomain prepares a set of nodes to run a multi-node workload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: {{ include "k8s-dra-driver.fullname" . }}-role
namespace: {{ include "k8s-dra-driver.namespace" . }}
rules:
- apiGroups: ["gpu.nvidia.com"]
- apiGroups: ["resource.nvidia.com"]
resources: ["computedomains"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["resource.k8s.io"]
Expand Down
2 changes: 1 addition & 1 deletion pkg/flags/kubeclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"

nvclientset "github.com/NVIDIA/k8s-dra-driver/pkg/nvidia.com/resource/clientset/versioned"
nvclientset "github.com/NVIDIA/k8s-dra-driver/pkg/nvidia.com/clientset/versioned"
)

type KubeClientConfig struct {
Expand Down
Loading

0 comments on commit fa8bce2

Please sign in to comment.