Commit Graph

46 Commits

Author SHA1 Message Date
Mikko Ylinen
1b3accacc2 docs: rework development guide
Currently, each individual plugin README documents roughly the same
daily development steps to git clone, build, and deploy. Re-purpose
the plugin READMEs more towards cluster admin type of documentation
and start moving all development related documentation to DEVEL.md.

The same is true for e2e testing documentation which is scattered
in places where they don't belong to. Having all day-to-day
development Howtos is good to have in a centralized place.

Finally, the cleanup includes some harmonization to plugins'
table of contents which now follows the pattern:

* [Introduction](#introduction)
(* [Modes and Configuration Options](#modes-and-configuration-options))
* [Installation](#installation)
    (* [Prerequisites](#prerequisites))
    * [Pre-built Images](#pre-built-images)
    * [Verify Plugin Registration](#verify-plugin-registration)
* [Testing and Demos](#testing-and-demos)
    * ...

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2022-08-31 20:00:15 +03:00
Ed Bartosh
cec004c398 lint: enable wsl check
Fixes: #392

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2021-12-17 11:48:48 +02:00
Hyeongju Johannes Lee
8fc5df7e37 Add govet-fieldalignment
Add govet-fieldalignment to .golangci.yml
Fix errors that come from adding govet-fieldalignment
- by reordering the fields of structs
- by putting nolint:govet annotations

Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
2021-09-20 20:59:04 +03:00
Hyeongju Johannes Lee
4bc70ac544 Add goerr113 linter check
Add goerr113 lintercheck
Fix the usage of fmt.Errorf() by wrapping errors
Fix the usage of errors.New()
2021-09-03 11:02:14 +03:00
Mikko Ylinen
facb4214a2 tree-wide: drop deprecated io/ioutil
Go 1.16 release notes announced the deprecation of io/ioutil [1]. It's easy
for us to move to use what is was recommended so just do it.

[1] https://golang.org/doc/go1.16#ioutil

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2021-06-02 13:41:15 +03:00
Mikko Ylinen
0892a34705 move to k8s.io v1.20.x and klog/v2 v2.4.0
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2021-01-21 15:34:39 +02:00
Ed Bartosh
2e7367eab3 fpga hook: language cleanup
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2020-12-10 10:58:40 +02:00
Kevin Putnam
1d149ffee6 Documentation: Fixes broken links and standardizes headers.
Signed-off-by: Kevin Putnam <kevin.putnam@intel.com>
2020-09-22 08:32:21 -07:00
Dmitry Rozhkov
1b82ab9df6 sync README.md files with the current state of the code
Closes #356
2020-09-16 10:54:39 +03:00
Dmitry Rozhkov
73aea0aa1b linter: enable gosec check 2020-06-11 17:56:24 +03:00
Dmitry Rozhkov
70f862f2aa add golangci linter
In this initial commit the following checks are disabled due to
excessive amount of changes required:
- dupl (duplicate code)
- funlen (function length)
- goerr113 (errors handling expressions)
- gomnd (magic numbers)
- gosec (security)
- nakedret (naked returns)
- wsl (forces to use empty lines)
- errcheck (checking for unchecked errors)
- staticcheck (static analysis)
2020-06-08 14:01:13 +03:00
Ed Bartosh
a668c596b2 fpga_crihook: improve unit tests
- increased test coverage to 91.4%
- cleaned up the code
- removed unused test data

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2020-03-31 11:57:06 +03:00
Graham Whaley
71d08224ee fpga: move to using klog for logs and debug
Move all the fpga components to using klog for logging
and debug. This includes replacing our homebrew 'fatal()'
with klog.Error().

Modify the deployment files to move from `-debug` to
`-v`, and set their default level to '1' (Info), rather
than full debug mode ('4').

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2020-03-24 14:31:53 +00:00
Mikko Ylinen
f145541caf READMEs: use git clone to get the code
go get'ing does not work due to our k8s.io/kubernetes dependency
so guide users to use git clone to get the code.

Fixes: #290

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-02-20 08:04:07 +02:00
Ed Bartosh
20ea365e62
Merge pull request #268 from grahamwhaley/20200117_fpga_readme
fpga: docs: update all the READMEs
2020-02-03 12:52:09 +02:00
Graham Whaley
07e902334f fpga: crio: docs: update README
Update the CRI-O webhook README, adding notes about what it is and
does, and that it is normally installed as part of the device
plugin daemonset.

Signed-off-by: Graham Whaley <graham.whaley@intel.com>
2020-01-30 16:19:19 +00:00
Dmitry Rozhkov
456c8f3ff1 fpga: fix stutter reported by golint 2020-01-30 15:17:27 +02:00
Dmitry Rozhkov
7695e450de fpga_crihook: remove unused struct field 2020-01-29 17:17:06 +02:00
Dmitry Rozhkov
3a845cfe15 fpga: rename files to make them linux-only 2020-01-29 17:17:06 +02:00
Ed Bartosh
57b4927eda crihook: simplified NewHookEnv signature 2019-09-16 12:56:35 +03:00
Ed Bartosh
8d21aff5ac crihook: removed unused field 2019-09-16 12:51:50 +03:00
Ed Bartosh
73ac87cd8d crihook; fix forgotten error check 2019-09-16 12:50:29 +03:00
Ed Bartosh
a6b3a217e8 crihook: fix ineffective Errorf call
Returned error instead of calling errors.Errorf with no effect.
2019-09-16 12:49:26 +03:00
Ubuntu
4f28657b6b fpga: fixed documentation and demo 2019-09-10 19:30:20 -05:00
Alexander Kanevskiy
cd263ba287 Update README file for fpga_crihook
Initcontainer is now built in main build process, no need to download
anythin special.

Added note about checking OCI hooks configuration parameter in CRI-O

Fixes: #192
2019-08-25 02:37:07 +03:00
Alexander Kanevskiy
71bb38f496 Implemented native FPGA flashing
Removed dependency to OPAE libraries
2019-08-25 02:37:01 +03:00
Ed Bartosh
de9df8373e fpga_plugin: support in-tree kernel driver
Extended fpga plugin to support both in-tree(DFL) and
out-of-tree (OPAE) kernel drivers.

- fpga_crihook: move JSON parsing to separate functions
- decreased cyclomatic complexity of the CRI hook main() function
- increased readability
- increased test coverage

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2019-08-24 18:27:15 +03:00
Alexander Kanevskiy
186ec6613c FPGA: migrate to ClearLinux environment
- Migrate to OPAE 1.3.2
- Build all the tools from the source
- ignore files in workspace
- minimal fpga_tool utility to check gbs/aocx file parsing and flashing
- implemented kernel IOCTL based flashing of bitstreams
- add PCI and sysfs functions
2019-08-24 02:55:19 +03:00
Alexander Kanevskiy
4dc19851ee Pass correct PCI bus/device/function to fpgaconf
Partially helps with #148
2019-05-29 16:08:52 +03:00
Dmitry Rozhkov
06487dcded crihook: do program multiple devices at once 2018-10-04 10:19:23 +03:00
Dmitry Rozhkov
6ce053a0a6 crihook: drop unused test data 2018-10-04 10:19:23 +03:00
Dmitry Rozhkov
dc21749a83 crihook: optimize regexp application 2018-10-04 10:19:23 +03:00
Ed Bartosh
44fd8aef54 fpga_crihook: use -s fpgaconf option
Different versions of OPAE tool fpgaconf use different command line
options to specify socket number. Latest version uses -S, which CRI-O
hook used so far.

However, fpgaconf in initcontainer comes from older OPAE version, which
uses -s option for the same purpose. This caused fpgaconf and CRI-O hook
to fail with "Invalid cmdline options".

Used 'fpgaconf-wrapper -s' in the CRI-O hook to fix this.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2018-09-05 15:33:42 +03:00
Ed Bartosh
79a0928646 fpga_crihook: use tools installed by initcontainer
intel-fpga-initcontainer installs OPAE and OpenCL tools
into /opt/intel/fpga-sw directory.

Used fpgaconf-wrapper, aocl-wrapper and packager tools by
CRI hook to program OPAE and OpenCL bitstreams.

Added support for OpenCL bitstreams: the hook tries to find
either OPAE or OpenCL bitstream suitable for requested region
and AFU and programs it using OPAE or OpenCL tools.

Fixes #71
2018-09-04 17:18:36 +03:00
Dmitry Rozhkov
eccd70c600 replace glog with simpler home-grown debug logging 2018-08-16 17:40:16 +03:00
Dmitry Rozhkov
2ff6c5929a Use annotated errors for tracing 2018-08-16 17:31:19 +03:00
Ed Bartosh
cf8d6bbc3f fix broken links in the FPGA plugin documentation 2018-08-14 15:00:48 +03:00
Alexander D. Kanevskiy
2a6eda891a
Merge pull request #68 from bart0sh/PR0030-fix-annotation-value
fpga_crihook: fix annotation value
2018-08-08 01:18:18 +03:00
Ed Bartosh
9de82c819f fpga_crihook: fix annotation value
Annotation value has been changed in FPGA plugin code recently.
Updated fpga_crihook to use the same value.
2018-08-07 17:40:16 +03:00
Ed Bartosh
71e8ea471a fpga_crihook: specify socket number when programming device
Added -S <device number> parameter to fpgaconf command line to
ensure usage of allocated device.
2018-08-07 17:32:59 +03:00
MCamp859
a29e04f614 Edits to FPGA readme files for format and text flow.
Signed-off-by: MCamp859 <mary.camp@ptiglobal.net>
2018-07-30 16:13:47 -04:00
Ed Bartosh
b1b2edf1b8 fpga_crihook: check if requested AF is programmed
Check if programmed AF id is equal to the requested AF id
after re-programming a device.
2018-07-18 12:27:45 +03:00
Ed Bartosh
9df1afdf43 fpga_crihook: check if intel annotation is set
Check if container annotation com.intel.fpga.mode is set to
"intel.com/fpga-region". This annotation is set by device plugin.
So, the check should help to filter out unwanted workflow that
device plugin is not aware of.
2018-07-16 16:12:59 +03:00
Ed Bartosh
2f9debe35b fpga_crihook: check if bitstream is already programmed
FPGA device can be already programmed with requested bitstream.
In this case hook should not programm the device again.
2018-07-13 14:16:27 +03:00
Ed Bartosh
69a32df387 fpga_crihook: covered by tests 2018-07-05 13:49:09 +03:00
Ed Bartosh
b4476110f8 implement CRI prestart hook
The hook gets FPGA_REGION and FPGA_BITSTREAM environment variables
defined in a pod spec, finds bitstream file, verifies it and programs
FPGA device with it using fpga-configure tool from OPAE.
2018-07-05 13:49:09 +03:00