Commit Graph
28 Commits
Author SHA1 Message Date
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 3584e8ccce ceph: osd: fix wrong log file path on host
Log file path on host for OSDs was dataDirHostPath/log/<namespace>
instead of dataDirHostPath/<namespace>/log as with other daemons.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-10-15 10:10:06 -06:00
travisn 533ac5b693 ceph: refactor version detection of external cluster
Reduce the duplication of detecting the version of the external cluster
by refactoring to a single method that retrieves and validates the
version

Signed-off-by: travisn <tnielsen@redhat.com>
2019-09-04 19:02:08 -06:00
Blaine Gardner 1be43290be Ceph: override configs in CRD
Allow users to specify overrides in the CephCluster CRD. The override
ConfigMap still exists for emergency situations and is mounted into
daemon pods directly instead of being merged into a Rook-created config
file.

Rook Ceph no longer uses a config file for managing daemons with the
exception of the OSDs which still generate a config in an init
container.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-08-29 15:38:27 -06:00
Travis Nielsen a3bdccefb6 Merge pull request #3581 from jmolmo/issue-3564
Memory limit checked if it really exists
2019-08-09 10:58:45 -06:00
Noah Watkins 05cd7ae700 ceph: when mons use pvc mount volume at subpath
when the root of a filesystem mode pvc is mounted as the base data directory
for the monitor it will not be empty: `lost+found` from ext4 will be present.
this causes the mon mkfs to fail because it expects an empty directory.

the solution is to mount under a directory in the source volume.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2019-08-08 16:30:04 -07:00
Juan Miguel Olmo Martínez 0db62c86d2 Allow to launch pods when memory request is set (but no memory limit) in cluster CRD file
With this change the memory limit is only checked if it has been set
explicitely in the cluster CRD file.
This allow the pod to be created following the Burstable QoS strategy.

Before this change an error was raised (error trying to get the memory
limit) in the spec.CheckPodMemory function and the pod with only a 'memory request' set, was not able to start.

Resolves: #3564

Signed-off-by: Juan Miguel Olmo Martínez jolmomar@redhat.com
Signed-off-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
2019-08-08 11:52:55 +02:00
Noah Watkins 4173c5544e ceph: base monitor storage of pvc
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2019-08-02 10:30:23 -07:00
Blaine Gardner aa0d3346f2 ceph nfs: refactor to use new config pattern
Refactor the Ceph NFS (Ganesha) daemon to use the new config pattern.

Use of a custom Rook binary to run NFS has been removed in favor of
instead running the required DBUS process as a sidecar. The effect here
is that the NFS Ganesha container itself may fail and restart a few
times before the DBUS sidecar is running.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-07-22 11:06:04 -06:00
Sébastien Han 9120791e24 ceph: chown ceph directories
At the beginning of every container startup we now change the ownership
of every known ceph directories to ceph:ceph.

This will allow daemons to start properly as well as allowing daemon to
writes their logs on files.

This is needed because ceph daemon now run as 'ceph' instead of 'root'

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-19 11:13:42 +02:00
Sébastien Han 900abbc967 ceph: run ceph processes with the 'ceph' user
Ceph daemons will run as the 'ceph' user instead of the 'root' user.
Existing data store (osd and mon) owned by root will continue to run as
'root'.
ALl CLI calls also inherate from this and will use them when fetching a key
for instance. If we run on a version of ceph that does not know these
  flags they will simply get ignored.

Consider the following:

[leseb@tarox~/go/src/github.com/rook/rook][use-ceph-user !] kubectl get pods -n rook-ceph
NAME                                     READY     STATUS      RESTARTS   AGE
rook-ceph-mds-myfs-a-67cff7df69-fq4l5    1/1       Running     0          3m
rook-ceph-mds-myfs-b-85bd5f59f5-d8hdn    1/1       Running     0          3m
rook-ceph-mgr-a-7d88b9457b-jzln6         1/1       Running     2          4m
rook-ceph-mon-a-64bf697496-r94tc         1/1       Running     0          4m
rook-ceph-osd-0-c5fdcd74c-9kvb4          1/1       Running     0          3m
rook-ceph-osd-prepare-minikube-shz9l     0/2       Completed   0          3m
rook-ceph-rbd-mirror-a-5cbff8469-xv64c   1/1       Running     0          3m
rook-ceph-rgw-my-store-f7645b44-vlbp4    1/1       Running     0          3m

