Commit Graph

14 Commits

Author SHA1 Message Date
Dmitry Rozhkov
4a1b311e62 fix up misspelling 2018-06-15 15:25:43 +03:00
Dmitry Rozhkov
9800f5a5e6 run gofmt -s 2018-06-15 15:23:49 +03:00
Dmitry Rozhkov
979a8357c8 add regiondevel mode to fpga_plugin
In the `af` mode the plugin announces AFUs and tells kubelet
to pass only AFU ports to containers.

In the `region` mode the plugin announces region interfaces and tells
kubelet to pass only AFU ports to containers.

In the `regiondevel` mode the plugin announces region interfaces and
tells kubelet to pass AFU ports and FME devices to containers, so the
conteainers have full access to the regions.
2018-06-15 12:28:16 +03:00
Dmitry Rozhkov
80b7b03576 fpga_plugin: refactor FPGA scans
This refactoring brings in device Cache running in its own
thread and scanning FPGA devices once every 5 secs. Then no timers
are used inside ListAndWatch() method of device managers and
no need to run scanning periodically in every device manager's
thread.

Cache generates update events and the plugin creates, updates or
deletes device managers on the fly upon receiving the events.

Introducing new modes of operations is a matter of adding a single
function converting and filtering the content of Cache.
2018-06-15 11:54:52 +03:00
Ed Bartosh
ce2437d5ec fix go_vet error reported by goreportcard.com
Fixed go_vet error:
 Line 413: error: TestisValidPluginMode has malformed name: first letter after 'Test' must not be lowercase (vet)
2018-05-29 10:50:52 +03:00
Ed Bartosh
6a3953fc85 reformatted *.go with gofmt -s -w
This is done to fix https://goreportcard.com warnnigs:

gofmt 33%
Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command

intel-device-plugins-for-kubernetes/cmd/fpga_plugin/fpga_plugin_test.go
Line 1: warning: file is not gofmted with -s (gofmt)

intel-device-plugins-for-kubernetes/internal/deviceplugin/deviceplugin_test.go
Line 1: warning: file is not gofmted with -s (gofmt)

intel-device-plugins-for-kubernetes/cmd/gpu_plugin/gpu_plugin_test.go
Line 1: warning: file is not gofmted with -s (gofmt)

intel-device-plugins-for-kubernetes/cmd/fpga_plugin/fpga_plugin.go
Line 1: warning: file is not gofmted with -s (gofmt)
2018-05-28 16:59:19 +03:00
Ed Bartosh
7310a98343 fix golint warnings
Fixed the following golint warnings:
./cmd/fpga_plugin/fpga_plugin.go:71:2: struct field fpgaId should be fpgaID
./cmd/fpga_plugin/fpga_plugin.go:78:44: func parameter fpgaId should be fpgaID
./cmd/fpga_plugin/fpga_plugin.go:104:8: var interfaceId should be interfaceID
./cmd/fpga_plugin/fpga_plugin.go:120:7: var interfaceIdFile should be interfaceIDFile
./cmd/fpga_plugin/fpga_plugin.go:156:8: range var fpgaId should be fpgaID
./cmd/fpga_plugin/fpga_plugin.go:254:6: range var fpgaId should be fpgaID
./cmd/fpga_plugin/fpga_plugin.go:254:14: should omit 2nd value from range; this loop is equivalent to `for fpgaId := range ...`
./internal/deviceplugin/deviceplugin.go:30:6: exported type DeviceInfo should have comment or be unexported
./internal/deviceplugin/deviceplugin.go:35:6: exported type Server should have comment or be unexported
./internal/deviceplugin/deviceplugin.go:39:1: exported method Server.Serve should have comment or be unexported
./internal/deviceplugin/deviceplugin.go:43:1: exported method Server.Stop should have comment or be unexported
2018-05-28 16:53:37 +03:00
Ed Bartosh
8a8971ed5c fpga: add prefix to FPGA resource name
Added mode ("af" or "region") prefix to the resource name to
distingush between announced functions and regions, e.g.
 intel.com/fpga-af-f7df405cbd7acf7222f144b0b93acd18
 intel.com/fpga-region-ce48969398f05f33946d560708be108a
2018-05-28 15:38:09 +03:00
Ed Bartosh
983245b5a9 Reworked README.md
Split into 3 parts:
- main part with high level description of the repository
- Build and test Intel GPU Device Plugin for Kubernetes
- Build and test Intel FPGA Device Plugin for Kubernetes

Added Intel logo to the main README.md

Fixes #2
2018-05-25 10:31:53 +03:00
Ed Bartosh
4ef2705a8a use glog.Error when mode is incorrect
Using glog.Fatal produces stacktrace, which looks quite scary
for this simple case:
$ ./fpga_plugin -mode bla
F0523 15:17:57.997937   11555 fpga_plugin.go:237] Wrong mode: bla
goroutine 1 [running]:
github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog.stacks(0xc420214000, 0xc42018e000, 0x42, 0x8f)
	/home/ed/go/src/github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog/glog.go:769 +0xcf
github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog.(*loggingT).output(0xbf72c0, 0xc400000003, 0xc4200bea50, 0xba3309, 0xe, 0xed, 0x0)
	/home/ed/go/src/github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog/glog.go:720 +0x32d
github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog.(*loggingT).printDepth(0xbf72c0, 0x7f4500000003, 0x1, 0xc420079ec8, 0x2, 0x2)
	/home/ed/go/src/github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog/glog.go:646 +0x129
github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog.(*loggingT).print(0xbf72c0, 0x3, 0xc420079ec8, 0x2, 0x2)
	/home/ed/go/src/github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog/glog.go:637 +0x5a
github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog.Fatal(0xc420079ec8, 0x2, 0x2)
	/home/ed/go/src/github.com/intel/intel-device-plugins-for-kubernetes/vendor/github.com/golang/glog/glog.go:1128 +0x53
main.main()
	/home/ed/go/src/github.com/intel/intel-device-plugins-for-kubernetes/cmd/fpga_plugin/fpga_plugin.go:237 +0x5fb
2018-05-23 15:20:51 +03:00
Dmitry Rozhkov
49840e9720 fpga: add mode CLI switch
By default the fpga plugin announce regions' interface IDs. With
added `-mode af` switch the plugins announces IDs of accelerator
functions instead of regions.
2018-05-21 15:45:38 +03:00
Dmitry Rozhkov
7e830d7953 fpga: refactor afuID to fpgaId
We are going to use not only afu ids, but also regions' interface
ids as device identificators in future.
2018-05-21 12:23:04 +03:00
Dmitry Rozhkov
390d8583e9 init struct with explicit field names to avoid formatting warning 2018-05-21 11:05:13 +03:00
Alexander Kanevskiy
d4d77a71e4 Initial public code release 2018-05-18 18:30:54 +03:00