Commit Graph
3904 Commits
Author SHA1 Message Date
subhamkrai 0d17dede9c ceph: change operator log level dynamically
earlier, to change the operator log level we need
to change the deployment which requires a restart
the operator pod.

Now, we are changing the log level dynamically
by reading the configmap. For, backward compatibility
we still load from env var.

Signed-off-by: subhamkrai <srai@redhat.com>
2021-05-27 12:40:50 +05:30
Satoru Takeuchi ca9aa1a11c ceph: parse json correctly
radosgw-admin may output logs before and after JSON when this command succeeds. We should
get rid of these logs before unmarshaling output. Although the logs before JSON were
treated in  PR7354, the logs after JSON weren't.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2021-05-27 04:46:13 +00:00
Travis Nielsen d3c18d001b Merge pull request #7974 from leseb/fix-7963
ceph: do not configure external metric endpoint is not present
2021-05-24 13:56:54 -06:00
Sébastien Han 846447e61f Merge pull request #7935 from leseb/update-peer-token-if-mon-change
ceph: rehydrate the bootstrap peer token secret on monitor changes
2021-05-24 16:40:48 +02:00
Sébastien Han db91fd8bc3 ceph: do not configure external metric endpoint is not present
If no endpoint are configured let's simply return.

Closes: https://github.com/rook/rook/issues/7963
Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-24 14:41:26 +02:00
Travis Nielsen 2a9c81ec55 Merge pull request #7951 from BlaineEXE/scan-disks-in-init-container-for-raw-osds-on-node
ceph: scan raw OSDs on nodes in OSD init container
2021-05-20 13:01:32 -06:00
Blaine Gardner 8f7f24b1fc ceph: scan raw OSDs on nodes in OSD init container
The 'ceph-volume raw list' command used to list OSDs on nodes by the
rook-ceph-osd-prepare- jobs return user-friendly device names (e.g.,
/dev/sda) rather than persistent device names. Friendly device names
often change when systems reboot, and even persistent device names can
change under certain circumstances (e.g., a disk controller is replaced
with a different one). To prevent OSD Pods created for raw OSDs on
nodes from crashing repeatedly if the device it was created with is
renamed, scan the list of OSDs on the host with 'ceph-volume raw list'
to find the right OSD to activate in the OSD pod's OSD activation init
container.

Fixes #7918

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2021-05-20 12:35:53 -06:00
Sébastien Han dc0985c7f6 ceph: rehydrate the bootstrap peer token secret on monitor changes
If the monitors addresses change, we must update the peer secret with
the new addresses. For this, each time the configmap
"rook-ceph-mon-endpoints" is updated, we trigger a reconcile on the
CephBlockPool CRs, which will update the token secret.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-20 08:50:22 +02:00
Travis Nielsen 162fd1b442 Merge pull request #7912 from travisn/consolidate-rookv1
build: Refactor to consolidate the rook.io/v1 package
2021-05-19 13:33:32 -06:00
Travis Nielsen b0a63711f5 build: refactor to consolidate the rook.io/v1 package
The rook.io/v1 package was only an internal implementation detail and
does not have any CRDs that rely on it. The CRD deserialization should
handle the change in internal types without any issue. This separation
gives more flexibility for the storage providers to implement exactly
what is needed for their storage provider instead of forcing to use the
same types and risk affecting another storage provider.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-05-18 19:55:37 -06:00
Sébastien Han 2793750146 ceph: silence harmless errors when the operator is not initialized
If the ceph cli outputs an error with "error calling conf_read_file"
this means that the operator has not written its ceph configuration
file. Thus ceph cli commands will fail, so we can just ignore that since
the operator will soon write this file in its initialization sequence.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-18 19:35:07 +02:00
Nitin Goyal 25d2df4018 ceph: generate cephCluster reconcile result as events
Generate cephCluster reconcile result as an k8s event if it is not
already present on the cluster

Signed-off-by: Nitin Goyal <nigoyal@redhat.com>
2021-05-18 18:27:52 +05:30
Nitin Goyal e3fffdc711 core: add eventutils in the k8sutil package
eventutils will allow operator to limit events count of same event
and prevents from spaming apiserver

Signed-off-by: Nitin Goyal <nigoyal@redhat.com>
2021-05-18 17:01:37 +05:30
rohan47 f3d2ae5405 ceph: support specifying only public network or only cluster network
With this change, the Rook ceph cluster can have only a public network or
only a cluster network or both can be specified. Prior to this commit if
only a public network was specified, it was copied to the cluster network.

