Skip to content

Commit cf046b0

Browse files
authored
fix: add test case for pod controller (#306)
1 parent 87a0fcf commit cf046b0

File tree

5 files changed

+528
-12
lines changed

5 files changed

+528
-12
lines changed

internal/constants/constants.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ const (
4949

5050
LastSyncTimeAnnotationKey = Domain + "/last-sync"
5151
WorkloadKey = Domain + "/workload"
52-
GpuPoolKey = Domain + "/gpupool"
52+
53+
GpuPoolKey = Domain + "/gpupool"
5354

5455
// Annotation key constants
5556
GpuCountAnnotation = Domain + "/gpu-count"
@@ -70,6 +71,8 @@ const (
7071
GPUDeviceIDsAnnotation = Domain + "/gpu-ids"
7172
SetPendingOwnedWorkloadAnnotation = Domain + "/pending-owned-workload"
7273
PricingAnnotation = Domain + "/hourly-pricing"
74+
// In remote vGPU mode, selected workload is set by user with /workload annotation or generated by system
75+
SelectedWorkloadAnnotation = Domain + "/selected-workload"
7376

7477
WorkloadModeAnnotation = Domain + "/workload-mode"
7578
WorkloadModeDynamic = "dynamic"

internal/controller/pod_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func (r *PodReconciler) setPendingOwnedWorkload(ctx context.Context, pod *corev1
172172
}
173173

174174
func buildTensorFusionConnectionObj(pod *corev1.Pod) *tfv1.TensorFusionConnection {
175-
workloadName, ok := pod.Labels[constants.WorkloadKey]
175+
workloadName, ok := pod.Annotations[constants.SelectedWorkloadAnnotation]
176176
if !ok {
177177
return nil
178178
}

0 commit comments

Comments
 (0)