MDS daemon:
ceph         1  0.2  0.1 449508 29200 ?        Ssl  15:10   0:00 ceph-mds --fsid=bf359e2c-a1df-4a80-9137-8134b41a5459 --keyring=/etc/ceph/keyring-store/keyring --log-to-stderr=true --err-to-stderr=true --mon-cluster-log-to-stderr=true --log-stderr-prefix=debug  --mon-host=10.110.204.228:6789 --mon-initial-members=a --name=mds.myfs-a --setuser=ceph --setgroup=ceph --foreground --mds-standby-for-fscid=1 --mds-standby-replay=true

MGR daemon:
ceph         1  0.8  0.6 867176 104732 ?       Ssl  15:10   0:02 ceph-mgr --fsid=bf359e2c-a1df-4a80-9137-8134b41a5459 --keyring=/etc/ceph/keyring-store/keyring --log-to-stderr=true --err-to-stderr=true --mon-cluster-log-to-stderr=true --log-stderr-prefix=debug  --mon-host=10.110.204.228:6789 --mon-initial-members=a --name=mgr.a --setuser=ceph --setgroup=ceph --foreground

MON daemon:
ceph         1     0  0 15:10 ?        00:00:02 ceph-mon --fsid=bf359e2c-a1df-4a80-9137-8134b41a5459 --keyring=/etc/ceph/keyring-store/keyring --log-to-stderr=true --err-to-stderr=true --mon-cluster-log-to-stderr=true --log-stderr-prefix=debug  --mon-host=10.110.204.228:6789 --mon-initial-members=a --name=mon.a --setuser=ceph --setgroup=ceph --foreground --public-addr=10.110.204.228 --public-bind-addr=172.17.0.6 --setuser-match-path=/var/lib/ceph/mon/ceph-a

OSD daemon:
ceph     30985  0.9  0.5 885736 81236 ?        Ssl  15:10   0:04      |   \_ ceph-osd --foreground --id 0 --conf /var/lib/rook/osd0/rook-ceph.config --osd-data /var/lib/rook/osd0 --setuser-match-path /var/lib/rook/osd0 --setuser ceph --setgro
up ceph --keyring /var/lib/rook/osd0/keyring --cluster rook-ceph --osd-uuid 98b4527d-f7a8-44f0-ac47-f8b55ff5ee05 --osd-journal=/var/lib/rook/osd0/journal

RBD mirror daemon:
ceph         1  0.0  0.1 914500 21848 ?        Ssl  15:10   0:00 rbd-mirror --setuser ceph --setgroup ceph --foreground -n client.rbd-mirror.a --conf /etc/ceph/ceph.conf --keyring /etc/ceph/keyring

RGW daemon:
ceph         1  0.2  0.3 5179452 52244 ?       Ssl  15:11   0:01 radosgw --setuser ceph --setgroup ceph --foreground --name=client.radosgw.gateway --rgw-mime-types-file=/var/lib/rook/rgw/mime.types

Even though Ceph processes are running as Ceph, the container itself runs as root.
We haven't reached the situation where we can runAsUser != "root" and enable SecurityContext to RunAsNonRoot, but that's our ultimate goal.

Resolves: https://github.com/rook/rook/issues/2664
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-07-19 11:13:42 +02:00
Sébastien Han 24abbddf14 ceph: fix pod memory check
This commit fixes the second test case where limit and request are
either identical or different but still we use limit as a value.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-06-07 15:06:16 +02:00
Blaine Gardner f4e2be50a6 ceph spec: add ceph-version label to controllers
Add a 'ceph-version' label to application controllers in the same manner
as the prior 'rook-version' label to help with upgrades.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-04-18 15:09:33 -06:00
Sébastien Han b8874d7f3f ceph: allow logging control
We now run all the daemon with a new option from Nautilus 14.2.1 which
allows us to tell to a daemon to not log on file. However, we can decide
to activate logging by editing the configuration flag 'log_to_file' via
the centralized config store like this for a particular daemon:

ceph config set mon.a log_to_file true

This is useful when a daemon keeps crashing and we want to collect log
files on the system.