Signed-off-by: rohan47 <rohgupta@redhat.com>
2021-05-17 17:54:08 +05:30
Travis Nielsen 6ba6b1c3b1 Merge pull request #7886 from cybozu-go/ceph-fix-hostpath-of-osd-to-avoid-data-corruption
ceph: fix hostpath of osd to avoid data corruption
2021-05-13 08:49:24 -06:00
Travis Nielsen bb4191a8a7 ceph: persist expected mon endpoints immediately during mon failover
After mon failover is initiated, there was a time window where if the operator
was restarted, the new mon is started and has joined quorum, but the operator
does not believe the mon should be in quorum after the operator restart.
The operator was mistakenly removing the extra mon prematurely, sometimes
causing quorum to be lost if another mon was also down at the same time.
If the mon does not come back online, steps to recover quroum would need
to be followed from the disaster guide. Now the expected list of mons
will be updated immediately during mon failover if the operator successfully
created the new mon deployment, thus removing the window where restarting
the operator can cause quorum loss.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-05-12 09:44:04 -06:00
Sébastien Han 266a359a0e ceph: do not overwrite the probe handler
Changing the livenessprobe handler is not possible anymore for the
simple reason that it does not make sense. Practicly speaking we just
cannot change its value since it is propapaged to all the daemons. The
exec handler contains the socket name of the daemon, because daemons
have different names we cannot possibly make it generic since it will
apply to all.

Closes: https://github.com/rook/rook/issues/7842
Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-12 14:06:24 +02:00
Sébastien Han e06c36dbc9 Merge pull request #7875 from leseb/external-active-mgr-change
ceph: actively update the service endpoint for external mgr
2021-05-12 09:15:34 +02:00
Satoru Takeuchi 6af014b798 ceph: fix hostpath of osd to avoid data corruption
A directory is created under dataDirHostPath for each OSD. In host-based cluster,
its name is constructed from kernel device name like _dev_sdb though user specifies
udev persistent device name. We should use unique name among all OSDs.

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

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2021-05-12 01:31:46 +00:00
Sébastien Han 4f63e88ad5 Merge pull request #7877 from Rakshith-R/cleanup/csi-sts-dep
ceph: remove redundant csi statefulset template path vars
2021-05-11 18:00:57 +02:00
Sébastien Han 5e1e9f4c92 ceph: actively update the service endpoint for external mgr
If the cluster is external we want to periodically rehydrate the mgr
endpoint. This handles the scenarion where the active manager changes,
 so we need to update the endpoint with the new IP address.
The create-external-cluster-resources.py script now requires an extra
permission to query the manager service so Rook can discover the active
one and its IP.

Testing:

```
[leseb@tarox~/go/src/github.com/rook/rook][external-active-mgr-change] minikube kubectl -- exec -n rook-ceph deploy/rook-ceph-tools -ti -- ceph mgr stat
{
    "epoch": 37,
    "available": true,
    "active_name": "b",
    "num_standby": 1
}

[leseb@tarox~/go/src/github.com/rook/rook][external-active-mgr-change] kubectl -n rook-ceph-external get ep
NAME                     ENDPOINTS          AGE
rook-ceph-mgr-external   172.17.0.12:9283   3m10s

[leseb@tarox~/go/src/github.com/rook/rook][external-active-mgr-change] k scale --replicas=0 deployment rook-ceph-mgr-b
deployment.apps/rook-ceph-mgr-b scaled

[leseb@tarox~/go/src/github.com/rook/rook][external-active-mgr-change] minikube kubectl -- exec -n rook-ceph deploy/rook-ceph-tools -ti -- ceph mgr stat
{
    "epoch": 40,
    "available": true,
    "active_name": "a",
    "num_standby": 0
}

[leseb@tarox~/go/src/github.com/rook/rook][external-active-mgr-change] kubectl -n rook-ceph-external get ep
NAME                     ENDPOINTS          AGE
rook-ceph-mgr-external   172.17.0.13:9283   3m55s
```

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-11 16:08:40 +02:00
Travis Nielsen 169b225be5 Merge pull request #7867 from subhamkrai/crash-collector
ceph: create crash collector pods after secret created
2021-05-11 07:18:42 -06:00
Sébastien Han 87154dfe9c Merge pull request #7726 from sp98/pdb-controller-changes
ceph: update podDisruptionBudget controller for OSD
2021-05-11 15:02:22 +02:00
subhamkrai b4efd9f8f4 ceph: create crash collector pods after secret created
there was confusion regarding crash collector pods
in pending state which was basically due to secret
`rook-ceph-crash-collector-keyring` was not created
till mons are in quorum. this commit creates crash
collector pods after secret `rook-ceph-crash-collector-keyring`
is created.

