klog has added ktesting/textlogger and is going to deprecate
klogr. The deprecation is going to trigger golangci-lint (staticcheck)
errors so rework the logging and move to ktesting/textlogger.
The commit also fixes the loglevel setting with operator.
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
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.
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.
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>