Commit Graph
186 Commits
Author SHA1 Message Date
Travis Nielsen 87e2b09453 ceph: clarify log message for Ceph upgrades
Some log messages indicate when the upgrade checks will be
performed. If the Ceph image hasn't changed, the upgrade checks
are skipped. The messages were confusing if running a Rook
upgrade.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2019-11-22 09:03:03 -07:00
Blaine Gardner f32cecb701 Merge pull request #3206 from d-luu/ceph_priority_classes
ceph: added priority classes to components
2019-11-18 11:27:57 -07:00
d-luu 9c755fac66 ceph: added priority classes to components
Adds priority class support to Ceph components
  to influence scheduler's pod preemption

Signed-off-by: d-luu <david@davidluu.info>
2019-11-15 16:28:41 -06:00
Sébastien Han 3e82a0f4a6 ceph: osd add env var to skip uded on lvm
With DM_DISABLE_UDEV, LVM will avoid interaction with udev.
LVM will manage the relevant nodes in /dev directly.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-11-15 22:54:03 +01:00
Sébastien Han 314394f464 Merge pull request #4281 from rohantmp/consolidated
Ceph: Fix topology logic for drains.
2019-11-13 16:37:09 +01:00
Rohan CJ 1ba2633c27 Ceph: Clean up canaries on nodes that no longer have OSDs or when the node is deleted.
This prevents long-lasting false positives that prevent the ordered progression
of drains.

Signed-off-by: Rohan CJ <rohantmp@gmail.com>
2019-11-13 16:04:45 +05:30
Rohan CJ dd3f0ca63c Ceph: Set the drain-canaries deployment ownerReference to the rook operator.
The drain canary was not being garbage collected properly.

Signed-off-by: Rohan CJ <rohantmp@gmail.com>
2019-11-13 16:04:45 +05:30
Sébastien Han d9679e5cf4 Merge pull request #3316 from leseb/ceph-crash
ceph: add ceph-crash controller
2019-11-12 23:16:02 +01:00
Sébastien Han a0fdf1bb5f ceph: add CEPH_VOLUME_SKIP_RESTORECON env var
This will tell ceph-volume not to run any restorecon commands.

This relies on https://github.com/ceph/ceph/pull/31421

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-11-12 16:27:20 +01:00
Sébastien HanandRohan CJ 90cd8224f4 ceph: add ceph-crash controller
A new controller to bootstrap ceph-crash pod on Ceph nodes running Ceph
pods only.

This implementation is unfortunately a mix of 'hacks' to make the daemon
working correclty. The ceph-crash script faced different issues:

* it's not a daemon
* it does not have any key in cephx
* it runs ceph commands under the hood which need an admin key and a
ceph.conf

On upstream Ceph, ceph-crash needs to grow better, once that happens we
will improve our implementation.

This also enhances osd provisionConfig struct with DataPathMap

Pod volumes and volume mount needs DataPathMap to perform the right
actions on log and crash dir. Exposing DataPathMap makes that possible.

Obviously, this is exposing ceph crash reports on the host as
well as pushing them into the mgr.
Basically, if a daemon fails, it'll put its core dump into
/var/lib/ceph/crash, bindmounting this dir on the host, ensures that the
crashes don't get lost when the pod dies.

Example:

```
[leseb@tarox~/go/src/github.com/rook/rook][rgw-liveprobe !] kubectl -n rook-ceph exec -ti rook-ceph-crashcollector-minikube-574858b99c-zvg4z bash
bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or directory
[root@rook-ceph-crashcollector-minikube-574858b99c-zvg4z /]# ceph crash ls

[root@rook-ceph-osd-2-7644f99695-cljzh /]# pidof ceph-osd
13258 5415 5397
[root@rook-ceph-osd-2-7644f99695-cljzh /]# kill -SIGABRT 13258
[root@rook-ceph-osd-2-7644f99695-cljzh /]# ls /var/lib/ceph/crash/
2019-11-12_12:56:51.404109Z_39f060e1-776d-4605-8f28-85c97e53de96     posted

... wait maximum 10 min (ceph-crash scraps every 10 minutes)
... the container will exit

[root@rook-ceph-osd-2-7644f99695-cljzh /]# exit
[leseb@tarox~/go/src/github.com/rook/rook][rgw-liveprobe !]
[leseb@tarox~/go/src/github.com/rook/rook][rgw-liveprobe !] kubectl -n rook-ceph exec -ti rook-ceph-crashcollector-minikube-574858b99c-zvg4z bash
bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or directory
[root@rook-ceph-crashcollector-minikube-574858b99c-zvg4z /]#
[root@rook-ceph-crashcollector-minikube-574858b99c-zvg4z /]#
[root@rook-ceph-crashcollector-minikube-574858b99c-zvg4z /]# ceph crash ls
2019-11-12_12:56:51.404109Z_39f060e1-776d-4605-8f28-85c97e53de96 osd.1
[root@rook-ceph-crashcollector-minikube-574858b99c-zvg4z /]# ls /var/lib/ceph/crash/
posted
[root@rook-ceph-crashcollector-minikube-574858b99c-zvg4z /]# ls /var/lib/ceph/crash/posted/
2019-11-12_12:56:51.404109Z_39f060e1-776d-4605-8f28-85c97e53de96
[root@rook-ceph-crashcollector-minikube-574858b99c-zvg4z /]# tail /var/lib/ceph/crash/posted/2019-11-12_12\:56\:51.404109Z_39f060e1-776d-4605-8f28-85c97e53de96/log
   1/ 5 mgr
   1/ 5 mgrc
   1/ 5 dpdk
   1/ 5 eventtrace
  -2/-2 (syslog threshold)
  -1/-1 (stderr threshold)
  max_recent     10000
  max_new         1000
  log_file /var/lib/ceph/crash/2019-11-12_12:56:51.404109Z_39f060e1-776d-4605-8f28-85c97e53de96/log
--- end dump of recent events ---
```

Signed-off-by: Sébastien Han <seb@redhat.com>
Co-authored-by: Rohan CJ <rohantmp@gmail.com>
2019-11-12 16:06:07 +01:00
Sébastien Han 76c33e0f85 Revert "ceph: osd hide 'restorecon' when necessary"
This reverts commit d224fbdef1.
Since https://github.com/ceph/ceph/pull/31421, the monkey patching of
'restorecon' is not needed anymore.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-11-12 15:34:12 +01:00
Travis Nielsen 0bb8000825 Merge pull request #4273 from egafford/associate-keyrings-with-deployments
ceph: Standardize association of keyrings with deployments
2019-11-11 17:06:24 -07:00
Rohan CJ 4d7c6df034 Ceph: Fix topologyAware in clusterdisruption package does not respect the rook topolgy prefix.
Allow the clusterdisruption package to recognize node topologies other than zone.

Signed-off-by: Rohan CJ <rohantmp@gmail.com>
2019-11-11 09:38:33 +05:30
egafford bb7aac4b62 ceph: Standardize association of keyrings with deployments
This change standardizes the ownerRefs of Ceph keyrings to
k8s Deployment resources across all daemons and refactors a
bit of duplicate code on keyring association for ease of
maintenance.

Fixes: #4089

