Commit Graph
659 Commits
Author SHA1 Message Date
Travis Nielsen 8f9df75f7b ceph: capture logging from the osd daemon
The OSD daemon has been missing critical flags for logging to stderr
where k8s can capture the logs. Without the --log-to-stderr=true,
all the OSD logging was essentially lost until now.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-07-06 14:38:37 -06:00
Travis Nielsen dbae36b2bb ceph: update to the latest octopus release
Update the base operator image and cluster examples to use the latest
octopus release v15.2.4. Also cleanup some old examples and unit tests
that were still based on mimic.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-07-06 12:11:47 -06:00
Travis Nielsen 99f17d3a33 ceph: force delete stuck mons in every reconcile
The stuck mons were only being force deleted in the mon health checker.
After an operator restart, the health check may not be executed
for 20 minutes until after the timeout during the main reconcile
which is holding onto a lock for mon reconcile. Now the stuck mon
will be deleted during the reconcile as well.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-06-29 10:38:16 -06:00
Travis Nielsen 1d370b1314 ceph: during mon failover remove the backing pvc
If the mon is backed by a pvc, ensure the pvc is deleted when
the mon is failed over. The pvc is being left in a bound state
even though it will no longer be used in the cluster.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-06-24 15:37:42 -06:00
Travis Nielsen 0be6fdfa2d ceph: save mon config even if failed to remove dead mon
During mon failover if the mon fails to be removed, the new mon
config was not being saved. The mon removal anyway is not retried
if it fails, so it should make a best effort to remove all the
resources related to the mon, and then always update the mon
config after the failover.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-06-24 15:37:42 -06:00
binoue 57b944abfb ceph: fix an argument name
This commit fixes an argument of the CreateCrashCollectorSecret function as
it is expected to be the namespace of the cluster.

Signed-off-by: binoue <banji-inoue@cybozu.co.jp>
2020-06-21 20:27:34 +09:00
Sébastien Han aca541803b Merge pull request #5664 from leseb/ceph-object-user-external
ceph: add external support for object store user
2020-06-18 20:10:05 +02:00
Sébastien Han 84d1e28c99 ceph: add external support for objectstoreuser
Now, the object store user is capable of creating s3 users on an
external Ceph cluster.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-06-18 16:34:01 +02:00
Travis Nielsen 0e4c5e1d58 ceph: update maxMonId if incorrect
When the operator loads the mons and checks for a valid maxMonId
the check of the id against the currently running mons was outdated
from legacy mon ids. The check now has to parse the new id which is
just the letter instead of having a number from legacy mon ids.
Without this fix, the maxMonId would stay incorrect if it was somehow
corrupted.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-06-17 17:44:58 -06: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
UMEZAWA Takeshi 6085ff3223 ceph: add schedulerName property to storageClassDeviceSet
Support schdulerName to use another scheduler for OSD pod placement.

Closes: https://github.com/rook/rook/issues/5536
Signed-off-by: UMEZAWA Takeshi <takeshi-umezawa@cybozu.co.jp>
Signed-off-by: Masayuki Ishii <masa213f@gmail.com>
2020-06-12 11:53:28 +09:00
Travis Nielsen 5a02de5621 ceph: metadata pvcs use a map instead of slice index
The volume sources for an OSD on PVC were relying on the ordering
of the volume sources slice. While this was working, it was causing
headaches and potential future developer error when being
interpreted incorrectly. The addition of the wal pvc device
would make the issue even more pronounced. Now each PVC used
for the OSD will be identified in a map by name such as data
 and metadata.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-06-11 08:58:53 -06:00
Travis Nielsen 955dcb930e Merge pull request #5377 from alimaredia/wip-object-store-multisite
Foundation for Object Store Multisite CRs
2020-06-10 16:07:53 -06:00
Ali Maredia fc579f4520 ceph: initial commit for ceph rgw multisite resources
This commit contains CR implementations for:
CephObjectRealm
CephObjectZoneGroup
CephObjectZone

Also there are changes made to the objectstore
to add rgws in the object-store to zones and
zone groups in a multisite configuration and
the removal of the --default parameter for any
realms/zonegroups/zones that are created.

