Commit Graph

3862 Commits

Author SHA1 Message Date
Niels de Vos
fd62a5897a tests: allow external-sources for shellcheck
While introducing scripts/build_step.inc.sh the tests start to fail as
the script is included and each shell script is tested separately. By
adding the option --external-sources to shellcheck, the related warnings
are not reported.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-28 09:13:55 +00:00
Niels de Vos
52fa4f10da scripts: add build_step logging functions
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-28 09:13:55 +00:00
Yaniv Kaul
1f7d9760d5 Makefile: allow building with Podman
If Docker does not exist, use Podman.
Use all CPUs for the build, which hopefully will make it faster.

Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Fixes: #987
2020-04-27 05:21:26 +00:00
Niels de Vos
d1e12cb0e2 add optional TARGET=.. parameter for 'make containerized-test'
Running the containerized-tests is relatively time consuming as it runs
all the tests. By adding a TARGET=.. option to the Makefile, it is now
possible to run a selected test, for example:

    make containerized-test TARGET=static-check

This reduces the time the tests take, so it is more friendly to the
developers while addressing problems.

When no TARGET=.. parameter is passed, the default tests are run.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-24 15:41:46 +00:00
Niels de Vos
7d642b791c e2e: fix IneffAssign warnings in checkPVSelectorValuesForPVC()
IneffAssign warns about the two following statements:

  Line 1342: warning: ineffectual assignment to rFound (ineffassign)
  Line 1350: warning: ineffectual assignment to zFound (ineffassign)

rFound and zFound should be set before entering the loop, otherwise the
initial value will overwrite the updated value on each iteration.

Reported-by: https://goreportcard.com/report/github.com/ceph/ceph-csi
Updates: #975
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-24 08:35:36 +00:00
John Mulligan
c8271fe64c journal: move voljournal.go to a new package
This new journal package isolates journal logic from the rest of util
and helps draw bright lines between what is a generic utility function
and what is csi journal logic.

Done partly as preparation for making use of go-ceph in journal.

No functional changes are made except to update references to allow the
code to compile.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-24 07:36:38 +00:00
John Mulligan
22d1476bba util: create a NewErrSnapNameConflict function
The NewErrSnapNameConflict will allow packages outside of "util" to
create new instances of the ErrSnapNameConflict error.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-04-24 07:36:38 +00:00
Madhu Rajanna
3b608f130a Add grpc 1.27 version require section in go.mod to avoid CI issue
This PR addes GRPC 1.27 to required section in go.mod
file. this is overridden by 1.26 in replace section

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-23 16:02:55 +00:00
Niels de Vos
32839948ef cleanup: move pkg/ to internal/
The internal/ directory in Go has a special meaning, and indicates that
those packages are not meant for external consumption. Ceph-CSI does
provide public APIs for other projects to consume. There is no plan to
keep the API of the internally used packages stable.

Closes: #903
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-23 11:00:59 +00:00
Madhu Rajanna
d0abc3f5e6 Add travis_wait to deploy section
the deploy section is getting timeout to build and push
the images. see https://travis-ci.org/github/ceph/ceph-csi/jobs/678228818#L1617-L1622

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-23 09:09:28 +00:00
Madhu Rajanna
6b3e6e67e4 update the helm documentation for cephfs and rbd
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-23 04:43:04 +00:00
Madhu Rajanna
10eec1f39c Create Namespace for E2E
create ns before the helm create to avoid
`Error: create: failed to create: namespaces
"xxx" not found` issue

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-23 04:43:04 +00:00
Madhu Rajanna
86500c06c3 Helm3: update scripts to install helm3
Updated scripts to install helm3

fixes #920

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-23 04:43:04 +00:00
Madhu Rajanna
f696567517 Update Travis CI to install helm3
Updated CI scripts to install helm3

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-23 04:43:04 +00:00
Niels de Vos
2c6c0decbe containerized-build: set WORKDIR and use in make target
By setting the WORKDIR in the container image, there is no need to pass
it on the commandline in the Makefile. This makes the line for the make
target a little cleaner.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-23 03:41:06 +00:00
Niels de Vos
ceef252a24 containerized-build: use GOROOT variable everywhere
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-23 03:41:06 +00:00
Niels de Vos
f942e2175a containerized-build: use dnf instead of yum
The Ceph base image moved to CentOS 8 which uses dnf. Use that instead
of yum.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-23 03:41:06 +00:00
Madhu Rajanna
bfa6064b4d Read baseimage from the dockerfile
Updated deploy.sh and build scripts
to read base image from the dockerfile

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-22 15:41:40 +00:00
Madhu Rajanna
697ed32778 Add script to build and push multi arch images
with the help of qemu-user-static we can run
different architecute contains.