Signed-off-by: egafford <egafford@redhat.com>
2019-11-08 09:50:37 -05:00
Santosh Pillai 26360689f5 ceph: skip osd prepare job creation if osd daemon exists for the pvc
When an orchestration is restarted or retriggered and starts new osd prepare pods, they are unable to start because the device is already in use by the osd daemon pods.
This fix simple skips the osd prepare pod creation if the daemon is already running.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-11-08 20:11:49 +05:30
Travis Nielsen 47764715fe ceph: remove the location from the cluster CR
The topology of the cluster should be based on the node labels rather
than a setting in the cluster CR. This allows a much richer and more
dynamic topology to be configured. The location will now be ignored
if specified in the cluster CR.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2019-11-04 23:07:13 -07:00
Sébastien Han ef6815ebfa ceph: remove topologyAware CRD option
We removed the topologyAware CRD option since it was redundant with the
use of an OSD being backed by a PVC.
So now, if an OSD is backed by a PVC we assume the topology aware
decision and will discover zone and region labels on that host.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-11-04 09:53:14 -07:00
Travis Nielsen 831c15086a ceph: support all layers of CRUSH map with node labels
The node labels were already supported for zones and regions to add to
the CRUSH map. Now all layers of the CRUSH map will be supported
with the new labels such as topology.rook.io/rack.
The labels will be detected at the osd startup time
similar to the zone and region labels already being detected.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2019-10-31 14:47:18 -06:00
Sébastien Han 09e29d01b1 Merge pull request #4214 from leseb/skip-restorecon
ceph: osd hide 'restorecon' when necessary
2019-10-30 14:44:30 +01:00
Sébastien Han d224fbdef1 ceph: osd hide 'restorecon' when necessary
Some testing on OpenShift has shown that enabling Hostnetworking causes
issues with ceph-volume creating OSD.
This is a pure Red Hat OpenShift downstream issue.

This is meant to be temporary while we are waiting for the Selinux team
to get back to us.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-10-30 11:32:15 +01:00
egafford 51689b6d3f ceph: Generate keyrings before OSD deployment
Generating keyrings after deployments created a race condition
resulting in intermittent OSD pod failure on the first attempt.
This change creates keyrings prior to creation of OSD deployments
and updates the owner after the creation of a deployment.

Partially fixes: rook#4089
Signed-off-by: egafford <egafford@redhat.com>
2019-10-29 16:01:50 -04:00
Sébastien Han 5662911317 ceph: fix set osd prepare resources
Use the right struct field. Previously it was pointing to the osd global
resource now it does the osd prepare.

Closes: https://github.com/rook/rook/issues/4182
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-10-25 10:55:25 +02:00
Sébastien Han 9f053ca4e1 ceph: osd remove --conf flag
Even legacy osds were still running with this flag. In my previous patch
I was trying to minimize the impact of the change and was afraid the
config file was holding important information but that appears not to be
true.

The only option in the config could have the keyring path, but it's
passed in the CLI startup line.

Closes: https://github.com/rook/rook/issues/4063
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-10-23 11:43:28 -06:00
Travis Nielsen 733eed9461 Merge pull request #3996 from sp98/fix-operator-reconcile
fix operator reconcile to restart osd daemons
2019-10-23 10:09:54 -06:00
Santosh Pillai 8ea693a740 ceph: fix operator reconcile to restart osds daemons
OSD on PVC does not upgrade when the user upgrades the ceph version on cluster-on-pvc yaml.
The solution incudes:
   - upgrade osd prepare and daemon pods on upgrade
   - skip c-v prepare if filesystem is already present on the pvc device.
   - skip lvm release in case of upgrade.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-10-23 16:56:15 +05:30
rohan47 7f9611d489 Ceph: Added removeOSDsIfOutAndSafeToRemove to Cluster CR
OSDs can be removed automatically with the current mechanism if a new
setting removeOSDsIfOutAndSafeToRemove is set to true. The default for
all new or upgraded clusters should be false.

Signed-off-by: rohan47 <rohgupta@redhat.com>
2019-10-23 15:10:36 +05:30
Sébastien Han 1081c58423 Merge pull request #4009 from sp98/add-k8s-version-check
[OSD on PVC] add kubernetes version check.
2019-10-21 11:23:01 +02:00
Sébastien Han 1765ad6508 ceph: expose prepare pod resource limits
The osd-prepare jobs should not inherit osd resources since this might
cause scheduling issues.
Instead, we can now use the new CRD property `prepareosd` in the resource section.

Refer to the documentation for more details.

Closes: https://github.com/rook/rook/issues/2502
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-10-18 16:48:03 +02:00
Santosh Pillai edf0c7aea7 ceph: add kubernetes version check for running osd on pvc.
- OSD on PVC provisioning fails if k8s version is less than 1.13.0
  - updated document to reflect minimum k8s version required.
  - Added check to skip OSD on pvc provisoning if the minimum k8s version requirement is not met.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-10-17 13:37:40 -06:00