Signed-off-by: subhamkrai <srai@redhat.com>
2021-05-11 17:52:38 +05:30
Rakshith R e9f0136b13 ceph: remove redundant csi statefulset template path vars
This commit removes redundant `RBDProvisionerSTSTemplatePath` and
`CephFSProvisionerSTSTemplatePath` variables which were forgetten to
be removed in https://github.com/rook/rook/pull/5982 when csi support
for k8s 1.13 was removed.

Signed-off-by: Rakshith R <rar@redhat.com>
2021-05-11 14:36:15 +05:30
Sébastien Han 19de2b28e9 ceph: allow heap dump generation when logCollector is not running
We don't need to set log_file to empty string since "log_to_file" is set
to False. This is probably an old leftover/hack we were doing in the
past when "log_to_file" and other related options were not there.

Because of this line
https://github.com/ceph/ceph/blob/master/src/perfglue/heap_profiler.cc#L99,
Ceph looks for the log_file conf option. In our case it was empty, so
the logging would default to the current directory which points to the
container runtime root when not set and we don't have permission to
write there.

We now force it to Ceph's default so that existing cluster will get the
fix after upgrading.

Just removing the option allows us to get dump in /var/log/ceph.
Phew, what a bug!

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-10 17:21:04 +02:00
Santosh Pillai aee8f56853 ceph: update podDisruptionBudget controller for OSD
This PR has following changes around OSD pdbs
- Detect node drains more reliably. When OSD is down and OSD pod is not scheduled to any node or if the scheduled node is not ready, then assume that node is draining.
- Don't set no-out flag on the failure domain if the OSD is down due to reasons other than node drain (say disk failure)
- update unit tests
- update design doc to reflect above changes

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2021-05-10 12:59:40 +05:30
Travis Nielsen 33d784d937 Merge pull request #7526 from parth-gr/operator-debug-logs
core: enhancement in debug logs
2021-05-06 10:41:28 -06:00
Shachar Sharon 2a3cfc693b ceph: allow setting primary-affinity to osd
A user with unbalanced system (e.g., some OSDs use a partition which
resides on a device along-side OS partition) may want to have a
fine-grained control on the overall load of specific OSD. While osd
weight affects write-load, primary-affinity affects read-load.

This patch allow user to define osd's primary-affinity (similar to
'DeviceClass' and 'InitialWeight'), which is sent to the osd (via mon)
as part of deployment sequence, using 'ceph osd primary-affinity' command.

Valid values are within the range [0.0, 1.0). If not set, default value
is 1.

ROOK issue: https://github.com/rook/rook/issues/7773

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
2021-05-06 17:46:15 +03:00
Travis Nielsen af1d728ba6 Merge pull request #7801 from sp98/mon-failover-on-drain
ceph: retry once before mon failover if mon pod is unscheduled
2021-05-05 12:39:05 -06:00
Santosh Pillai f38829b57d ceph: retry once before mon failover if mon pod is unscheduled
Events like node drain can take more than 10-15 minutes. If the node is not update the default monTimeOut of 10 minutes, then rook will attempt to fail over the mon. This failover won't work as the node is still down.
This PR retries once before the mon failover if the mon pod is not scheduled

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2021-05-05 23:32:27 +05:30
Rakshith R 7987e1b8a2 ceph: update snapshot APIs from v1beta1 to v1
This commit updates external-snapshotter version to
v4.0.0 which supports snapshots v1.
Rook now defaults to enabling RBD and CephFS snapshotter
for K8s >= v1.17 and disabling it for K8s <= v1.16.
Supporting changes in documents and examples yaml files
are made.

Signed-off-by: Rakshith R <rar@redhat.com>
2021-05-05 21:04:10 +05:30
Travis Nielsen ce50eb2407 ceph: remove unused volumesource schema from cephcluster
The VolumeSource type was only used internally when loading
the storageClassDeviceSets. The volumeSource element is never
expected to be specified in the CephCluster CR, so it is now
removed from the schema. The VolumeSource type is renamed to
deviceSet for clarity.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-05-03 11:54:46 -06:00
Sébastien Han 15a12577f5 ceph: fix external mode setup
Because of the recent CRD changes made, the mon count had a minimum of
1, making the configuration of the external cluster impossible. The
operator would fail to add the finalizer:

```
2021-04-29 16:57:38.429451 E | ceph-cluster-controller: failed to reconcile. failed to add finalizer: failed to add finalizer "cephcluster.ceph.rook.io" on "test-external": CephCluster.ceph.rook.io "test-external" is invalid: spec.mon.count: Invalid value: 0: spec.mon.count in body should be greater than or equal to 1
```

