Skip to content
Merged
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
7 changes: 3 additions & 4 deletions internal/webhook/v1/pod_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/util/strategicpatch"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -273,7 +272,7 @@
}

func (m *TensorFusionPodMutator) patchTFClient(
ctx context.Context,

Check failure on line 275 in internal/webhook/v1/pod_webhook.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

(*TensorFusionPodMutator).patchTFClient - ctx is unused (unparam)
pod *corev1.Pod,
pool *tfv1.GPUPool,
isLocalGPU bool,
Expand All @@ -294,8 +293,8 @@
// Index must be assigned in webhook stage since scheduler cannot modify Pod
// This is a special index resource (1-512), not a real device resource
// Index is assigned in ascending order (1, 2, 3, ...) via distributed lock (leader election)
index := m.assignDeviceAllocationIndex(ctx, pod)
log.FromContext(ctx).Info("assigned device allocation index successfully", "index", index, "pod", pod.Name)
// index := m.assignDeviceAllocationIndex(ctx, pod)
// log.FromContext(ctx).Info("assigned device allocation index successfully", "index", index, "pod", pod.Name)

for _, containerIndex := range containerIndices {
container := &pod.Spec.Containers[containerIndex]
Expand Down Expand Up @@ -332,7 +331,7 @@
container.Resources.Limits = make(corev1.ResourceList)
}
// Limit is set to actual index value (1-512) for Device Plugin to match Pod
container.Resources.Limits[constants.PodIndexAnnotation] = resource.MustParse(strconv.Itoa(index))
// container.Resources.Limits[constants.PodIndexAnnotation] = resource.MustParse(strconv.Itoa(index))

if !isLocalGPU {
addConnectionForRemoteFixedReplicaVirtualGPU(pod, container, clientConfig)
Expand Down Expand Up @@ -378,7 +377,7 @@
return patches, nil
}

func (m *TensorFusionPodMutator) assignDeviceAllocationIndex(ctx context.Context, pod *corev1.Pod) int {

Check failure on line 380 in internal/webhook/v1/pod_webhook.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

func (*TensorFusionPodMutator).assignDeviceAllocationIndex is unused (unused)
var index int
var indexErr error
podIdentifier := pod.Name
Expand Down Expand Up @@ -599,7 +598,7 @@
return strconv.Atoi(string(body))
}

func (m *TensorFusionPodMutator) assignIndexFromLeader(ctx context.Context, pod *corev1.Pod) (int, error) {

Check failure on line 601 in internal/webhook/v1/pod_webhook.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

func (*TensorFusionPodMutator).assignIndexFromLeader is unused (unused)
leaderIP := utils.GetLeaderIP(m.Client)
if leaderIP == "" {
return 0, fmt.Errorf("operator leader IP not found")
Expand Down
Loading