Commit Graph

11 Commits

Author SHA1 Message Date
Mikko Ylinen
642c4f7b59 build: move to Go 1.19 and golangci-lint 1.48 because of that
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2022-08-15 10:13:37 +03:00
Dmitry Rozhkov
2cb914225c fpga_webhook: never reject already mutated CRs
For some reason the API server may want to pass an already mutated CR
through the webhook once again. The webhook must accept such CR with
no additional transformations.

This patch adds support for such idempotence by maintaining
a set of identity mappings which effectively resolve to themselves. No
patching is applied to them.
2022-03-29 11:01:49 +03:00
Mikko Ylinen
e3440505a9 fpga: export Patcher type
Fixes a linter warning:
"unexported-return: exported method GetPatcher returns unexported type
*patcher.patcher, which can be annoying to use (revive)"

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2022-03-29 08:03:58 +03:00
Dmitry Rozhkov
961fb3412c
fpga_webhook: make patcher idempotent (#892)
Webhook's patcher currently can't be re-applied to its output because it
rejects containers with the env vars it adds (e.i. FPGA_AFU_* and
FPGA_REGION_*).

Instead of rejecting container with disallowed env vars just reset them
first upon patching.
2022-02-18 10:24:03 +02: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
Dmitry Rozhkov
f0fa9df292 operator: prepare for publishing at operatorhub.io 2020-11-24 18:35:56 +02:00
Mikko Ylinen
0574c42078 fpga: move getRequestedResources() to new package
The function will be re-used by other webhooks too so it's better
to move it to its own package.

The unit tests are taken from the original implementation with some
minor changes.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-09-10 15:31:26 +03:00
Mikko Ylinen
f4c33d198e patcher: move ENV validation away from getRequestedResources
This commit adds new function validateContainer() that runs the
same FPGA_* ENV validation checks as before in getRequestedResources().

The restructuring is done in preparations for moving
getRequestedResources() to a separate package.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-09-10 15:31:26 +03:00
Dmitry Rozhkov
71075d4478 lint: enable exportloopref, prealloc and scopelint checks 2020-08-31 11:10:51 +03:00
Dmitry Rozhkov
a62c6f7d5e fpga webhook: reimplement to use kubebuilder framework
Simplify upgrade procedure to newer versions of kubernetes by relying on the
kubebuilder framework rather than using codegen directly.

Closes #377
2020-08-17 12:09:03 +03:00