Signed-off-by: Ali Maredia <amaredia@redhat.com>
2020-06-09 16:28:53 -04: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 2749035315 ceph: do not activate crash module
The mgr crash module is always enabled so we don't need to run the
command again. It saves some orchestration time.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-06-09 15:37:04 +02:00
Travis Nielsen 282a2a3741 ceph: increase osd size when pvc template increases
When the PVC template increases in size for the storageClassDeviceSet
in the cluster CR, we need to increase the size of the PVC and restart
the OSD. The OSD is restarted by changing a variable on the pod spec
that indicates the desired size of the OSD.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-06-08 14:34:43 -06:00
Travis Nielsen daeb9b56b0 ceph: remove dead osd code
The completeProvisionSkipOSDStart function is no longer used.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-06-08 14:34:43 -06:00
Sébastien Han 887836586a Merge pull request #5595 from afflom/port-naming-work
Configurable Service Port Names
2020-06-08 12:57:01 +02:00
Alex Flom 9a4d535f09 ceph: hardcode service port and container port names
When integrating rook with istio, service port names need to be prefixed by their protocol.
Trying to fix this by removing static port names in favor of configurable names.

Closes: #5587

add protocol prefix to service port names, hardcoded as discussed. renamed container ports

Signed-off-by: Alex Flom <alexander.flom@gmail.com>
2020-06-06 21:58:23 -04:00
Sébastien Han bfa3b4daf4 ceph: do not use external node IP for mon endpoint
When the cluster is using HostNetworking, Rook was either picking up the
external or internal IP of the node. This resulted in mon endpoints have
public IP addresses. Those IP are not reachable from within the cluster
so OSD/CSI couldn't access the monitors from the configmap endpoint.

Also, exposing the cluster on a public network does not seem realistic,
so sticky with private/internal IP addresses is better.

Closes: https://github.com/rook/rook/issues/5495
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-06-04 14:12:45 +02:00
Travis Nielsen 3ab060965c ceph: force restart mon pods if on bad node
If a mon is stuck in terminating state on a failed node,
force delete the pod so it can attempt to restart. If
the mon is backed by a PV the mon can start on another
node as well.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-28 12:11:05 -06:00
Travis Nielsen ff6a3f80cd ceph: improve osd update logging
The operator should only print helpful info messages
when an OSD is going to be updated. If the OSD hasn't
changed it is just a debug message.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-28 10:05:51 -06:00
Travis Nielsen 07f095c772 ceph: set osd health check interval to 60s
The osd health check every 5 min is not frequent enough to respond
quickly enough to osds going down. Reducing the time interval
to one minute for faster response time.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-28 10:05:51 -06:00
Travis Nielsen 171910707b ceph: refactor pod deletion to k8sutil package
The pod deletion is needed by other daemons besides the osds,
so we move the helper method into the k8sutil package.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-28 10:05:50 -06:00
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 0ed8e73942 ceph: add missing security context to crash collector
The crash collector was missing the security context to properly run on
OCP, thus crashing when trying to post a crash dump.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-05-26 16:35:11 +02:00
Sébastien Han 062e58e053 ceph: do not enforce osd-memory-target
As of Nautilus Ceph auto-tunes its osd_memory_target on the fly so we don't need to force it.
ROok does not support Mimic anymore so this can be removed.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-05-22 11:09:02 +02:00
Travis Nielsen 8bb4f603e6 ceph: default the device set template name to data
In 1.3 we added support for the metadata pvcs, thus requiring the name
to be set on the templates to differentiate between data and metadata.
For backward compatibility we need to assume the template is for data
if it is not set.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-21 11:33:16 -06:00
Sébastien Han d28e2f605c Merge pull request #5490 from travisn/monitoring-goroutines
Only run the cluster monitoring goroutines once
2020-05-19 09:40:13 +02:00
Travis Nielsen 394b98cb0b ceph: cancel the host cleanup if pvc deletion pending
During cluster delection, the finalizer will not be removed until
all the PVCs are removed. Since this could wait for a long time,
as long as the deletion event is re-queued, we need to cancel
the goroutine that is watching for cluster deletion so it can
avoid running multiple goroutines as the event runs again
and again.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-18 13:07:35 -06:00
Travis Nielsen 4173bee7c1 ceph: stop monitoring a cluster when deleted
When a cluster is requested for deletion there is no longer
a reason to monitor the cluster health such as whether mons
are in quorum, osds are up and in, or monitor the ceph status.
The cluster will wait potentially for a long time if the
PVCs are not deleted by the admin, therefore we stop monitoring
the cluster even before the finalizer is removed.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-18 13:02:37 -06:00
Travis Nielsen 90fa3a6d22 ceph: set external creds if admin key is available
If the admin key is available, set the external creds struct
to use that admin username and key instead of requiring the
callers to check every time if they should use the admin
key or the external key.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-18 12:56:28 -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 85b0be301e ceph: simplify ceph user for monitoring goroutines
The ceph username is all that needs to be passed to the goroutines
that are monitoring the health of Ceph. This simplifies the
initialization of the goroutines.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-18 12:56:27 -06:00
Travis Nielsen 52e15b6e36 ceph: only run the cluster monitoring goroutines once
The monitoring goroutines that check for mon and osd health,
the ceph cluster status, and the bucket provisioner should
only be started once for each cluster. Previous to this change
and since the controller runtime conversion the goroutines were
being started again every time a reconcile was run. This means
you could potentially have many goroutines monitoring the same
thing.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-18 12:55:58 -06:00
Travis Nielsen d1da12c6ac ceph: wait indefinitely for cleanup before removing cluster finalizer
During cluster deletion, we currently only retry for a couple minutes
to wait for the pvcs to be deleted. After the timeout, we proceed
with the cluster deletion. To properly protect the pvcs for proper
cleanup, the finalizer should not be removed until the pvcs
are all confirmed to be deleted. In order to not block other cluster
events, we re-queue the deletion event to run again every 10s
until the pvcs are deleted or the finalizer is manually removed.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-14 16:52:24 -06:00
Travis Nielsen f47bb945c2 ceph: remove duplicate controller wait setting
The controller setting for requeuing an event moved to the
opcontroller package and was no longer needed in the main
controller package.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-14 16:52:24 -06:00
Travis Nielsen 516520ff47 Merge pull request #5450 from leseb/external-workload-secret
ceph: create missing secret on external cluster
2020-05-11 14:19:27 -06:00
Sébastien Han 1fef75bc6a ceph: create missing secret on external cluster
When Rook-Ceph is connected to an external cluster and the admin tries
to create resources such as CephFilesystem or CephObjectStore, we must
create the rook-ceph-config secret so that the daemons can get their mon
information.

