Commit 031aaeb
committed
plugins: avoid DeviceSpec and Mount copies
k8s/kubelet 1.34 updates its protocol buffer definitions and
triggers the following linter errors for pluginapi DeviceSpec and
Mount used in our code:
copylocks: range var mount copies lock: k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1.Mount
contains google.golang.org/protobuf/runtime/protoimpl.MessageState contains sync.Mutex (govet
In most cases we loop a slice of pluginapi.DeviceSpec/Mount and taking
an instance of an element is copying. This can be avoided by accessing each
element from the slice directly using a range loop index instead.
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>1 parent d9fcdf8 commit 031aaeb
File tree
4 files changed
+26
-28
lines changed- cmd
- gpu_plugin
- npu_plugin
- pkg/deviceplugin
4 files changed
+26
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
575 | | - | |
| 575 | + | |
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| |||
585 | 585 | | |
586 | 586 | | |
587 | 587 | | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | 588 | | |
596 | 589 | | |
597 | 590 | | |
| |||
645 | 638 | | |
646 | 639 | | |
647 | 640 | | |
648 | | - | |
649 | | - | |
| 641 | + | |
| 642 | + | |
650 | 643 | | |
651 | 644 | | |
652 | 645 | | |
653 | 646 | | |
654 | 647 | | |
655 | | - | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
656 | 654 | | |
657 | | - | |
658 | 655 | | |
659 | 656 | | |
660 | 657 | | |
| |||
677 | 674 | | |
678 | 675 | | |
679 | 676 | | |
680 | | - | |
| 677 | + | |
681 | 678 | | |
682 | | - | |
683 | | - | |
684 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
685 | 682 | | |
686 | 683 | | |
687 | 684 | | |
688 | | - | |
| 685 | + | |
689 | 686 | | |
690 | | - | |
691 | | - | |
| 687 | + | |
| 688 | + | |
692 | 689 | | |
693 | 690 | | |
694 | 691 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
874 | 874 | | |
875 | 875 | | |
876 | 876 | | |
877 | | - | |
878 | | - | |
879 | | - | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
880 | 880 | | |
881 | 881 | | |
882 | | - | |
883 | | - | |
| 882 | + | |
| 883 | + | |
884 | 884 | | |
885 | 885 | | |
886 | 886 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
174 | 175 | | |
175 | 176 | | |
176 | | - | |
| 177 | + | |
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
| 63 | + | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
0 commit comments