Skip to content

Commit a39d7b2

Browse files
committed
refactor: change device to nx.device.power.ibm.com
Signed-off-by: Paul Bastide <[email protected]>
1 parent 9a616e4 commit a39d7b2

File tree

12 files changed

+72
-72
lines changed

12 files changed

+72
-72
lines changed

api/powervs-openshift-ipi.cis.ibm.net/resource/gpu/v1alpha1/api.go renamed to api/nx.device.power.ibm.com/resource/nx/v1alpha1/api.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import (
2424
)
2525

2626
const (
27-
GroupName = "gpu.powervs-openshift-ipi.cis.ibm.net"
28-
Version = "v1alpha1"
29-
GpuConfigKind = "GpuConfig"
27+
GroupName = "device.power.ibm.com"
28+
Version = "v1alpha1"
29+
NxConfigKind = "NxConfig"
3030
)
3131

3232
// Decoder implements a decoder for objects in this API group.
@@ -43,7 +43,7 @@ func init() {
4343
Version: Version,
4444
}
4545
scheme.AddKnownTypes(schemeGroupVersion,
46-
&GpuConfig{},
46+
&NxConfig{},
4747
)
4848
metav1.AddToGroupVersion(scheme, schemeGroupVersion)
4949

api/powervs-openshift-ipi.cis.ibm.net/resource/gpu/v1alpha1/doc.go renamed to api/nx.device.power.ibm.com/resource/nx/v1alpha1/doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ limitations under the License.
1515
*/
1616

1717
// +k8s:deepcopy-gen=packages
18-
// +groupName=gpu.powervs-openshift-ipi.cis.ibm.net
18+
// +groupName=nx.device.power.ibm.com
1919

2020
package v1alpha1

