Commit Graph

2134 Commits

Author SHA1 Message Date
John Mulligan
0b99bdaa82 journal: add omap.go with go-ceph based omap manipulation funcs
These new omap manipulation functions (get/set/remove) are roughly
equivalent to the previous command-line based approach but rely
on direct api calls to ceph.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-06-22 15:41:00 +00:00
John Mulligan
f3192bd1b3 util: add New* funcs for ErrKeyNotFound & ErrPoolNotFound types
These types have private fields but we need to construct them outside of
the util package. Add New* methods for both.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-06-22 15:41:00 +00:00
Madhu Rajanna
1a1ad11f57 doc: update coding doc to correct import order
Updated coding doc to correct the import order
as per the standard. More info can be found on
https://github.com/golang/go/wiki/CodeReviewComments#imports

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-06-22 09:51:23 +00:00
Madhu Rajanna
03947ebcc5 doc: update readme to add ROX support
Updated Readme to add ROX support
for rbd PVC.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-06-22 06:15:40 +00:00
Madhu Rajanna
39561b9675 e2e: Add E2E to mount rbd PVC as ro in app
Added an E2E to mount rbd PVC as readonly
in application pod and try to create some
file in Readonly PVC,when we try to create
files on RO PVC, we should get error.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-06-22 06:15:40 +00:00
Madhu Rajanna
649aeb7aaf rbd: Add support for rbd ROX PVC mounting
if the PVC access mode is ReadOnlyMany
or single node readonly, mounting the rbd
device path to the staging path as readonly
to avoid the write operation.

If the PVC acccess mode is readonly, mapping
rbd images as readonly.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-06-22 06:15:40 +00:00
Niels de Vos
da40d8e05e rbd: use librbd.FeatureSet for features
go-ceph v0.3 adds constants for ImageFeature values and their names.
Instead of hardcoding "layering" in several places, use the constant
given by librbd.

The rbdVolume.ImageFeatures does not seem to be used anywhere after the
conversion. Stashing the image metadata does include the ImageFeatures
as these are retrieved when getting the image information. It is safe to
drop ImageFeatures altogether and only use the imageFeatureSet instead.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-19 11:37:29 +00:00
Niels de Vos
decfc1ae2c rbd: make hasSnapshotFeature() a method of rbdVolume
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-19 11:37:29 +00:00
Humble Chirammal
dcbf71dd5d cleanup: avoid double import of kubernetes library in e2e utils
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-06-19 08:42:08 +00:00
Mudit Agarwal
e9082768b6 cephfs: enhance tracevol.py script to work with cephfs
tracevol.py script traces a RBD PVC to its RADOS map, key and image.
The script is enhanced to provide the same functionality for cephfs now.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-06-19 05:48:27 +00:00
Mudit Agarwal
78963737d3 rbd: fix tracevol.py script to work with python 3.x
tracevol.py script traces a RBD PVC to its RADOS map, key and image.
It needs minor fixup in order to work with python 3.x

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-06-19 05:48:27 +00:00
Niels de Vos
ebe378c79a util: trim "\x00" characters from the kernel version
It seems that convering the release component from the unix.Utsrelease
type leaves some trailing "\x00" characters.

While splitting the string to compare kernel versions, these additional
characters might prevent converting the string to an int. Strip the
additional characters before returning the string.

Note:
  "\x00" characters are not visible when printing to a file or screen.
  They can be seen in hex-editors, or sending the output through 'xxd'.

Fixes: #1167
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-18 11:42:47 +00:00
Niels de Vos
1b0b26a7a6 util: log kernel version on start
It is useful to have the kernel version logged while starting binaries.
Some functionality depends on the version of the kernel, debugging
issues related to this will be easier.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-18 11:42:47 +00:00
Niels de Vos
209a5e5602 util: add function to get the kernel version
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-18 11:42:47 +00:00
Madhu Rajanna
2dc0bffc0a e2e: Remove arm64 build test from CI
as we are building the cephcsi inside
a container for both amd64 and arm64 we
dont need to have a separate E2E to
test the build on arm64 machine.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-06-18 09:21:48 +00:00
Niels de Vos
3364fe7b78 rbd: remove unneeded updateVolWithImageInfo()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-17 09:28:57 +00:00
Niels de Vos
824f38daaa rbd: use go-ceph to implement getImageInfo()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-17 09:28:57 +00:00
Niels de Vos
772d1dfa77 rebase: use go-ceph v0.3.0
v0.3.0 adds support for rbd.FeatureSet that can be used to parse the
features of an RBD image. This will be used in the followup commit that
adds rbdVolume.getImageInfo().

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-17 09:28:57 +00:00
Humble Chirammal
323cc0e3bb cleanup: avoid comparing errors directly
Go 1.13 contains support for error wrapping. To support wrapping,
fmt.Errorf now has a %w verb for creating wrapped errors, and three
new functions in the errors package ( errors.Unwrap, errors.Is and
errors.As) simplify unwrapping and inspecting wrapped errors.

