Commit Graph
2172 Commits
Author SHA1 Message Date
Travis Nielsen 5c332f6954 Merge pull request #8020 from Rakshith-R/csi/retry-on-k8s-err
ceph: retry starting CSI drivers on failure
2021-06-02 09:28:31 -06:00
Sébastien Han 4beb928c04 Merge pull request #8031 from leseb/stop-monitoring-on-deletion
ceph: stop the monitoring before cleanup
2021-06-02 17:22:44 +02:00
Sébastien Han e478bdadb1 ceph: stop the monitoring before cleanup
Saw this today in the logs:

```
2021-06-02 13:02:54.787838 I | ceph-block-pool-controller: deleting pool "testpool"
2021-06-02 13:02:56.178094 I | cephclient: no images/snapshosts present in pool "testpool"
2021-06-02 13:02:56.178125 I | cephclient: purging pool "testpool" (id=17)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1cef49f]

goroutine 1607 [running]:
github.com/rook/rook/pkg/operator/ceph/pool.(*mirrorChecker).checkMirroringHealth(0xc001a98ba0, 0x8, 0xc000d34c60)
	/home/runner/work/rook/rook/pkg/operator/ceph/pool/health.go:115 +0xdf
github.com/rook/rook/pkg/operator/ceph/pool.(*mirrorChecker).checkMirroring(0xc001a98ba0, 0xc0016fd500)
	/home/runner/work/rook/rook/pkg/operator/ceph/pool/health.go:82 +0x147
created by github.com/rook/rook/pkg/operator/ceph/pool.(*ReconcileCephBlockPool).reconcile
	/home/runner/work/rook/rook/pkg/operator/ceph/pool/controller.go:298 +0xee5
```

Essentially, it's intermittent but when deleting the pool the
healthcheck kicked in and fetched the mirroring status, which returned
empty. THe subsequent code tried to access content of a nil pointer,
  hence the error.
So now we stop monitoring first, then we proceed with the deletion.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-06-02 16:14:10 +02:00
Rakshith R 411e36900e ceph: retry starting CSI drivers on failure
CSI drivers failed to start if rook encountered error
while reading configmap with no retry.
This commit introduces retry for starting CSI driver
if there is a failure in reading configmap upto 3 times.

Fixes: #7950

Signed-off-by: Rakshith R <rar@redhat.com>
2021-06-02 19:36:55 +05:30
Travis Nielsen 4cf43bef95 Merge pull request #8006 from Rakshith-R/feature/options-toleration-affinity
ceph: add support for adding rbd and cephfs tolerations and affinities separately
2021-06-02 07:55:23 -06:00
Sébastien Han ba8940800f Merge pull request #8005 from leseb/luks-label
ceph: add ceph cluster fsid to LUKS header
2021-06-02 14:52:56 +02:00
Rakshith R 87cf668b28 ceph: add option for adding csi pods' tolerations & affinity separately
This commit adds support for adding tolerations and affinities for
cephfs and rbd (provisioner & nodeplugin) pods separately.

Closes: #7060

Signed-off-by: Rakshith R <rar@redhat.com>
2021-06-02 11:30:38 +05:30
Travis Nielsen 642a30de8e Merge pull request #8022 from leseb/to-upper-op-config
ceph: force upper case for Operator log level
2021-06-01 08:22:48 -06:00
Sébastien Han 7e7be7ea56 ceph: force upper case for Operator log level
When the operator configmap is edited, it is likely that some user will
simply put "debug" instead of "DEBUG", so let's always transform the
value to upper case to ease user experience.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-06-01 10:51:44 +02:00
Sébastien Han 23777c859b ceph: remove potential new lines from the vault token variable
In some circonstances the VAULT_TOKEN env variable contains a new line.
We don't really know how and why. The saw this when upgrading from
Nautilus CentOS 7 to Octopus CentOS 8. So there might be something
different with bash and variable expansion.
Anyway, let's remove any potential new line and trailing spaces from
that var.

The error was splitting the curl line to something like:

```
+ curl --silent --show-error --request GET --header 'X-Vault-Token: s.aCHdo57tF19ddN1hQmGVyG8a
' --insecure https://vault.default.svc.cluster.local:8200/v1/rook/ver1/rook-ceph-osd-encryption-key-set1-data-0pztgf
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
```

Where a correct line will be:

```
+ curl --silent --show-error --request GET --header 'X-Vault-Token: s.aCHdo57tF19ddN1hQmGVyG8a' --insecure https://vault.default.svc.cluster.local:8200/v1/rook/ver1/rook-ceph-osd-encryption-key-set1-data-0pztgf
```

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-31 16:33:43 +02:00
Sébastien Han 26c0f8bcc1 ceph: only pass vault volume projection is necessary
We don't need to pass the Volume with projection for TLS when TLS is not enabled
Somehow when this happens and we try to update a deployment spec it fails with:

```
 ValidationError(Pod.spec.volumes[7].projected): missing required field "sources"
```

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-31 16:33:40 +02:00
Sébastien Han 0004869f66 ceph: add ceph cluster fsid to LUKS header
When configuring encrypted on-pvc clusters we now set the cluster fsid
in the LUKS header. If needed we can then determine if the encrypted
block is part of our cluster or not. We also attach the pvc_name in case
it might become useful.

Closes: https://github.com/rook/rook/issues/7991
Signed-off-by: Sébastien Han <seb@redhat.com>
2021-05-31 15:01:52 +02:00
Sébastien Han 4bdc02e16e Merge pull request #8011 from travisn/remove-one-mon-at-time
ceph: remove one extra mon per health check
2021-05-31 09:45:43 +02:00
Satoru Takeuchi cb7f25d200 Merge pull request #8000 from cybozu-go/ceph-parse-json-correctly
ceph: parse json correctly
2021-05-28 22:31:27 +09:00
Travis Nielsen 9e982a0eff ceph: remove one extra mon per health check
If the number of desired mons is reduced, for example from 5 down to 3,
the extra mons will be removed by the next health check. Only a single
mon can be removed per health check to ensure that other mons do not
become unhealthy at the same time as removing an extra mon, and so the
list of healthy mons can be refreshed. If multiple mons are removed in
a single health check, we risk removing too many mons and losing quorum.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-05-27 14:34:09 -06:00
Travis Nielsen b281859602 Merge pull request #8001 from iamniting/expand
ceph: expand PVC only if storageclass allow expansion
2021-05-27 14:08:28 -06:00
Nitin Goyal 7df51fab59 core: expand PVC only if storageclass allow expansion
Expand the functionality of 'ExpandPVCIfRequired' to check if
storageclass does allow expansion then only expand the PVC.
otherwise skip the expansion.

Signed-off-by: Nitin Goyal <nigoyal@redhat.com>
2021-05-27 22:50:16 +05:30
Jiffin Tony Thottan d909c309f3 ceph: update the backend path for transit engine
The backend has for trasnit secret in vault kms for RGW is changed from pacific

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
2021-05-27 22:48:21 +05:30
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