more info at https://github.com/multiarch/qemu-user-static

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-22 15:41:40 +00:00
Madhu Rajanna
4b540ffecc Update makefile and deploy.sh to pass build arguments
updated makefile to pass the required build
arguments for multistage docker build

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-22 15:41:40 +00:00
Madhu Rajanna
2de2d348c1 Add a travis job to build multi arch image
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-22 15:41:40 +00:00
Madhu Rajanna
32e2a713e6 Fix multi architecture dockerfile
Add support for multi architecture build
for cephcsi. with multistage docker build
we we build cephcsi binary for both arm64
and amd64 architecture.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-22 15:41:40 +00:00
Niels de Vos
43fbc00d49 travis: group build/e2e testing in stages
This reduces the number of concurrent jobs that get executed. The "build
test" jobs are relatively quick, and give developers the 1st feedback.
Longer e2e testing now only happens once the build tests have passed.

See-also: https://docs.travis-ci.com/user/build-stages/
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-22 11:43:06 +00:00
Niels de Vos
718e76d290 doc: add description for containerized-test to development-guide
Suggested-by: Wilmar den Ouden <info@wilmardenouden.nl>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-22 10:50:18 +00:00
Niels de Vos
22c0baa4b0 tests: fail when "make mod-check" detects a modified go.mod file
`go mod verify` does not fail when all moduled under vendor/ are
updated. However it does update `go.mod` in case it does not reflect the
downloaded versions.

By adding this additional verification in `make mod-check`, future
updates to vendor/ will require a correct go.mod as well.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-22 06:26:12 +00:00
Niels de Vos
b3664cd631 go.mod: go not list grpc as direct dependency
The recent update to k8s 1.18.0 causes an issue in go.mod that gets
corrected by running `go mod verify`. grpc should be used in version
1.26, and not in the expected update 1.27.

By removing the dependency and keeping grpc in the 'replace' section,
`go mod verify` seems to be happy.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-22 06:26:12 +00:00
wilmardo
157e8f4c75 util: use MiB and GiB constants from k8s helpers
Signed-off-by: wilmardo <info@wilmardenouden.nl>
2020-04-21 13:56:40 +00:00
Niels de Vos
4d60e76241 travis: split static checks and continue with tests in case one fails
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-21 07:01:10 +00:00
Niels de Vos
bd6393cf76 travis: add "make containerized-test" job
Add the containerized test to the existing containerized-build job so
that resources are shared a little.

Both tests use a different distribution, similar to what a developer has
on their system, and production deployments on a server.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-21 05:26:32 +00:00
Niels de Vos
3c6054ddf9 add make target for containerized tests
`make containerized-test` has been added as a make target. This runs the
'make test' target in a container. All test dependencies are installed
in the container once, and the container is kept around for running
`make containerized-test` subsequently.

The test container is based on Fedora:latest so that all test tools get
easily installed and are available in a recent version. The production
container is based on the Ceph container which has CentOS as Operating
System and therefor a more stable (too old) toolset.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-21 05:26:32 +00:00
Niels de Vos
58c2a3f15f minikube: fix ShellCheck errors
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-21 05:26:32 +00:00
chenxu1990
b7d46c1b79 Insert backend storage name into volumeAttributes
1. insert "imageName" field to pv with storage rbd
2. insert "subvolumeName" field to pv with storage cephfs
2020-04-20 07:30:03 +00:00
Niels de Vos
7bdb42c14a doc: update to current release tracking method
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-17 09:16:58 +00:00
hchiramm
a219b2f9d4 Update README for v2.1.0 release.
Signed-off-by: hchiramm <hchiramm@redhat.com>
2020-04-15 11:19:57 +00:00
Madhu Rajanna
2099600aa6 Upgrade: Upgrade doc for v2.1.0
This PR updates the upgrade document
from v2.0.x to v2.1.0

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-15 09:48:31 +00:00
Madhu Rajanna
5b14cc9272 Fix goimports issue in CI
Fix below error in current codebase
File is not `goimports`-ed with -local
github.com/ceph/ceph-csi

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-15 09:18:47 +00:00
Madhu Rajanna
6998c0d141 Fix typo in golangci config file
This PR fixes the typo in golang CI config file

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-15 09:18:47 +00:00
Madhu Rajanna
a3d2980311 Update Mergify for v2.1.0 backports
Updated Mergify rules for backporting PR's
to release-v2.1 branch and to auto merge the
PR if author is mergify bot

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-15 13:00:22 +05:30
Kevin Fox
6f73d4e3ca Support externally managed configmap.
https://github.com/ceph/ceph-csi/issues/927