Fixes: https://github.com/rook/rook/issues/2881
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-04-15 10:52:03 +02:00
Sébastien Han d4c48bb293 ceph: expose /var/log/ceph to the host
It's quite convinient to expose /var/log/ceph so that we can decide to
activate logs locally on the machine and see what's going on.
This is only a placeholder when a daemon is stuck crashlooping and we
want to allow administrator to gather log files.
We still do not log on file but this can be activated via a config
option passed to the centralized config option store.

For some daemons, which typically do not store any data (rgw, rbd-mirror
and mds) we had to propagate dataDirHostPath from the cluster spec to
each creation call so that the bindmount can happen.

Fixes: https://github.com/rook/rook/issues/2881
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-04-15 10:47:09 +02:00
Sébastien Han 871054e887 ceph: implement pod restriction on memory
If someone sets limits to pod, we want to ensure the possible
experience, so we want to make sure that people do not configure
inapropriate values for certain daemons.
We decide to fail if the memory.limit is too low.

Signed-off-by: Sébastien Han <seb@redhat.com>
2019-03-15 17:35:44 +01:00
Blaine Gardner c12aa6c7c5 ceph rbd-mirror: configure entirely in operator
In the form of mon, mgr, mds, and rgw, convert the rbd-mirror to be
configured completely from the operator. This is a straightforward
conversion with one functional addition: the rbd-mirror daemon stores
*no* data and has no default data dir, so the concept of a `Dataless`
daemon is here introduced.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-03-13 09:54:09 -06:00
Blaine Gardner 086fa8231c rgw: configure entirely in operator
Configure the Ceph rgw daemon completely from the operator a la the
recent changes to the Ceph mon, mgr, and mds operators.

Create the rgw deployment or daemonset first, and then create the
keyring secret for the object store with its owner reference as the
corresponding deployment or daemonset. When the replication controller
is deleted, the secret is also deleted.

The RGW's mime.types file is now stored in a configmap with a different
file created for each object store. This is primarily just a means to
get the mime.types file into the rgw pod, but the added benefit is that
the administrator can modify the configmap, which could reduce
susceptibility to file type execution vulnerabilities (worst case).

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-03-07 08:02:42 -07:00
travisn 31848e23e7 add the CONTAINER_IMAGE env var to the ceph daemon pods
The mgr orchestrator modules need the container image to run
the ceph image for blinking the lights when a disk is down

Signed-off-by: travisn <tnielsen@redhat.com>
2019-03-04 13:33:41 -07:00
Blaine Gardner 4eb4fb7aa6 ceph mds: configure completely from operator
Configure the Ceph mds daemon completely from the operator a la the
recent changes to the Ceph mon and mgr operators.

Create the mds deployments first and then
create the keyring secrets for them with their owner reference as the
corresponding deployment. This will mean that the secrets do not need to
be micromanaged. When the deployment is deleted, the secret is also
deleted. This has not been necessary for the mons or the manager since
the mons share a keyring with a lifespan of the cluster, as does the
mgr, which currently has single-mgr support only.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-02-28 12:31:43 -07:00
Sébastien Han eb3c424d57 Ceph messengers 2 support
This commit introduces the necessary changes to support the new
messenger feature coming with Ceph Nautilus (currently in development).

What changes? Now the monitor listens on two port:

* old 6789 for messenger v1, which will help us support older client
(e,g: krbd)
* new 3300 for messengers v2, which brings new improvement in the
messaging layer. This new transport layer brings numerous advantages
such as encryption improvement, speed improvement, pluggable nature to
support different network stack than TCP and many more.

We still have one Service IP, however it has 2 ports, see:

```
NAME                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)             AGE
rook-ceph-mon-a           ClusterIP   10.106.217.160   <none>        3300/TCP,6789/TCP   4h
rook-ceph-mon-b           ClusterIP   10.99.36.175     <none>        3300/TCP,6789/TCP   4h
rook-ceph-mon-c           ClusterIP   10.108.220.74    <none>        3300/TCP,6789/TCP   4h
````

The `ceph.conf` has changed and we don't force the port when using an IP
address (public addr etc). Ceph, depending on its version will naturally
start the monitors on their right port, 6789.

A new --ceph-version-name CLI argument has been added to the Rook binary
so that when the pod starts it passes the ceph version name and the
configuration of the ceph.conf, as well as daemon startup flags, happen
properly.

Given that the Rook Operator remembers the port of all the monitors it
deployed (through Pod definition), this change is not an issue and will
maintain backward compatibility.

Note that to test this you must build rook with dev container image,
which contains the dev Nautilus version. So you should do something
like:

`make -j4 BASEIMAGE='ceph/daemon-base:latest-master' IMAGES='ceph' build`

Resolves: #2525
Signed-off-by: Sébastien Han <seb@redhat.com>
2019-02-22 00:09:37 +01:00
Blaine Gardner 03ea5f0a7c ceph mgr: configure completely from operator
Configure the Ceph mgr daemon completely from the operator a la the
recent changes to the Ceph mon operator.

The pod spec for the mgr changed quite a bit, and instead of updating
the unit tests of questionable use, some additional unit test tools
applicable to any Ceph daemon have been added and used with the mgr. The
mgrs unit tests should now be more useful and get in the way of devs
less, and they can be used by other daemons later.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-02-11 14:35:01 -07:00
Blaine Gardner ec416cdd92 ceph mons: set up entirely in operator
Make the Rook config-init unnecessary for mons, and remove that init
container. Perform all mon configuration steps in the operator, and set
up the mon pods and k8s environment such that only Ceph containers are
needed for running mons.

This should help streamline changes to the mons, as there will be no
need to change the `daemon/mon` code or `cmd/rook/ceph` code with mon
changes in the future.

This work starts to lay the groundwork for supporting the
`design/ceph-config-updates.md` design.

Notable new bits:

Create a keyring secret store helper for storing dameon keyrings, and
use it to store the mon keyring. Mon pods mount the keyring into a
k8s secret-backed volume.

Create a configmap store for the Ceph config file which can be mounted
into pods/containers directly to /etc/ceph/ceph.conf. Also store
individual mon_host and mon_initial_members values which can be mapped
into pods as environment variables and used in Ceph commandline flags,
enabling the mon pods to have the most up-to-date information about the
mon cluster when restarting and without need for operator intervention.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2019-02-05 06:19:59 -07:00
travisn fdd64bb95a enable rbd mirror daemon in the cluster crd
Signed-off-by: travisn <tnielsen@redhat.com>
2018-11-28 08:29:57 -07:00
Blaine Gardner ce803fbf9d Ceph mds/file: Set up config in init container
Progress toward issue #2003.
Includes design from design doc PR #1578

Use init containers to create configuration for Ceph mgrs. There is only
one init container in this design. The init container calls the Rook
binary to create Ceph config files which are then shared with the mds
daemon main container.

Once this init is run, the main mds daemon is run. Leaving room to use
the Ceph-versioned image in the future, call `ceph-mds --foreground ...`
to run the Ceph mds.

The refactor to using an init container also necessitated refactoring
the mdses replicaset implementation to a deployment-per-pod
implementation due to a chicken-egg problem. With a single container (in
the before times) the Rook binary was able to call the ceph-mds daemon
with an id generated from the pod name. Since the pod name is not known
before runtime, and the id is one of the few params that must be
specified to Ceph daemons on run, it is necessary to know the id
beforehand; thus the move to a deployment architecture following the
likes of the mon and mgr daemons.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2018-10-05 19:01:12 -06:00
Blaine Gardner ca71b7a311 Ceph mgr: Set up config in init container
Progress toward issue #2003.
Includes design from design doc PR #1578

Use init containers to create configuration for Ceph mgrs. There is only
1 init container in this design:
 1. Using the Rook image, call the Rook binary to create Ceph config
files shared with the mgr daemgr container.

Once this init is run, the main mgr daemgr is run. Leaving room to use
the Ceph-versioned image in the future, call `ceph-mgr --foreground ...`
to run the Ceph mgr.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2018-09-21 13:11:08 -06:00
Blaine Gardner 7a5fe8498c Ceph op: Add test package, container tests
Add a 'test' package to the Ceph operator and define a test to verify
that containers produced by Rook-Ceph match what is expected. Because
this is for 'containers' and not strictly for 'ceph containers', this
could be moved a level up to the operator test package; however, if
other backends wish to use the container tests, they will likely need to
make modifications, and there is concern that this might make the Ceph
tests brittle.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2018-09-21 09:58:32 -06:00
Blaine Gardner e3d24106d9 Ceph op: Add spec package, shared vol/mnt defns
Add a package called 'spec' to the Ceph operator to store resource
definition specs that are shared by all Ceph daemons.

Signed-off-by: Blaine Gardner <blaine.gardner@suse.com>
2018-09-21 09:58:32 -06:00