api/powervs-openshift-ipi.cis.ibm.net/resource/gpu/v1alpha1/gpuconfig.go renamed to api/nx.device.power.ibm.com/resource/nx/v1alpha1/nxconfig.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ import (
2525
// +genclient
2626
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
2727

28-
// GpuConfig holds the set of parameters for configuring a GPU.
29-
type GpuConfig struct {
28+
// NxConfig holds the set of parameters for configuring a Nest Accelerator.
29+
type NxConfig struct {
3030
metav1.TypeMeta `json:",inline"`
31-
Sharing *GpuSharing `json:"sharing,omitempty"`
31+
Sharing *NxSharing `json:"sharing,omitempty"`
3232
}
3333

34-
// DefaultGpuConfig provides the default GPU configuration.
35-
func DefaultGpuConfig() *GpuConfig {
36-
return &GpuConfig{
34+
// DefaultNxConfig provides the default NX configuration.
35+
func DefaultNxConfig() *NxConfig {
36+
return &NxConfig{
3737
TypeMeta: metav1.TypeMeta{
3838
APIVersion: GroupName + "/" + Version,
39-
Kind: GpuConfigKind,
39+
Kind: NxConfigKind,
4040
},
41-
Sharing: &GpuSharing{
41+
Sharing: &NxSharing{
4242
Strategy: TimeSlicingStrategy,
4343
TimeSlicingConfig: &TimeSlicingConfig{
4444
Interval: "Default",
@@ -47,13 +47,13 @@ func DefaultGpuConfig() *GpuConfig {
4747
}
4848
}
4949

50-
// Normalize updates a GpuConfig config with implied default values based on other settings.
51-
func (c *GpuConfig) Normalize() error {
50+
// Normalize updates a NxConfig config with implied default values based on other settings.
51+
func (c *NxConfig) Normalize() error {
5252
if c == nil {
5353
return fmt.Errorf("config is 'nil'")
5454
}
5555
if c.Sharing == nil {
56-
c.Sharing = &GpuSharing{
56+
c.Sharing = &NxSharing{
5757
Strategy: TimeSlicingStrategy,
5858
}
5959
}

api/powervs-openshift-ipi.cis.ibm.net/resource/gpu/v1alpha1/sharing.go renamed to api/nx.device.power.ibm.com/resource/nx/v1alpha1/sharing.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222

2323
// These constants represent the different Sharing strategies.
2424
const (
25-
TimeSlicingStrategy GpuSharingStrategy = "TimeSlicing"
26-
SpacePartitioningStrategy GpuSharingStrategy = "SpacePartitioning"
25+
TimeSlicingStrategy NxSharingStrategy = "TimeSlicing"
26+
SpacePartitioningStrategy NxSharingStrategy = "SpacePartitioning"
2727
)
2828

2929
// These constants represent the different TimeSlicing configurations.
@@ -34,17 +34,17 @@ const (
3434
LongTimeSlice TimeSliceInterval = "Long"
3535
)
3636

37-
// GpuSharingStrategy defines the valid Sharing strategies as a string.
38-
type GpuSharingStrategy string
37+
// NxSharingStrategy defines the valid Sharing strategies as a string.
38+
type NxSharingStrategy string
3939

4040
// TimeSliceInterval defines the valid timeslice interval as a string.
4141
type TimeSliceInterval string
4242

43-
// GpuSharing holds the current sharing strategy for GPUs and its settings.
43+
// NxSharing holds the current sharing strategy for Nxs and its settings.
4444
// If DeviceClass and ResourceClaim set this, then the strategy from the claim
4545
// is used. If multiple configurations set this, then the last one is used.
46-
type GpuSharing struct {
47-
Strategy GpuSharingStrategy `json:"strategy"`
46+
type NxSharing struct {
47+
Strategy NxSharingStrategy `json:"strategy"`
4848
TimeSlicingConfig *TimeSlicingConfig `json:"timeSlicingConfig,omitempty"`
4949
SpacePartitioningConfig *SpacePartitioningConfig `json:"spacePartitioningConfig,omitempty"`
5050
}
@@ -57,29 +57,29 @@ type TimeSlicingConfig struct {
5757
// SpacePartitioningConfig provides the configuring for the SpacePartitioning strategy.
5858
type SpacePartitioningConfig struct {
5959
// SliceCount indicates how many equally sized (memory and compute) slices
60-
// the GPU should be divided into. Each client that attaches will get
60+
// the Nx should be divided into. Each client that attaches will get
6161
// access to exactly one of these slices.
6262
PartitionCount int `json:"partitionCount,omitempty"`
6363
}
6464

6565
// IsTimeSlicing checks if the TimeSlicing strategy is applied.
66-
func (s *GpuSharing) IsTimeSlicing() bool {
66+
func (s *NxSharing) IsTimeSlicing() bool {
6767
if s == nil {
6868
return false
6969
}
7070
return s.Strategy == TimeSlicingStrategy
7171
}
7272

7373
// IsSpacePartitioning checks if the SpacePartitioning strategy is applied.
74-
func (s *GpuSharing) IsSpacePartitioning() bool {
74+
func (s *NxSharing) IsSpacePartitioning() bool {
7575
if s == nil {
7676
return false
7777
}
7878
return s.Strategy == SpacePartitioningStrategy
7979
}
8080

8181
// GetTimeSlicingConfig returns the timeslicing config that applies to the given strategy.
82-
func (s *GpuSharing) GetTimeSlicingConfig() (*TimeSlicingConfig, error) {
82+
func (s *NxSharing) GetTimeSlicingConfig() (*TimeSlicingConfig, error) {
8383
if s == nil {
8484
return nil, fmt.Errorf("no sharing set to get config from")
8585
}
@@ -93,7 +93,7 @@ func (s *GpuSharing) GetTimeSlicingConfig() (*TimeSlicingConfig, error) {
9393
}
9494

9595
// GetSpacePartitioningConfig returns the SpacePartitioning config that applies to the given strategy.
96-
func (s *GpuSharing) GetSpacePartitioningConfig() (*SpacePartitioningConfig, error) {
96+
func (s *NxSharing) GetSpacePartitioningConfig() (*SpacePartitioningConfig, error) {
9797
if s == nil {
9898
return nil, fmt.Errorf("no sharing set to get config from")
9999
}

api/powervs-openshift-ipi.cis.ibm.net/resource/gpu/v1alpha1/validate.go renamed to api/nx.device.power.ibm.com/resource/nx/v1alpha1/validate.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ import (
2020
"fmt"
2121
)
2222

23-
// Validate ensures that GpuSharingStrategy has a valid set of values.
24-
func (s GpuSharingStrategy) Validate() error {
23+
// Validate ensures that NxSharingStrategy has a valid set of values.
24+
func (s NxSharingStrategy) Validate() error {
2525
switch s {
2626
case TimeSlicingStrategy, SpacePartitioningStrategy:
2727
return nil
2828
}
29-
return fmt.Errorf("unknown GPU sharing strategy: %v", s)
29+
return fmt.Errorf("unknown Nx sharing strategy: %v", s)
3030
}
3131

3232
// Validate ensures that TimeSliceInterval has a valid set of values.
@@ -51,8 +51,8 @@ func (c *SpacePartitioningConfig) Validate() error {
5151
return nil
5252
}
5353

54-
// Validate ensures that GpuSharing has a valid set of values.
55-
func (s *GpuSharing) Validate() error {
54+
// Validate ensures that NxSharing has a valid set of values.
55+
func (s *NxSharing) Validate() error {
5656
if err := s.Strategy.Validate(); err != nil {
5757
return err
5858
}
@@ -62,11 +62,11 @@ func (s *GpuSharing) Validate() error {
6262
case s.IsSpacePartitioning():
6363
return s.SpacePartitioningConfig.Validate()
6464
}
65-
return fmt.Errorf("invalid GPU sharing settings: %v", s)
65+
return fmt.Errorf("invalid Nx sharing settings: %v", s)
6666
}
6767

68-
// Validate ensures that GpuConfig has a valid set of values.
69-
func (c *GpuConfig) Validate() error {
68+
// Validate ensures that NxConfig has a valid set of values.
69+
func (c *NxConfig) Validate() error {
7070
if c.Sharing == nil {
7171
return fmt.Errorf("no sharing strategy set")
7272
}

api/powervs-openshift-ipi.cis.ibm.net/resource/gpu/v1alpha1/zz_generated.deepcopy.go renamed to api/nx.device.power.ibm.com/resource/nx/v1alpha1/zz_generated.deepcopy.go

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/power-dra-kubeletplugin/cdi.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727

2828
const (
2929
cdiVendor = "k8s." + DriverName
30-
cdiClass = "gpu"
30+
cdiClass = "nx"
3131
cdiKind = cdiVendor + "/" + cdiClass
3232

3333
cdiCommonDeviceName = "common"
@@ -93,7 +93,7 @@ func (cdi *CDIHandler) CreateClaimSpecFile(claimUID string, devices PreparedDevi
9393
claimEdits := cdiapi.ContainerEdits{
9494
ContainerEdits: &cdispec.ContainerEdits{
9595
Env: []string{
96-
fmt.Sprintf("GPU_DEVICE_%s_RESOURCE_CLAIM=%s", device.DeviceName[4:], claimUID),
96+
fmt.Sprintf("Nx_DEVICE_%s_RESOURCE_CLAIM=%s", device.DeviceName[4:], claimUID),
9797
},
9898
},
9999
}

cmd/power-dra-kubeletplugin/discovery.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ import (
2828
"github.com/google/uuid"
2929
)
3030

31-
func enumerateAllPossibleDevices(numGPUs int) (AllocatableDevices, error) {
31+
func enumerateAllPossibleDevices(numNx int) (AllocatableDevices, error) {
3232
seed := os.Getenv("NODE_NAME")
33-
uuids := generateUUIDs(seed, numGPUs)
33+
uuids := generateUUIDs(seed, numNx)
3434

3535
alldevices := make(AllocatableDevices)
3636
for i, uuid := range uuids {
3737
device := resourceapi.Device{
38-
Name: fmt.Sprintf("gpu-%d", i),
38+
Name: fmt.Sprintf("nx-%d", i),
3939
Basic: &resourceapi.BasicDevice{
4040
Attributes: map[resourceapi.QualifiedName]resourceapi.DeviceAttribute{
4141
"index": {
@@ -45,7 +45,7 @@ func enumerateAllPossibleDevices(numGPUs int) (AllocatableDevices, error) {
4545
StringValue: ptr.To(uuid),
4646
},
4747
"model": {
48-
StringValue: ptr.To("LATEST-GPU-MODEL"),
48+
StringValue: ptr.To("LATEST-NX-MODEL"),
4949
},
5050
"driverVersion": {
5151
VersionValue: ptr.To("0.1.0"),
@@ -71,7 +71,7 @@ func generateUUIDs(seed string, count int) []string {
7171
charset := make([]byte, 16)
7272
rand.Read(charset)
7373
uuid, _ := uuid.FromBytes(charset)
74-
uuids[i] = "gpu-" + uuid.String()
74+
uuids[i] = "nx-" + uuid.String()
7575
}
7676

7777
return uuids

cmd/power-dra-kubeletplugin/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232
)
3333

3434
const (
35-
DriverName = "gpu.powervs-openshift-ipi.cis.ibm.net"
35+
DriverName = "nx.device.power.ibm.com"
3636

3737
PluginRegistrationPath = "/var/lib/kubelet/plugins/" + DriverName + ".sock"
3838
DriverPluginPath = "/var/lib/kubelet/plugins/" + DriverName

0 commit comments

Comments
 (0)