Closes: https://github.com/rook/rook/issues/5439
Signed-off-by: Sébastien Han <seb@redhat.com>
2020-05-11 18:51:44 +02:00
Travis Nielsen 65377cbe63 ceph: osd on pvc node assignment is node selector
An OSD on a PVC when portable=false is assigned to a node
with a node selector. The same node assignment is expected
for the lifetime of the cluster. On subsequent reconciles,
the operator was looking up the node assignment from the
nodeName on the pod spec, which is not set if the pod is down.
The operator needs to retrieve the assignment from the
deployment spec node selector.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-07 10:51:46 -06:00
Sébastien Han 228041902b Merge pull request #5406 from cybozu-go/ceph-cleanup-osd-on-pvc
ceph: judge whether an OSD is on PVC or not by function
2020-05-07 09:13:39 +02:00
Travis Nielsen 3c6bae56b7 ceph: delete terminating osd pods even if not out
When an OSD pod is stuck in terminating state, there is no need
to check if the OSD is marked as out before force deleting.
As long as the osd is down we will force delete the pod.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-05-06 15:43:04 -06:00
Satoru Takeuchi 417ea131bc ceph: judge whether an OSD is on PVC or not by function
There are many duplicated code to judge whether an OSD is on PVC
or not. Instead, let's introduce a function for this purpose.
It can also be applied to the logic of judging whether an OSD
on PVC has metadata device or not.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2020-05-07 00:49:17 +09:00
Sébastien Han b86bb9c528 ceph: add support for OBC on external cluster
We can now consume an external s3 endpoint which is not managed by Rook.

Signed-off-by: Sébastien Han <seb@redhat.com>
2020-05-04 18:14:26 +02:00
Travis Nielsen c713fd30f9 ceph: restart portable osd pod if stuck
If the OSD pod is portable and is on a failed node, the node
will be stuck indefinitely in the terminating state. The pod
can be force deleted in this scenario in order to allow the
underlying volume to be detached and then mounted on another
node.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2020-04-30 09:52:54 -06: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
Satoru Takeuchi f78efc50aa cleanup: use the constants of environment variables properly
There are some code where constants of environment variables
are defined but not used properly. Let's avoid to use string
literals as possible.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2020-04-24 17:31:00 +00:00
Sébastien Han f792cd7c04 Merge pull request #5280 from travisn/mgr-module-async
Configure mgr modules in parallel of rest of reconcile loop
2020-04-20 14:07:21 +02:00