Commit Graph

22 Commits

Author SHA1 Message Date
Edu Gómez Escandell
0e750262a3
Enable autoformatting linters (#3179)
* Enable gofmt linter

From the docs:

> Gofmt checks whether code was gofmt-ed. By default this tool runs with
> -s option to check for code simplification.

https://golangci-lint.run/usage/linters/#gofmt

Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>

* Run gomft on the project

Ran this command after adding the gofmt linter:

	golangci-lint run ./... --fix

Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>

* Enable whitespace linter

From the docs:
> Whitespace is a linter that checks for unnecessary newlines at the
> start and end of functions, if, for, etc.

https://golangci-lint.run/usage/linters/#whitespace

Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>

* Run whitespace on the project

Ran this command after adding the whitespace linter:

	golangci-lint run ./... --fix

Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>

* Enable GCI linter

Per the docs:

> Gci controls Go package import order and makes it always deterministic.

https://golangci-lint.run/usage/linters/#gci

NOTE: I noticed that many files separate their imports in a particular
way, so I set the linter to enforce this standard.

Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>

* Run GCI on the project

Ran this command after adding the GCI linter:

	golangci-lint run ./... --fix

Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>

---------

Signed-off-by: Edu Gómez Escandell <egomez@redhat.com>
2024-04-24 13:52:22 +02:00
Alex Kalenyuk
9a5f11e1b2
Grant ns admin missing create RBAC for various CDI resources (#3030)
Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2023-12-13 16:33:51 +01:00
Alex Kalenyuk
0e8ea6b08f
Adjust functest suite for running an allowed set of tests in parallel (#2980)
* Change func test invocation to execute tests in parallel

Local testing still runs serially, CI does parallel

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Change work dir of test suite

ginkgo cli will run our suite with the workdir set to the test binary dir
(instead of pwd of the script that calls ginkgo cli)

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Adjust artifacts dir according to ginkgo node

Parallel ginkgo nodes will not overwrite each other's artifacts

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Only execute namespace deletion loop after all parallel processes are done

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Don't overwrite feature gates in explain/apiserver suite

These were dropping the WFFC feature gate and thus colliding with other tests

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Update libpopulators to overcome nil ptr

This nil ptr can cause havoc when run in parallel:
https://github.com/kubernetes-csi/lib-volume-populator/pull/82

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark serial clone tests while allowing some others to be parallel

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark cdi config test suite as serial

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark apiserver tests serial

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark cert rotation tests serial

Port forward may need adjust to run parallel

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark destructive tests Serial

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark dataimportcron tests serial

Needs refactoring to be parallel, mutates default storage class

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark CSI / Smart clone suites as serial

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark datavolume_test suite as serial

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark local volume tests serial

These create a PV with a fixed name,
needs refactoring to random name to be parallel

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark rbac tests serial

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark upgrade test serial

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark importer suite serial except populator tests

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark ObjectTransfer tests serial

Seems these hardcode the name of the ot object,
so that needs refactoring to be parallel

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark some upload tests serial

Mark most upload tests serial, keep populator/regular flows parallel

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark some transport tests serial

Some of them update CDI config's insecure registries

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

* Mark explain tests serial

Sometimes the kubectl cmd fails when run in parallel

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

---------

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2023-12-13 01:27:48 +01:00
Maya Rashish
5e4cb68044
Update to ginkgo v2 (#2788)
* Run `make deps-update`

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Update to ginkgo v2

Avoid using table extension to avoid compilation errors
Switch to v2 everywhere
Update qe-tools as well (required)

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Fix/avoid deprecation warnings

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Do not use v1 reporter

For unit tests: stop using custom reporter, unnecessary
For functional tests: borrow code from kubevirt to keep reporting

Avoid deprecated warnings by golangci for using deprecated reporter

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Increase ginkgo timeout to 24h (default in ginkgo v1)

this may seem excessive, but we have a lower timeout in Prow, let's save
ourselves the future trouble of bumping timeouts in two places.

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* use the ginkgo built-in junit reporter

Signed-off-by: Maya Rashish <mrashish@redhat.com>

* Avoid using deprecated --ginkgo.noColor, use --ginkgo.no-color instead

Signed-off-by: Maya Rashish <mrashish@redhat.com>

---------

Signed-off-by: Maya Rashish <mrashish@redhat.com>
2023-07-26 02:35:55 +02:00
alromeros
124099ff30
Update populator CRDs roles to include cluster-readers (#2802)
Signed-off-by: Alvaro Romero <alromero@redhat.com>
2023-07-13 18:36:29 +02:00
Nahshon Unna Tsameret
4d14028d5b
enable ginkgolinter and fix findings (#2703)
Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
2023-05-04 13:07:36 +02:00
Nahshon Unna Tsameret
48166bdc8d
Enable additional linters to golangci-lint configuration (#2691)
* enable the typecheck linter in golangci-lint

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

* enable the staticcheck linter and fix findings

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

* golangci-lint: enable ineffassign and fix finding

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

---------

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
2023-04-17 13:30:28 +01:00
Alexander Wels
bbee324537
Make CDI clone strategy strings correct types (#2277)
Noticed the consts were strings instead of the right types
this changes the type to the right type and modifies the usage
to not have to cast to the right type all over the place.

Signed-off-by: Alexander Wels <awels@redhat.com>
2022-05-17 14:19:25 +02:00
Arnon Gilboa
6e9891f877
Expose all CDI CRDs to cluster-readers (#2245)
Signed-off-by: Arnon Gilboa <agilboa@redhat.com>
2022-04-25 14:27:34 +02:00
Bartosz Rybacki
ecb8d5f4dc
Add storageprofiles to RBAC (#2025)
* Add storageprofiles to RBAC

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Fix test to correctly verify rule exists

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Removing cdiconfig from the aggregate

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>
2021-11-24 12:50:26 +01:00
Michael Henriksen
aedaf513ec
Move apis to staging, push to containerized-data-importer-api (#1997)
* move apis to new staging area

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* add script to push to staging

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* fix lint check and api reference

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* push staging to api repo

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2021-10-28 13:40:24 +02:00
Michael Henriksen
86c32e87b8
Add CDIConfig to CDI (#1475)
* Add CDIConfigSpec to CDI

Make CDIConfig singleton mirror data in "active" CDI

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* fix functional tests

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-11-11 23:09:54 +01:00
Michael Henriksen
75f4fd6f2f
update k8s deps to 18.6 and controller runtime to 0.6.2 (#1330)
* update k8s deps to 1.18.6 and controller runtime to 0.6.2

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* remove building code generators from docker image.  This way the k8s ligray version only has to be updated in go.mod

Do more stuff in the bazel container.  Faster and better interop

Fix unit tests

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* make format

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* remove unnecessary rsync

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* redo code generator dep management

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* builder uses go modules

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-08-07 14:09:52 +02:00
Alexander Wels
c7a3610769
Update cdi-builder to use go version 1.14.6 (current latest) (#1310)
* Update cdi-builder to use go version 1.14.6 (current latest)
Fix functional test framework to work with go >= 1.13. We were not
using the ginkgo ordering correctly, and our framework would call
flag.Parse() too soon, and mess with the go testing flag parsing.
As a result we had to alter some of the variables that we use to build
urls to be functions so that when called the required information is
available.
Fixed several tests not checking for errors.
Fixed dumping code being initialized several times messing with the
order in which failures were reported.

Signed-off-by: Alexander Wels <awels@redhat.com>

* Fixed failing tests.

Signed-off-by: Alexander Wels <awels@redhat.com>
2020-07-23 23:09:44 +02:00
Bartosz Rybacki
ab48911b9b
WaitForFirstConsumer handling for DataVolumes (#1242)
* Set the WaitForFirstConsumer phase on DataVolume when storage uses the WaitForFirstConsumer binding mode and is not bound yet.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Skip PVC if not bound in import|clone|upload controllers.

This is done so the VM pod(not the cdi pod) will be the first consumer, and the PVC can be scheduled on the same location as the pod.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

fixup! Skip PVC if not bound in import|clone|upload controllers.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update importer tests to force bind the PCV by scheduling a pod for pvc, when storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update datavolume tests to force bind the PCV by scheduling a pod for pvc, when storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update upload controller and upload tests to correctly handle force binding the PCV by scheduling a pod for pvc, when storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update clone tests to force bind the PCV by scheduling a pod for pvc when the storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update cloner multi-node tests to force bind the PCV by scheduling a pod for pvc when storage class is wffc.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Correct after automerge

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Improve/simplify tests

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Fix error in import test.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update transport_test,operator_test.go

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update rbac_test.go and leaderelection_test.go

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Improve Datavolume and PVC Checks for WFFC.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Handle wffc only if feature gate is open - import-controller

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* TEST for Handle wffc only if feature gate is open - import-controller - TEST

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Handle wffc only if feature gate is open - upload-controller with test

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* rename and simplify checks

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* cleanup after rebase

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* update tests after rebase

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* update tests after rebase

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* more cleanups

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Document new WFFC behavior

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Document new HonorWaitForFirstConsumer option

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* update docs according to comments

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* extract common function, cleanup - code review fixes

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* add comment for another pr - 1210, so it can have easier merge/rebase

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* typo

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Simplify getStoragebindingMode - code review comments

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Add FeatureGates interface - code review fix

Additionally pass the features gates instead of the particular feature gate value,
and let shouldReconcilePVC decide what to do with the feature gate. That way shouldReconcilePVC
contains all the logic, and the caller does not need to do additional calls to provide parameters.

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>

* Update matcher

Signed-off-by: Bartosz Rybacki <brybacki@redhat.com>
2020-07-22 16:23:44 +02:00
Michael Henriksen
9e2c79b1e0
move api groups to v1beta1 (#1232)
* move upload.cdi.kubevirt.io API group to v1beta1

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* move core api to v1beta1

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* fix os-3.11 cluster sync and add functional tests for alpha api

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* change more occurences of v1alpha1

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* updates after rebase

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-07-10 15:47:38 +02:00
Adam Litke
724e9d8362
Add test-ids for new tests (#1256)
Signed-off-by: Adam Litke <alitke@redhat.com>
2020-06-24 22:16:11 +02:00
Michael Henriksen
99f8af5b86 k8s client upgrade to 1.16 (#1079)
* initial client upgrade to 1.16

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* fix Route detection in OpenShift

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2020-01-14 13:43:17 +01:00
Michael Henriksen
e7b92e1d6a additional RBAC test (#983)
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2019-10-03 09:41:35 -04:00
Michael Henriksen
39b7356ff2 apiserver no translating HTTP method
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2019-09-27 12:27:04 -04:00
Michael Henriksen
4d79201788 delete RBAC tests for unextected rules (#969)
Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2019-09-23 13:23:59 -04:00
Michael Henriksen
254dc90835 create aggregate cluster roles (#961)
* create aggregate cluster roles

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* CDIConfig needs a ClusterRoleBinding so bind to system:authenticated for reading

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* comment out problematic test

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* operator needs upload.cdi.kubevirt.io permission

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>

* revert commented out tests

Signed-off-by: Michael Henriksen <mhenriks@redhat.com>
2019-09-18 19:03:49 -04:00