Mateusz Los cb52aea9a3 ceph: add OSDs to proper buckets in crush hierarchy while deployment
add missing topologyAware and location env variables to OSD pods

Signed-off-by: Mateusz Los <los.mateusz@gmail.com>
2019-10-15 17:15:01 -06:00
Blaine Gardner db7a6da09e ceph: do ceph:ceph chown in init containers
Following the Ceph OSD rework, my test environment regularly failed to
start OSDs, as they would start before the postStart lifecyle hook which
was chown'ing the log and data directories could finish. Pods failed to
start for an arbitrarily long time before starting successfully. This
was a manifestation of a race condition identified in Ceph monitors in
https://github.com/rook/rook/pull/3594#discussion_r312279176

Create a Ceph operator-level method to create an init container that
will chown the necessary directories for all Ceph daemons (any daemon
which runs as the ceph:ceph user-and-group). Also add this container to
expectations for Ceph pod templates in unit tests.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-10-15 12:12:46 -06:00
Blaine Gardner 70810dd55a ceph: osd: do not init ceph.conf for dir OSDs
Just as with the mon, mgr, mds, rgw, and rbd-mirror daemons, do not
generate a ceph.conf in an init container for directory-based OSDs.
Instead use the mon config database and the commandline to supply all
the needed arguments for running these OSDs.

Also generate a keyring secret to mount to OSD pods. Use this
secret for directory-based OSDs for now with the intention to
use this for other OSDs in the future.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-10-15 12:12:46 -06:00
Blaine Gardner e2155afa0f ceph: osd: use mon DB config for dir-based OSDs
As with the rest of the Ceph daemons, use the new config patters for
dir-based OSDs. Do not generate a config to use in an init container;
instead use CLI flags and the mon config database.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-10-15 10:10:08 -06:00
Blaine Gardner 9ab2b885d4 ceph: osd: use DataPathMap for dir-based OSDs
This is just one small unit of work that still results in usable
dir-based OSDs. The goal is to build on this to run dir-based OSDs using
the new config patterns used by the other Ceph daemons. This also
removes an unnecessary mount of the dataDirHostPath in directory-based
OSD containers.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-10-15 10:10:07 -06:00
Erik KnudtsonandSébastien Han ec4d0c8925 ceph: remove decimal places for osdMemoryTargetValue
Update pkg/operator/ceph/cluster/osd/spec.go

Rook v1.1.2 uses a different command to start an OSD, and seems to
have problems when --osd-memory-target contains a number with a
decimal point.

Co-Authored-By: Sébastien Han <seb@redhat.com>
Signed-off-by: Erik Knudtson <eknudtson@discogsinc.com>
2019-10-07 09:32:49 -07:00
James Lu b8d7382b7a Ceph: nodes always in OrchestrationStatusStarting
When osd nodes do not finish the prepare jobs, the user remove the
nodes manully and it causes nodes always is
'OrchestrationStatusStarting' status.
Try to remove them after completeProvisionTimeout.

Signed-off-by: James Lu <jamesluhz@gmail.com>
2019-10-03 08:08:46 +08:00
Sébastien Han ae8e45585f ceph: osd add fsid to daemon flag
Now that the ceph.conf is gone, it's safer to run the OSD with the
cluster fsid flag.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-26 15:29:24 +02:00
Sébastien Han a4a180b8fb ceph: osd remove config file
We don't need to force any Ceph config file for ceph-volume based OSDs
since the 'ceph-volume activate' command mount everything at start time
in the right place.
So now, OSD will keep running normally and they will also read back
normally the default location of the ceph configuration:
/etc/ceph/ceph.conf which will allow OSDs to read any configuration
overrides.
We cannot remove the generation of that file in /var/lib/rook/osd* since
we cannot tell at the stage that triggers the generation if we run
ceph-volume or not. So let's keep it around for some time.
If you are wondering how the OSD connects to the mons this is done via
the CEPH_ARGS env variable which was introduced in
https://github.com/rook/rook/pull/3894.