We now fixed the CRD as well as adding the CR status.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-03 12:07:40 +02:00
Travis Nielsen 2b9bd2af1a Merge pull request #7445 from jshen28/fix-upgrade-mds
ceph: complete missing steps of upgrading mds
2021-04-29 07:21:35 -06:00
shenjiatong 21bb12a20d ceph: upgrade mds fix typos
fix some nits on error wraps and logging

Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
2021-04-29 16:45:08 +08:00
Ali Maredia c9fee1f883 ceph: ensure object store endpoint is initialized for user
when store.Status was not initialized it caused
crashes when assigning store.Status.Info["endpoint"]
to objContext.Endpoint.

This commits makes sure store.Status is not Nil
before setting objContext.Endpoint and
objContext.SecureEndpoint in the ObjectStoreUser
controller.

Closes: https://github.com/rook/rook/issues/6916
Signed-off-by: Ali Maredia <amaredia@redhat.com>
2021-04-28 21:47:34 -04:00
shenjiatong 41f775ec17 ceph: make sure standbys are stopped
wait and make sure standbys are stopped before
continuing to upgrade the primary mds daemon.

Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
2021-04-29 08:12:29 +08:00
shenjiatong 81f888260b ceph: reset max_mds and allow_standby_replay in deferred function
set fsPreparedForUpgrade to true for upgrading mds, to
make sure that max_mds is set back to active count
after all mds agent gets upgraded

Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
2021-04-29 08:06:39 +08:00
shenjiatong 58f6b495af ceph: complete missing steps of upgrading mds
Upgrading mds requires extra steps than simply
replacing ceph image. see https://docs.ceph.com/en/latest/cephfs/upgrading/
for reference.

Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
2021-04-29 08:06:38 +08:00
Blaine Gardner 6ee626b3aa Merge pull request #7764 from thotz/obcsslfix
ceph: support for OBC operations if it uses TLS RGW endpoint
2021-04-28 14:27:08 -06:00
Travis Nielsen 6af362abd4 Merge pull request #7768 from travisn/skip-upgrade-checks-log
ceph: Clarify log message to continue with upgrade if needed
2021-04-28 13:19:23 -06:00
parth-gr bb23622b72 core: enhancement in debug logs
When DEBUG logging is enabled in the operator, there are a number of overwhelming messages in the log that are very overwhelming and don't seem useful, which makes debug mode difficult to use
Updated and Cutted down the messages that are not useful in debug mode

Closes: https://github.com/rook/rook/issues/7499
Signed-off-by: parth-gr <paarora@redhat.com>
2021-04-28 22:28:10 +05:30
Jiffin Tony Thottan a5a5661e5f ceph: add security spec to object store spec
Add `SecuritySpec` to specify kms details for rgw in `ObjectStoreSpec` than using existing
`SecuritySpec` used for `ClusterSpec`. The vault secret engines conflict with OSD and RGW
kms encrytpion

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
2021-04-28 14:39:39 +05:30
Jiffin Tony Thottan 3ef3e8b72e ceph: check for kv engine version for SSE RGW
The "https://docs.ceph.com/en/latest/radosgw/vault/" says RGW supports only version v2 of
kv engine, so pod won't start if the admin didn't provide "VAULT_BACKEND" in security.kms.ConnectionDetails

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
2021-04-28 13:03:22 +05:30
Jiffin Tony Thottan 8e5c6c126c ceph: modify ValidateConnectionDetails() in kms
The ValidateConnectionDetails() contains `clusterSpec` assuming `SecuritySpec` only
part to `cephCluster` CRD. But we may need to validate same for `SecuritySpec` in
`cephObjectStore` CRD. Hence modifying the signature of the api.

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
2021-04-28 13:03:16 +05:30
Jiffin Tony Thottan f9c7634d88 ceph: support for OBC operations on enabled TLS RGW endpoint
OBC operations will fail if RGW only enabled HTTPS. With this change, OBC operations
will use needed TLS certs to succeed the operation.

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
2021-04-28 12:37:38 +05:30
Jiffin Tony Thottan 7a5928d2c5 ceph: add api to fetch cacert for RGW server
Rook operator sends S3 to RGW server for bucket operations performed by healthchecker,
bucketprovisioner etc. Add api to fetch cacert if the TLS enabled for RGW.

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
2021-04-28 12:25:36 +05:30
Blaine Gardner b60c495561 Merge pull request #7704 from alrs/nfs-multiple-imports
nfs: fix multiple imports
2021-04-27 15:47:34 -06:00
Travis Nielsen 6f61d95dc3 ceph: clarify log message to continue with upgrade if needed
The ceph upgrade blocks if the ceph heatlh is HEALTH_ERR. If the user
wants to force the upgrade despite the health error, they will need
to set skipUpgradeChecks: true in the cephcluster CR. This message
will hopefully make that setting more discoverable.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-04-27 11:31:28 -06:00