Commit Graph
335 Commits
Author SHA1 Message Date
Satoru Takeuchi f65bb923ed ceph: fix ignoring device specification with non-kname
Partition's DevLinks are empty in osd-prepare-pod. So, the device
specification with non-kname, for example devicePathFilter, doesn't
work.

Closes: https://github.com/rook/rook/issues/5504

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2020-06-22 21:37:05 +09:00
Satoru Takeuchi e2df534abe ceph: fix the test of OSD
Fix the following bugs.

- CephVersion is not back to Octopus
- `cephadm' here is called with three arguments,
  "info --query=property <devname>". We should use 'args[2]' instead.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2020-06-22 05:32:58 +09:00
Sébastien Han c7f255a0e8 ceph: add the ability to set any pool property
We can now explicitly set any property on a given pool by using the new
Property field in the CephBlockPool Spec.

Also, this fixes the case where both `CephBlockPool` and `CephCluster`
are created at the same time. When Rook creates the pool, the cluster is
still being bootstrapped and the global option
`osd_pool_default_pg_autoscale_mode` has not bee set yet. So the pool
gets created but its `pg_autoscale_mode` property is set to `warn`
instead of `on`.

Closes: https://github.com/rook/rook/issues/5608V
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-06-17 10:08:00 +02:00
Sébastien Han 993af443a4 ceph: always turn on balancer on octopus
When running Octopus, we still need to turn on the balancer module. The
distinction is tricky, the module is "enabled" but it has to be "turned
on" and configured.

This was only working when the `pg_autoscaler` module was explicitly
listed in the CephCluster spec mgr section module section but not
automatically configured when running Octopus (the `pg_autoscaler`
module is already enabled).

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-06-09 15:42:15 +02:00
Sébastien Han 3c7a252862 ceph: fix osd number detection on upgrade
If the cluster has 3 OSDs, during the upgrade when the OSD restarts it
will temporarily disappear from the "ceph versions" list so we need a
more robust way to list the number of OSDs and always returns the total
number of OSDs.

Closes: https://github.com/rook/rook/issues/5521
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-06-05 15:20:46 +02:00
Sébastien Han 5520ee35bb ceph: check if ok-to-stop even on failure
Even if we cannot determine wheter all the OSDs are running on the host,
we still need to perform the ok-to-stop check. It is far more common to
have more than 3 OSDs anyways.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-06-05 15:06:35 +02:00
subhamkrai 4378a30c64 ceph: updated initializeBlockPVC method and added unit tests
Updated initializeBlockPVC method to add
crushDeviceClass along with
immediateExecuteArgs instead of
metadataArg. Also added unit tests for this method.

Signed-off-by: subhamkrai <subhamkumarrai03@gmail.com>
2020-05-29 12:30:19 +05:30
Sébastien Han c799e11032 ceph: enhancement cleanup with disks
Now, we can not only cleanup monitor data, logs and crashes but the
disks too. As part of the cleanupPolicy CR spec, we have a new setting
called sanitizeDisks which holds more details:

* confirmation: the confirmation message to sanitize disks,
use "yes-really-sanitize-disks" to confirm

This will **only** wipe the metadata, so it's a fast cleanup allowing
you to re-install later but won't remove all the data from the drive.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-05-27 18:14:02 +02:00
Sébastien Han 2576674648 Merge pull request #5515 from leseb/lvm-verbose
ceph: fix lvm arg
2020-05-20 17:13:47 +02:00
Sébastien Han 712c958202 ceph: fix lvm arg
Add the valid verbose flags back.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-05-20 13:03:51 +02:00
Travis Nielsen 5ac7b528c3 Merge pull request #5342 from rajatsingh25aug/ceph-mds-deactivate
Ceph: Newer mechanism to scale MDS for Nautilus+
2020-05-19 10:50:00 -06:00
Travis Nielsen 81dae96929 ceph: remove obsolete version from osd health check
The Ceph version information is not needed to be passed
to the osd health checker since mimic support was dropped.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-18 12:56:28 -06:00
Travis Nielsen af54349a5e ceph: remove invalid verbose params from lv activate
The activation of the lvs for OSDs had an invalid
argument to vgchange. The invalid argument is now reverted
to enable the OSDs in this scenario again.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-08 11:19:42 -06:00
Travis Nielsen 5f57b6fd3a ceph: skip ceph-volume inventory for PVs
For multipath devices, ceph-volume inventory is failing
to detect that the device is available, complaining about
insufficient space. Instead of relying on c-v inventory
to determine if the device is available, just call
c-v raw list to determine if there is already an osd
configured on the pv. Otherwise, just attempt to configure
the OSD.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-06 17:12:25 -06:00
RAJAT SINGH 9feb0287c5 Ceph: Newer mechanism to scale MDS for Nautilus+
ceph mds deactivate is not valid command for Nautilus, changing the mechnaism of upgrading so that it can be done in the way Nautilus does it.

Closes: https://github.com/rook/rook/issues/5278
Signed-off-by: RAJAT SINGH <rajasing@redhat.com>
2020-05-06 13:33:26 +05:30
Sébastien Han 65aae84bdd ceph: do not fail on deactivate
If we fail to release an LVM device, we should not fail the deployment.
We just print the error and let the backend handle the rest. Some
CSI backend will force detach the device anyway.
This prevents the deployment to get stuck in terminating.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-05-05 12:03:43 +02:00
Madhu Rajanna 81688398f2 cleanup: use err.Wrap when the formatting is not required
Replaced err.Wrapf with err.Wrap when the formatting
is not required.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2020-04-29 17:42:59 +05:30
Sébastien Han f27fd207ce ceph: convert the CephCluster controller to the controller-runtime
This is the final conversion to controller-runtime conversion. This time the
CephCluster CRD has been converted to use the controller-runtime
library.
The controller incorporates all the previous watchers too, so the Node
and hot-plug configmap are been watched too.
Only the operator setting configmap is not being watcher since it's not
related to the CephCluster CRD.
Not only the patch converts to controller-runtime but also tries to
re-organize the tree of the repo to actually make the code more
readable and have better functions/methods/tests separations.

Closes: https://github.com/rook/rook/issues/4939
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-04-28 09:40:35 +02:00
Travis Nielsen 99dc363ab6 ceph: metadatadevice to not be added to osd data device list
When the metadataDevice is specified, it was a regression that it was
being interpreted also as a data device. ceph-volume was failing
when the metadataDevice was added as both a data and metadata device.
So we ensure it is not added to the list of data devices.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-04-23 12:40:11 -06:00
Sébastien Han 7c994441c3 ceph: make admin key optional for external cluster
Currently, we need to configure the Ceph external Admin keyi
in the Rook deployment to be able to connect to an external Ceph cluster.
If we wanted to run in a multi-tenant fashion
were several K8s/Rook clusters wanted to connect to the same external ceph cluster,
each K8s deployment would have the access to the External Ceph Admin key
and could potentially access or delete the Data
from pools that belong to other k8s/Rook Clusters.

Now the admin key is optional but the helper script create-external-cluster-resources.sh
will help create the necessary keys/users to connect to that cluster.

Closes: https://github.com/rook/rook/issues/4917 and https://github.com/rook/rook/pull/5227
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-04-20 09:59:04 +02:00
Sébastien Han 58b7b1e012 ceph: stop potential secret leak
If cluster info is not fully initialized we could leak some of the ceph
secrets in the operator logs.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-04-20 09:56:27 +02:00
Travis Nielsen f4df6f6069 Merge pull request #5143 from shellwedance/ceph_add_size_in_pool_create
Ceph: Add replica_size flag in replicated pool creation time
2020-04-07 07:21:05 -06:00
taeuk_kimanddonggyu_park c266c982c9 Ceph: Add replica_size to replicated pool creation
Add size parameter to pool create command instead of executing pool set command only for size
This makes pool min_size reflect replica size.

Co-authored-by: donggyu_park <donggyu_park@tmax.co.kr>
Signed-off-by: taeuk_kim <taeuk_kim@tmax.co.kr>
2020-04-07 07:06:35 +00:00
Umanga Chapagain 654efb6d0a Ceph: fixes unhandled type assertions
unhandled type assertions can lead to runtime panic. using
the boolean 'ok' flag to handle failure to assert type.

Issue: #4566
Signed-off-by: Umanga Chapagain <chapagainumanga@gmail.com>
2020-04-04 14:00:19 +05:30
ShyamsundarR de97b6a1d6 ceph: Add ability to specify compression mode for pools
This commit enables configuring a compression_mode for pools
that takes the values as specified for bluestore OSD
compression_mode values,
https://docs.ceph.com/docs/master/rados/configuration/bluestore-config-ref/#inline-compression

Signed-off-by: ShyamsundarR <srangana@redhat.com>
2020-04-01 14:24:30 -04:00
Travis Nielsen 7bbc559e86 Merge pull request #5098 from travisn/metadata-pool-pgs-master
Set pg_num for rgw metadata pools to lower default
2020-03-27 13:02:24 -06:00
Travis Nielsen e39637930d ceph: set pg_num for rgw metadata pools to lower default
The PG count on metadata pools should default to rgw_rados_pool_pg_num_min
instead of the more general default pg count. This means rgw pools
will default to 8 PGs instead of 32 PGs, which means a lot more pools
can be created before hitting the default PG limit.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-03-27 09:06:59 -06:00
morimoto-cybozu 0c3439c707 ceph: check LV availability by "ceph-volume lvm list"
This commit adds support for LVs to the device availability check
in the OSD prepare pod.
The availability of an LV is checked by "ceph-volume lvm list".
If it returns non-empty result, the LV is in use and not available.

Closes: https://github.com/rook/rook/issues/5075
Signed-off-by: morimoto-cybozu <kenji_morimoto@cybozu.co.jp>
2020-03-27 13:30:08 +00:00
morimoto-cybozu ab83738aac ceph: fix device path passed to "ceph-volume inventory"
This commit fixes the argument for "ceph-volume inventory".
When a device "/dev/mapper/foo" is being checked for its availability,
the argument should not be "/dev/foo" nor "/dev/dm-1".

Signed-off-by: morimoto-cybozu <kenji_morimoto@cybozu.co.jp>
2020-03-27 11:24:47 +00:00
Travis Nielsen 5254de1a8c ceph: simplify pool model to v1 types
The pools had some legacy structs that translated between the
ceph.v1 types used by the CRDs and the internal implementation
of the pools. This simplifies the pool implementation by removing
the intermediate model and leaving us only with the ceph v1
pool types and no unnecessary translation.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-03-25 16:59:12 -06:00
Satoru Takeuchi 167cbd7244 ceph: set pgnum of block pools to the default value
Rook should always set the pgnum of the new block pool
to the default value("0"). Current implementation accidentally
works fine because newPool.Number is always 0 here.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2020-03-24 03:06:25 +00:00
Sébastien Han 7caedefb4f Merge pull request #5039 from travisn/bulk-cleanup
Logging and exec package cleanup
2020-03-19 16:54:19 +01:00
Travis Nielsen e8f9cfcb71 exec: always write commands to debug log
Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-03-19 07:49:54 -06:00
Travis Nielsen f2ecaa2bda exec: remove the unused actionName param
The helpers for executing a process have long required an actionName
param which is not being used. Now we remove the old param
while also cleaning up various other usages of the exec
package.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-03-19 07:49:53 -06:00
Travis Nielsen 18b0e7d295 ceph: scrub ceph commands to write actions to the log
The ceph commands are now only written to the log in debug mode.
For commands that change the system state we now ensure that
a useful log entry is written. If all the details of the ceph
commands are needed, debug logging should still be enabled.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-03-19 07:49:53 -06:00
Travis Nielsen 0344074c82 ceph: remove dead code for process management
Rook no longer relies on its own process management, now we can rely
completely on Kubernetes to manage the pod lifecycle. The code
to check for running processes and replacement them hasn't been
used for a long while.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-03-19 07:49:53 -06:00
Kristoffer Grönlund f49ad5ad33 ceph: Make error unique when OSD on PVC fails to initialize
To make debugging easier, make sure each error path has
a unique message.

Signed-off-by: Kristoffer Grönlund <kgronlund@suse.com>
2020-03-19 09:46:13 +01:00
Sébastien Han 99f6402563 ceph: allow setting pool size 1 on octopus
Left from https://github.com/rook/rook/pull/4895
Also more cleanup on the ceph.conf since we config is in the mon store.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-03-13 15:48:08 +01:00
Travis Nielsen 3cef930fab ceph: report osd status when there are no devices
The OSD prepare pod must always update status on the status configmap
in order to alert the operator that the OSD configuration on the node
is completed. This fixes an issue where the status was not being reported
if no devices were configured.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-03-05 14:10:24 -07:00
Travis Nielsen a52948e7f7 ceph: continue orchestration even if osd status update fails
The communication between the operator and OSD prepare job
is done through updates to the configmap. If an update fails
to the configmap, we are anyway going to need to check the logs
for failure. So let's just log the error and make a best effort
to continue the orchestration. If the failure was temporary,
the next update to the status would succeed and likely continue
working as expected.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-03-05 14:08:58 -07:00
Sébastien Han a3068dee0b ceph: separate controller for CephBlockPool CRD
Now, the CephBlockPool CRD is managed with the controller-runtime.
So the watcher is outside of the main controller reconciliation loop of
CephCluster which brings numerous benefit such as:

* having its own reconciliation loop
* won't block anything from the main CephCluster controller loop
* fast than waiting for CephCluster loop to completion

Partially close: https://github.com/rook/rook/issues/1981
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-03-02 17:31:03 +01:00
Sébastien Han acab9b0ead ceph: enable command debug when DEBUG
Only print command debugs if the operator log level is DEBUG.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-03-02 09:29:48 +01:00
Sébastien Han 9f13cba8be ceph: print command output
Print the output so that we can parse it and silence it if we want.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-03-02 09:29:48 +01:00
Travis Nielsen bcb99d86ce crds: pick up the rook types in the v1 package
The rook types used across the storage providers moved from the v1alpha2
package to the v1 package. This commit points the packages at their new
location. Implementation is expected to remain unchanged.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-02-26 11:18:17 -07:00
Sébastien Han dab9233c8b ceph: add CRD setting for pool size 1
As of Octopus, Ceph will prevent you from creating a pool with a
replica size of 1. Allowing such pool could lead to data loss, so enable
the new option: requireSafeReplicaSize: false if you are **ABSOLUTELY**
certain that is what you want.

Closes: https://github.com/rook/rook/issues/4889
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-02-25 16:28:58 +01:00
Sébastien Han 5ca4880ed0 Merge pull request #4888 from leseb/pvc-hybrid-dev-class
ceph: set crush device class via annotations on PVC
2020-02-25 14:07:22 +01:00
Sébastien Han ccef1f5601 Merge pull request #4867 from nizamial09/error_handling
rook: Handling Unhandled errors
2020-02-25 09:27:58 +01:00
Nizamudeen 53883f68cf ceph: Handling Unhandled errors
This commit is to handle all those unhandled errors which raises the gosec warning.

Fixed G104: Unhandled Errors are handled now

Signed-off-by: Nizamudeen <nia@redhat.com>
2020-02-21 22:48:24 +05:30
Travis Nielsen d81d2ff61d ceph: remove obsolete ceph.conf settings
The Ceph daemons no longer use the ceph.conf for settings generated
by the operator. The operator only generates the ceph.conf in order
to connect to the mons and configure the cluster. Now we reduce
to the minimal required settings.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-02-20 16:30:35 -07:00
Sébastien Han a702f463cc ceph: set crush device class via annotations on PVC
When the OSD on PVC is backed by a metadata block PVC, the Ceph CRUSH
device class should be set to something else rather than the rotational
property of the drive.

Closes: https://github.com/rook/rook/issues/4881
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-02-20 18:53:31 +01:00