Closes: https://github.com/rook/rook/issues/3926
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-26 15:07:53 +02:00
Sébastien Han a42cc44d11 Merge pull request #3894 from mvollman/osd_ceph_conf
ceph: fix encrypted osd startup
2019-09-25 09:00:06 +02:00
Sébastien Han 9b2afbca14 ceph: osd add debug logs for ceph-volume on prepare
Previously the debug flag was turned on for the 'activate' call only,
now 'prepare' will also take advantage of it.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-24 17:17:29 +02:00
Michael Vollman e12bbd6f7c ceph: fix encrypted osd startup
Encrypted OSDs are failing because ceph-volume is unable to determine
how to contact the monitors.  Setting the CEPH_CONF env variable for OSD
pods fixes this issue. (#3846)

Signed-off-by: Michael Vollman <michael.b.vollman@gmail.com>
2019-09-20 16:36:52 -04:00
Travis Nielsen 70c44c6eea Merge pull request #3924 from travisn/osd-on-pvc-nodename
Ceph: OSD pods should always use hostname for node selector
2019-09-20 10:45:10 -06:00
Santosh Pillai 9db863377a release the device held onto by lvm
When running osds on pvc, the lvm is still holding the device when the cluster is deleted. As a result the PVs go into `failed` state
when the cluster is deleted. On deactivating the device, the 'failed' pvs get deleted as well. Solution involves:
- Running `lvchange -an <vg group name>` to deactivate the device.
- This command runs after 'osd prepare' completes.
- This command also runs after the 'osd daemon pod' is deleted or if the ceph-osd process terminates for some reasons.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2019-09-20 18:08:13 +05:30
travisn 57d446ec6f ceph: osds to always use hostname for node selector
The node selector for running OSDs on PVCs was using the node name
rather than the node's hostname. In clusters where the node name
is different from the hostname this would cause the osd daemons
to be in pending state indefinitely. Now the node selector will
use the hostname as expected.

Signed-off-by: travisn <tnielsen@redhat.com>
2019-09-19 16:01:52 -06:00
Travis Nielsen 30fe718a97 Merge pull request #3907 from leseb/c-v-debug-log
ceph: enable ceph-volume debug logs
2019-09-19 12:19:20 -06:00
Sébastien Han 087d71106b ceph: add a new CR property to force upgrades
On rare occasion, the ceph checks might not be 100% correct and the user
might decide to force an upgrade anyway.
Correctly, if we are in an upgrade, we perform `ok-to-stop` check for
each daemon, if one of them fails, we retry and eventually fail.
They are corner-cases where users would like to force the upgrade anyway.

Enhance the new CR property: "skipUpgradeChecks: true".

Closes: https://github.com/rook/rook/issues/3872
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-19 10:55:56 +02:00
Sébastien Han c96fe8b5f8 ceph: enable ceph-volume debug logs
It's fine to enable debug logs from c-v, it's not so verbose and really
useful when debugging.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-18 13:55:18 +02:00
Sébastien Han 171c4ac438 ceph: fix upgrade commands
Several commands were not using the cli finalizer function which builds
up the right argument to run a ceph command. This was working on the
operator since it used to have an /etc/ceph/ceph.conf file so we could
ran the command without specifying the ceph conf and key paths.
However, we recently removed that and it silently broke this "already"
broken code :).

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-09-17 18:59:42 +02:00
rohan47 a4639ae541 Changed the OSD DOWN message to debug level
We want the OSD DOWN message to be shown when debug option is set to
true in the rook-ceph operator.

Signed-off-by: rohan47 <rohgupta@redhat.com>
2019-09-10 22:06:48 +05:30
rohan47 fcbce4898c Set the Command property for the OSD prepare init container blkdevmapper
If a Ceph container image is specified which has a entrypoint then the
Init container for osd prepare job blkdevmapper will fail. So set the
Command property.

Signed-off-by: rohan47 <rohgupta@redhat.com>
2019-09-10 22:05:50 +05:30