Signed-off-by: Kevin Fox <Kevin.Fox@pnnl.gov>
(cherry picked from commit d4c4954c9d)
2020-04-15 07:21:20 +00:00
ShyamsundarR
1a8f8e3c24 Add support for erasure coded pools
This commit adds support to mention dataPool parameter for the
topology constrained pools in the StorageClass, that can be
leveraged to mention erasure coded pool names to use for RBD
data instead of the replica pools.

Signed-off-by: ShyamsundarR <srangana@redhat.com>
2020-04-14 14:14:29 +00:00
ShyamsundarR
3f06fedf61 Add unit tests for pkg/util/topology.go file
NOTE: If GetTopologyFromDomainLabels took a k8s client as an
argument, we could use the kubernetes fake client to test this
function in addition. This would though break the layers, exposing
k8s semantics in the code into the higher layers. Hence not
changing the same.

Signed-off-by: ShyamsundarR <srangana@redhat.com>
2020-04-14 14:14:29 +00:00
ShyamsundarR
e73921f268 Add e2e tests for topology based provisioning
- This commit adds tests only for RBD, as CephFS still needs
an enhancement in CephFS subvolume commands to effectively use
topology based provisioning

Signed-off-by: ShyamsundarR <srangana@redhat.com>
2020-04-14 14:14:29 +00:00
ShyamsundarR
d7ea523540 Update Helm charts to support topology
- Added requires chart variables
- Updated templates with required additions based on the
variables
- Re-added older nodeplugin cluster role/rolebinding as needed

Signed-off-by: ShyamsundarR <srangana@redhat.com>
2020-04-14 14:14:29 +00:00
ShyamsundarR
5c4abf8347 Add topology support to ceph-csi
Signed-off-by: ShyamsundarR <srangana@redhat.com>
2020-04-14 14:14:29 +00:00
chenxu1990
5475022bc3 Document about stale resource cleanup
1. when user delete pv manual, it will result in stale metadata and image in ceph
2020-04-14 11:29:07 +00:00
Humble Chirammal
34fc1d847e Changes to accommodate client-go changes and kube vendor update
to v1.18.0

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-04-14 10:50:12 +00:00
Humble Chirammal
4c96ad3c85 Changes to e2e to accomodate client-go changes and RunKubectlInput
With client-go v1.18.0 there is a change where Signatures on methods
in generated clientsets, dynamic, metadata, and scale clients have been
modified to accept context.Context as a first argument.
Signatures of Create, Update, and Patch methods have been updated to accept
CreateOptions, UpdateOptions and PatchOptions respectively.
Signatures of Delete and DeleteCollection methods now accept DeleteOptions
by value instead of by reference

The framework.RunkubectlInput now accepts namespace as the first parameter
which is also accommodated with this PR.

Signed-off-by: Humble Chirammal hchiramm@redhat.com
2020-04-14 10:50:12 +00:00
Madhu Rajanna
60a394b397 Fix helm clean in functional test
there was an issue in helm cleanup
script in functional tests. This Fixes
the same.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-10 14:10:01 +00:00
Niels de Vos
14276bf642 rbd: fallback to inline image deletion if adding it as a task fails
Fixes: #858
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-04-10 11:16:37 +00:00
Madhu Rajanna
22f3dc3556 E2E: Add Ability to test with different user #919
Updated E2E to use a normal user other than admin user,
who is having access to create and mount cephfs PVC and
create and map rbd PVC

we will use the user created by rook who is having above
access.

Signed-off-by: Madhu Rajanna madhupr007@gmail.com

This PR adds a test case for #904

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-09 15:10:55 +00:00