Skip to content

Commit d47b6c8

Browse files
authored
fix: typo (#47)
1 parent 60743c4 commit d47b6c8

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

api/v1/gpu_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ const (
5555
// +kubebuilder:resource:scope=Cluster
5656
// +kubebuilder:printcolumn:name="GPU Model",type="string",JSONPath=".spec.gpuModel"
5757
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
58-
// +kubebuilder:printcolumn:name="Total TFlops",type="string",JSONPath=".status.capacity.flops"
58+
// +kubebuilder:printcolumn:name="Total TFlops",type="string",JSONPath=".status.capacity.tflops"
5959
// +kubebuilder:printcolumn:name="Total VRAM",type="string",JSONPath=".status.capacity.vram"
60-
// +kubebuilder:printcolumn:name="Available TFlops",type="string",JSONPath=".status.available.flops"
60+
// +kubebuilder:printcolumn:name="Available TFlops",type="string",JSONPath=".status.available.tflops"
6161
// +kubebuilder:printcolumn:name="Available VRAM",type="string",JSONPath=".status.available.vram"
6262
// +kubebuilder:printcolumn:name="Device UUID",type="string",JSONPath=".status.uuid"
6363
// GPU is the Schema for the gpus API.

charts/tensor-fusion/crds/tensor-fusion.ai_gpus.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ spec:
2121
- jsonPath: .status.phase
2222
name: Phase
2323
type: string
24-
- jsonPath: .status.capacity.flops
24+
- jsonPath: .status.capacity.tflops
2525
name: Total TFlops
2626
type: string
2727
- jsonPath: .status.capacity.vram
2828
name: Total VRAM
2929
type: string
30-
- jsonPath: .status.available.flops
30+
- jsonPath: .status.available.tflops
3131
name: Available TFlops
3232
type: string
3333
- jsonPath: .status.available.vram

config/crd/bases/tensor-fusion.ai_gpus.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ spec:
2121
- jsonPath: .status.phase
2222
name: Phase
2323
type: string
24-
- jsonPath: .status.capacity.flops
24+
- jsonPath: .status.capacity.tflops
2525
name: Total TFlops
2626
type: string
2727
- jsonPath: .status.capacity.vram
2828
name: Total VRAM
2929
type: string
30-
- jsonPath: .status.available.flops
30+
- jsonPath: .status.available.tflops
3131
name: Available TFlops
3232
type: string
3333
- jsonPath: .status.available.vram

internal/controller/node_controller.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,16 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
102102
// Skip creation if the GPUNode already exists
103103
gpuNode := &tfv1.GPUNode{}
104104
if err := r.Client.Get(ctx, client.ObjectKey{Name: node.Name}, gpuNode); err != nil {
105-
if errors.IsNotFound(err) || gpuNode.Status.KubernetesNodeName == "" {
106-
newGPUNode := r.generateGPUNode(node, pool)
105+
if errors.IsNotFound(err) {
106+
gpuNode = r.generateGPUNode(node, pool)
107107
// Set owner reference to cascade delete after GPU node created
108-
if err := controllerutil.SetControllerReference(node, newGPUNode, r.Scheme); err != nil {
108+
if err := controllerutil.SetControllerReference(node, gpuNode, r.Scheme); err != nil {
109109
return ctrl.Result{}, fmt.Errorf("failed to set controller reference: %w", err)
110110
}
111-
_, e := controllerutil.CreateOrUpdate(ctx, r.Client, newGPUNode, nil)
111+
_, e := controllerutil.CreateOrUpdate(ctx, r.Client, gpuNode, nil)
112112
if e != nil {
113113
return ctrl.Result{}, fmt.Errorf("failed to create or patch GPUNode: %w", e)
114114
}
115-
116-
newGPUNode.InitializeStatus(resource.Quantity{}, resource.Quantity{}, 0)
117-
newGPUNode.Status.KubernetesNodeName = node.Name
118-
if err := r.Client.Status().Update(ctx, newGPUNode); err != nil {
119-
return ctrl.Result{}, fmt.Errorf("can not add Kubernetes Node info into gpuNode(%s) status : %w", newGPUNode.Name, err)
120-
}
121-
log.Info("Created GPUNode due to selector matched", "name", newGPUNode.Name)
122115
}
123116
} else {
124117
// GPUNode resource already exists, indicate node has been changed
@@ -129,6 +122,15 @@ func (r *NodeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
129122
return ctrl.Result{}, fmt.Errorf("can not update gpuNode(%s) annotation : %w", gpuNode.Name, err)
130123
}
131124
}
125+
126+
if gpuNode.Status.KubernetesNodeName == "" {
127+
gpuNode.InitializeStatus(resource.Quantity{}, resource.Quantity{}, 0)
128+
gpuNode.Status.KubernetesNodeName = node.Name
129+
if err := r.Client.Status().Update(ctx, gpuNode); err != nil {
130+
return ctrl.Result{}, fmt.Errorf("can not add Kubernetes Node info into gpuNode(%s) status : %w", gpuNode.Name, err)
131+
}
132+
log.Info("Created GPUNode due to selector matched", "name", gpuNode.Name)
133+
}
132134
}
133135

134136
return ctrl.Result{}, nil

0 commit comments

Comments
 (0)