Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions internal/controller/composableresource_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,15 @@ func (r *ComposableResourceReconciler) handleAttachingState(ctx context.Context,
if err := r.Status().Update(ctx, resource); err != nil {
return r.requeueOnErr(resource, err, "failed to update composableResource", "composableResource", resource.Name)
}
return ctrl.Result{}, err
}
if err := utils.TerminateKubeletPluginPodOnNode(ctx, r.Clientset, resource.Spec.TargetNode); err != nil {
composableResourceLog.Error(err, "failed to restart DRA kubelet plugin", "composableResource", resource.Name)
resource.Status.Error = err.Error()
if err := r.Status().Update(ctx, resource); err != nil {
return r.requeueOnErr(resource, err, "failed to update composableResource", "composableResource", resource.Name)
}
return ctrl.Result{}, err
}
}

Expand Down
7 changes: 6 additions & 1 deletion internal/controller/composableresource_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,10 @@ var _ = Describe("ComposableResource Controller", Ordered, func() {
if tc.expectedReconcileError != "" {
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(Equal(tc.expectedReconcileError))
if tc.expectedRequestStatus != nil {
Expect(composableResource).NotTo(BeNil())
Expect(composableResource.Status).To(Equal(*tc.expectedRequestStatus))
}
} else if tc.expectedRequestDeleted {
Expect(err).NotTo(HaveOccurred())
Expect(composableResource).NotTo(BeNil())
Expand Down Expand Up @@ -2525,7 +2529,7 @@ var _ = Describe("ComposableResource Controller", Ordered, func() {

expectedReconcileError: "an error occurred with the resource in CM: 'add failed due to some reasons'",
}),
Entry("should return error message when nvidia-device-plugin-daemonset pod can not be found in cluster", testcase{
Entry("should return an error and remain Attaching when the nvidia-driver-daemonset pod cannot be found", testcase{
tenant_uuid: "tenant00-uuid-temp-0000-000000000000",
cluster_uuid: "cluster0-uuid-temp-0000-000000000001",

Expand Down Expand Up @@ -2616,6 +2620,7 @@ var _ = Describe("ComposableResource Controller", Ordered, func() {
composableResourceStatus.CDIDeviceID = "GPU-device00-uuid-temp-0000-000000000res"
return composableResourceStatus
}(),
expectedReconcileError: "nvidia-driver-daemonset pod is not found on node worker-0",
}),
Entry("should wait when dra-driver-nvidia-gpu-kubelet-plugin Daemonset can not be found in cluster", testcase{
tenant_uuid: "tenant00-uuid-temp-0000-000000000000",
Expand Down