With this change, If we currently compare errors using ==, we have to
use errors.Is instead. Example:

if err == io.ErrUnexpectedEOF

becomes

if errors.Is(err, io.ErrUnexpectedEOF)

https://tip.golang.org/doc/go1.13#error_wrapping

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-06-17 06:26:11 +00:00
John Mulligan
e111f2b613 scripts: add -mod=vendor to go run in check-env.sh
Without -mod=vendor running go run in this script may take more
resources than needed to execute. This also makes it consistent go build
(and alike) are invoked in the other scripts and the Makefile.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
2020-06-17 04:58:32 +00:00
Humble Chirammal
134e11e26e doc: correct PVC expansion documentation
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-06-16 10:31:29 +00:00
Yug Gupta
5fbc153e0f cephfs: fix IneffAssign warnings in resizeVolume()
IneffAssign warns about the two following statements:

Line 147: warning: ineffectual assignment to supported (ineffassign)
Line 148: warning: ineffectual assignment to ok (ineffassign)

Reported-by: https://goreportcard.com/report/github.com/ceph/ceph-csi
Updates: #975

Signed-off-by: Yug Gupta <ygupta@redhat.com>
2020-06-16 09:06:18 +00:00
Humble Chirammal
2793b79ad8 doc: Correct PVC mention in the deployment doc
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-06-11 10:53:10 +00:00
Humble Chirammal
d11266e255 cleanup: remove double import of csi spec from nodeserver
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-06-11 10:28:24 +00:00
Humble Chirammal
333548b05c doc: Add v2.1.2 release details to release table
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-06-11 05:46:58 +00:00
Humble Chirammal
c1a269191c doc: make sure configmap object referred or documented correctly
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-06-10 11:33:10 +00:00
Yug Gupta
8b606f538f build: add check for ceph development headers
The script checks for the ceph development headers.
In case required packages are not found, script
suggests to run containerized build.

Signed-off-by: Yug Gupta <ygupta@redhat.com>
2020-06-10 09:49:55 +00:00
Niels de Vos
be703d1e42 util: implement CreateObject() with go-ceph
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-10 07:20:25 +00:00
Niels de Vos
6e24b10364 util: implement RemoveObject() with go-ceph
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-10 07:20:25 +00:00
Niels de Vos
926f1e813c rbd: keep rados.IOContext for re-use
This prevents the need to open the IOContext for additional operations
on the image.

It also addresses a leak of the IOContext in case `rbdVolume.open()` was
called. The method only returned the `rbd.Image` without the possibility
to close the related IOContext.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-09 13:17:31 +00:00
Niels de Vos
81b17c5157 ci: pass target filename of /etc/resolv.conf in case it is a symlink
In some Linux distributions the /etc/resolv.conf file is a symlink. This
file gets included in the Kubernetes containers and will be used for
resolving hostnames. By including the symlink, it is possible that that
target file is not available in the container(s). This will cause
problems when resolving hostnames, and Kubernetes will not get deployed.

The default minikube VM provides /run/systemd/resolve/resolv.conf, with
/etc/resolv.conf being a symlink. Therefor, it is needed to pass the
`--extra-config=kubelet.resolv-conf=..` parameter to `kubeadm`.

In case minikube is started with `--vm-driver=none` and
/run/systemd/resolve/resolv.conf does not exist, the local
/etc/resolv.conf will be used for inclusion in the Kubelet container. If
this is a symlink, the final destination should get passed with
`--extra-config=kubelet.resolv-conf=..` so that a working hostname
resolution configuration is available in the container.

Updates: #1121
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-05 08:57:19 +00:00
Niels de Vos
365fbd1ca0 util: remove unused GetImageMeta() and SetImageMeta()
Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-03 06:15:46 +00:00
Niels de Vos
c0b53d3ad4 build: add option to compile e2e.test in a container
Run `make containerized-build TARGET=e2e.test` to build the e2e.test
executable in a container. This makes it possible for environments to
only have the dependencies for the runtime installed (most notably Ceph
shared libraries) and, run the e2e tests directly.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-06-02 08:28:54 +00:00
Madhu Rajanna
44da7ffb4e e2e: Add testcase of invalid mount option
Added a test case to cover unmap of rbd image
if the mounting fails. if we pass the invalid
mount option the expectation is that mounting
of rbd image to stagingpath fails. as the unmap
happens it should not block the rbd pvc deletion
saying rbd image is in-use.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-06-01 11:27:25 +00:00
Madhu Rajanna
78cdf9d4db e2e: Add option to set mountoptions in sc
Updated E2E code to pass mountoptions when
creating a storageclass.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-06-01 11:27:25 +00:00
Madhu Rajanna
2f7e51076b rbd: unmap rbd image if the mounting fails
There is a bug in current code where the devicePath
is always empty and the rbd image unmap never
happens if nodeplugin fails to mount the rbd image
to the stagingpath.
This is a fix to unmap the rbd image if some issue
occurs after rbd image is mapped.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-06-01 11:27:25 +00:00
Mehdy Khoshnoody
c0361c47d6 rbd: Add new methods to generate spec strings
Refactor lots of string concatenation using the Stringer
implementation for each type.

Signed-off-by: Mehdy Khoshnoody <mehdy.khoshnoody@gmail.com>
2020-06-01 05:54:54 +00:00
Niels de Vos
ed30fa19d4 build: use CURDIR instead of PWD
`make -C ${GOPATH/src/github.com/ceph/ceph-csi container...` commands
fail as the PWD variable gets substituted with the path where `make` is
called, not with the path of the Makefile that is passed with the -C
option.

The CURDIR variable is expended to the correct path, so `make -C ...`
works for all make targets now.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-05-31 15:03:58 +00:00
Mehdy Khoshnoody
79cef18f8f ci: Use bionic dist for test environments
As bionic uses a newer version of linux we'd also be using
a newer version of krbd.

Signed-off-by: Mehdy Khoshnoody <mehdy.khoshnoody@gmail.com>
2020-05-29 10:08:24 +00:00
Mehdy Khoshnoody
fe384bccfe rbd: Fix error checking mistake in CreateVolume
deleteErr should be checked if it's nil instead of err

Signed-off-by: Mehdy Khoshnoody <mehdy.khoshnoody@gmail.com>
2020-05-29 07:38:01 +00:00
Niels de Vos
ea3d9e941f ci: automatically merge PRs in ci/centos
Merge PRs for the ci/centos branch when they have sufficient approvals
and the tests have passed. Using the same rules as the master branch.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-05-28 12:27:44 +05:30
Humble Chirammal
18af27c984 deploy: add retry-interval-start for attacher & resizer helm charts
--retry-interval-start:

This is initial retry interval for failures. 1 second is used by default.

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-05-27 15:52:08 +00:00
Humble Chirammal
65982a0489 deploy: add --retry-interval-start arg for attacher & resizer
Considering this parameter is available for other sidecars we should
have a parity between the sidecars. Adding it for the same reason

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-05-27 15:52:08 +00:00
Madhu Rajanna
f134fe5e86 ci: Add commitlint to travis CI
Added commitlint tool to travis CI
to test the commit messages.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-05-27 12:51:26 +00:00
Mudit Agarwal
9fe7d1612e journal: In mount failure case, suggest to check the kernel logs
When mounting fails, the node-plugin should give a suggestion to check the
kernel logs so that users can report problems better.
Edited the existing log to include the message in both rbd and cephfs.
Fixes: https://github.com/ceph/ceph-csi/issues/1006

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
2020-05-27 10:52:37 +00:00
Niels de Vos
2ad58f152b build: verify that all dynamically linked libraries are available
When building with go-ceph, there are several dynamically linked
libraries used directly (libcephfs, librados and librbd), and many more
indirectly.

By adding an additional RUN statement to check if all libraries are
available in the final image, problems related to missing libraries
should be caught before publishing/consuming the image.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-05-27 09:03:42 +00:00
Niels de Vos
3d0395d448 ci: require ci/centos/containerized-tests for merging
The ci/centos/containerized-tests status is already set by the Jenkins
job in the CentOS CI. It can now be used to gate the automatic merging
of PRs.

Reduce the load on Travis CI, do not run the containerized-tests job
there any longer.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-05-27 12:59:05 +05:30
Yug Gupta
6cf7389d97 doc: Add prefix for naming subvolumes and snapshots
Updated storageclass and snapshotclass
to include the name prefix for naming
subvolumes and snapshots.

Fixes: #1087

Signed-off-by: Yug Gupta <ygupta@redhat.com>
2020-05-27 05:54:10 +00:00
Humble Chirammal
c2d4200bd8 ci: Enable stale bot on issues
The flag to enable this bot on issues was off. This PR enables it

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2020-05-22 09:09:06 +00:00
Madhu Rajanna
d55dc6de92 ci: Add mergify rule for conflict
Added mergify rules to post a message
when there is conflict on the PR.

ref: https://doc.mergify.io/examples.html#request-for-action

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-05-21 13:32:51 +05:30