Commit Graph
3904 Commits
Author SHA1 Message Date
Blaine Gardner 2a3f06bacf Merge pull request #6926 from BlaineEXE/create-new-osds-before-updating-existing
ceph: create new OSDs on PVC before updating existing ones
2021-02-16 11:17:01 -07:00
Travis Nielsen 8ce98c4b72 ceph: add tolerations for all daemons to the cleanup job
The cleanup job will need to run wherever the ceph daemons
were running. The scheduling is done by rook on the specific
nodes where the daemons were running, so there is no need for
other placement such as node or pod affinity.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-02-16 10:25:39 -07:00
Varsha Rao 7a4ebbef0e ceph: rados pool namespace is optional for nfs deployments
There is no need to validate rados pool namespace, it is optional[1]. And if in
case rados namespace is not specified, it is appropriately handled.

[1] https://github.com/nfs-ganesha/nfs-ganesha/blob/next/src/doc/man/ganesha-core-config.rst

Signed-off-by: Varsha Rao <varao@redhat.com>
2021-02-16 16:25:50 +05:30
subhamkrai 6158b6608c ceph: do not merge nodeAffinity
we don't want to merge the node affinity if specified in both
storageClassDeviceSet and placement. Now, we are passing new
boolean argument in `ApplyToPodSpec` which will be false in
case of osd and prepare pods because we don't want to overlap
placement of osd on PVC's and non-PVC's.

Signed-off-by: subhamkrai <srai@redhat.com>
2021-02-16 12:25:28 +05:30
Travis Nielsen c971b01b9e Merge pull request #7230 from leseb/return-error
ceph: embed error in return
2021-02-15 11:36:10 -07:00
Sébastien Han 4e0820f490 ceph: embed error in return
We were missing the error.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-15 17:09:37 +01:00
Blaine Gardner a95734160e ceph: create new osds on pvc before update existing
Add a new OSD provisioner status (reported by provisioner configmap)
that denotes that an OSD is preexisting and that OSD prepare does not
need to be run for the OSD. This only applies to OSDs on PVC currently
where existence of a deployment for the OSD indicates no further
provisioning needs to occur. New status is "preexisting".

Allow creating new OSDs on PVCs before updating existing ones by
allowing deferring OSDs during processing of OSD provisioning status
ConfigMaps. Deferral is identified by new "preexisting" status.

Add a unit test to ensure OSD on PVC provisioning occurs as expected
including deferring already-created OSDs to be updated after new PVCs
are created.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2021-02-12 17:38:35 -07:00
Travis Nielsen 7c331f33a9 Merge pull request #7191 from thotz/cephobjectuser-endpoint-validation
ceph: fill up endpoint for cephobjectstore user
2021-02-12 10:42:31 -07:00
subhamkrai 4ef4be019b ceph: override default values in liveness probes
this commit set default values or allow overriding of liveness probe
fields if that individual field is 0 or nil.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
Signed-off-by: subhamkrai <srai@redhat.com>
2021-02-12 20:35:56 +05:30
Jiffin Tony Thottan b836aab13e ceph: fill up endpoint for cephobjectstore user
Currently endpoint is filled from `Status.Info["endpoint"]` string map for cephobjectstore user's secret and
have two issues:
1.) endpoint is nil and only secureendpoint is available
2.) Chance of small race window in which endpoint is not filled before this ceph object user is handling.

Signed-off-by: Jiffin Tony Thottan <thottanjiffin@gmail.com>
2021-02-12 10:46:30 +05:30
ron1 52cf0a3148 ceph: order CephCluster false condition before true Ready condition
The Rancher Continuous Delivery Fleet tool expects a true Ready
condition to be listed after a false condition such as
ProgressingCompleted. This commit orders the false condition
before its corresponding true Ready condition.

Closes: https://github.com/rook/rook/issues/6977
Signed-off-by: ron1 <ron18219@gmail.com>
2021-02-11 12:54:18 -07:00
Travis Nielsen ff1f74f771 ceph: correct formatting of ceph version detected
The ceph version during an upgrade was incorrectly being
formatted in the log message

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-02-10 16:36:09 -07:00
Sébastien Han 1f4649f327 ceph: fix wrong payload path
Wrong file was used...

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-10 17:01:39 +01:00
Sébastien Han 1adebcd4d1 ceph: expose vault curl errors
If the Vault server returns an error, we must report it in the init
container. With this we can properly debug a failing init container.

Resulting container log:

```
oc logs rook-ceph-osd-0-dc6d4d4d-445dg -c encryption-kms-get-kek                                                                                                                                                                                                         ⏎
['error performing token check: Vault is sealed']%
```

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-10 12:45:16 +01:00
Sébastien Han 88cf490f00 ceph: silence the curl call
We don't need to output the progress.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-10 11:37:17 +01:00
Satoru Takeuchi 3b9b1dc3c7 Merge pull request #7185 from cybozu-go/ceph-replace-setting-controller-reference-with-utility-function
ceph: replace setting controller reference with utility function
2021-02-10 09:52:08 +09:00
Travis Nielsen 543edbc762 Merge pull request #7180 from leseb/scale-rbd-mirror
ceph: use deployment replicas instead of more deployments for rbd-mirror
2021-02-09 08:20:41 -07:00
Travis Nielsen 0dec1babd2 Merge pull request #7170 from leseb/bz-1922954
ceph: return an error if PVC is not clean
2021-02-09 08:01:11 -07:00
Sébastien Han db4306b485 Merge pull request #7172 from leseb/bz-1925055
ceph: always override existing block for blkdevmapper
2021-02-09 15:49:04 +01:00
Sébastien Han 6dc15eb649 ceph: always override existing block for blkdevmapper
When the blkdevmapper init container initializes we must override any
existing special block. This will prevent re-using a different disk on
the OSD on PVC scenario.

Adding "--remove-destination" to the cp line will remove each existing
destination file before attempting to open it.
We **MUST** do this otherwise in environment where PVCs are dynamic, restarting the deployment will cause conflicts
When restarting the OSD, the PVC block might end up with a different Kernel disk allocation
For instance, prior to restart the block was mapped to 8:32 and when re-attached it was on 8:16
The previous "block" is still 8:32 so if we don't override it we will try to initialize on a disk that is not an OSD or worse another OSD
This is mainly because in https://github.com/rook/rook/commit/ae8dcf7cc3b51cf8ca7da22f48b7a58887536c4f we switched to use HostPath to store the OSD data
Since HostPath is not ephemeral, the block file must be re-hydrated each time the deployment starts

The test uses "==" instead of numbers since the stat command will print
an hex number and thus we won't always get integer, e,g: major/minor
value 202:13312 will be return ca:3400.

Example run of the new init container:

+ PVC_SOURCE=/set1-data-168h7m
+ PVC_DEST=/var/lib/ceph/osd/ceph-0/block
+ CP_ARGS=(--archive --dereference --verbose)
+ '[' -b /var/lib/ceph/osd/ceph-0/block ']'
++ stat -c %t%T /set1-data-168h7m
+ PVC_SOURCE_MAJ_MIN=ca6100
++ stat -c %t%T /var/lib/ceph/osd/ceph-0/block
PVC's source major/minor numbers changed
removed '/var/lib/ceph/osd/ceph-0/block'
'/set1-data-168h7m' -> '/var/lib/ceph/osd/ceph-0/block'
+ PVC_DEST_MAJ_MIN=ca4000
+ [[ ca6100 == \c\a\4\0\0\0 ]]
+ echo 'PVC'\''s source major/minor numbers changed'
+ CP_ARGS+=(--remove-destination)
+ cp --archive --dereference --verbose --remove-destination /set1-data-168h7m /var/lib/ceph/osd/ceph-0/block

Test procedure:

$ oc -n rook-ceph scale deployment rook-ceph-osd-0 --replicas=2
deployment.apps/rook-ceph-osd-0 scaled

Now we have 2 OSDs and one is crashlooping, which is expected:

rook-ceph-osd-0-66964f6d-2cwqq                              0/1     Init:CrashLoopBackOff   4          2m12s
rook-ceph-osd-0-66964f6d-pmhlq                              1/1     Running                 0          6m7s

The logs from the failing container is pretty clear:

+ PVC_SOURCE=/set1-data-168h7m
+ PVC_DEST=/var/lib/ceph/osd/ceph-0/block
+ CP_ARGS=(--archive --dereference --verbose)
+ '[' -b /var/lib/ceph/osd/ceph-0/block ']'
++ stat -c %t%T /set1-data-168h7m
+ PVC_SOURCE_MAJ_MIN=ca6100
++ stat -c %t%T /var/lib/ceph/osd/ceph-0/block
+ PVC_DEST_MAJ_MIN=ca6100
+ [[ ca6100 == \c\a\6\1\0\0 ]]
+ CP_ARGS+=(--no-clobber)
+ cp --archive --dereference --verbose --no-clobber /set1-data-168h7m /var/lib/ceph/osd/ceph-0/block
inferring bluefs devices from bluestore path
/home/jenkins-build/build/workspace/ceph-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos8/DIST/centos8/MACHINE_SIZE/gigantic/release/15.2.8/rpm/el8/BUILD/ceph-15.2.8/src/os/bluestore/BlueStore.cc: In function 'int BlueStore::expand_devices(std::ostream&)' thread 7f2a52d18240 time 2021-02-09T13:27:46.011397+0000
/home/jenkins-build/build/workspace/ceph-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos8/DIST/centos8/MACHINE_SIZE/gigantic/release/15.2.8/rpm/el8/BUILD/ceph-15.2.8/src/os/bluestore/BlueStore.cc: 7090: FAILED ceph_assert(r == 0)
2021-02-09T13:27:46.010+0000 7f2a52d18240 -1 bluestore(/var/lib/ceph/osd/ceph-0) _lock_fsid failed to lock /var/lib/ceph/osd/ceph-0/fsid (is another ceph-osd still running?)(11) Resource temporarily unavailable
 ceph version 15.2.8 (bdf3eebcd22d7d0b3dd4d5501bee5bac354d5b55) octopus (stable)
 1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x158) [0x7f2a48e236e4]

 Acquiring the lock fails, so the OSD won't run.
 Now we scale back down:

$ oc -n rook-ceph scale deployment rook-ceph-osd-0 --replicas=1
deployment.apps/rook-ceph-osd-0 scaled

And we can see the last created OSD (the one crash looping) disappears:

rook-ceph-osd-0-66964f6d-2cwqq                              0/1     Terminating   5          3m6s
rook-ceph-osd-0-66964f6d-pmhlq                              1/1     Running       0          7m1s

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-09 14:28:39 +01:00
Satoru Takeuchi bdfabba75c ceph: replace setting controller reference with utility function
Some settinc controller reference code can be replaced
with `controllerutil.SetControllerReference`. It's better to use it
since it provides ownerReference verification.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2021-02-09 12:03:38 +00:00
Sébastien Han 7c928f4196 ceph: return an error if PVC is not clean
With 5f57b6fd3a, we introduced a
regression in the validation code.
If the OSD PV comes from another cluster, GetCephVolumeRawOSDs must
return an error.
The prepare job will crash loop but at least with a useful and
comprehensive message.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-09 11:28:08 +01:00
Sébastien Han 04f5bd0e53 ceph: use deployment replicas instead of more deployments
For the rbd-mirror daemon, We now rely on the "replica" setting in the Deployment spec when the
desired instance count is higher than 1 instead of creating another
deployment.
So now, we don't need to the number of deployments anymore and let
kubernetes handles the number of pods.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-09 10:32:42 +01:00
Sébastien Han 5966f09376 Merge pull request #7160 from leseb/rm-crash-pod-when-ceph-pods-are-gone
ceph: remove crash collector if ceph pod moved
2021-02-09 10:08:16 +01:00
Sébastien Han b9e91b600d ceph: remove crash collector if ceph pod moved
If Ceph pods were evicted onto other nodes, there is no reason for the
crash collector to remain on those nodes. So let's remove it.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-09 09:48:16 +01:00
Varsha Rao baa79cf4c3 ceph: filesystem is not required for nfs server deployment
nfs server requires valid pool for storing nfs-ganesha recovery objects. Only
when filesystem exports are created, filesystem should be configured first.

Signed-off-by: Varsha Rao <varao@redhat.com>
2021-02-08 20:13:14 +05:30
Travis Nielsen 043f947321 build: remove yugabytedb operator
The YugabyteDB team has decided to move support of their operator
to a new repo at https://github.com/yugabyte/yugabyte-operator.
The operator in Rook is no longer needed. Further usage of
the YugabyteDB operator is recommended at the new location.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-02-06 00:03:41 -07:00
Travis Nielsen 7dc36e0f46 ceph: use localhost for the mgr endpoint binding instead of podIP
The pod IP address is no longer needed for port binding for the dashboard
and prometheus endpoints anymore in the mgr modules. The default binding
to localhost will be sufficient. This will allow the endpoints to be more
reliable in some environments where today the podIP is not working.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-02-04 08:44:05 -07:00
Travis Nielsen b3129fd5cf ceph: bind mgr modules to all interfaces instead of pod ip
Binding the dashboard and prometheus to all interfaces instead of the pod ip
will ensure that they are listening properly. Binding to the pod ip was only
a short term solution that was intended to be removed with Nautilus, which
is already Rook's min supported version.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-02-04 07:08:59 -07:00
Sébastien Han 3a2e618ec4 Merge pull request #7112 from sp98/check-orchestration-cancellation
ceph: check for orchestration cancellation while waiting for all OSDs  to start.
2021-02-04 11:36:04 +01:00
Santosh Pillai f5808185e0 ceph: check for orchestration cancellation while OSDs are pending
completeOSDsForAllNodes() method waits for 20 minutes for all the OSDs to start on all the nodes. This PR checks if
cluster deletion request was sent while waiting for OSDs to start. If yes, then completeOSDsForAllNodes() method will returnwithout waiting for 20 minutes.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2021-02-04 14:49:37 +05:30
Santosh Pillai b780e5b5c0 ceph: skip pdb reconcile on create and delete events
This PR makes create and delete events on pdb a no-op. Update event only triggers reconcile if its the main OSD pdb and allowed disruptions is 0.
This prevents controller to reconcile on pdb events namespaces outside rook ceph.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2021-02-03 22:43:20 +05:30
Sébastien Han 8d033efb5a ceph: silence harmless errors
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-02-03 17:28:44 +01:00
Sébastien Han dea3273eaf ceph: do not force go path in unit tests
Do not force unit tests to be run while the rook repo is in the GOPATH.
Now that Rook uses go modules, this is no longer necessary. Allow this
by creating a helper function that unit tests can use that return the
on-host path to the `rook` project root.

Followup of https://github.com/rook/rook/pull/7119/commits/15a487cd5aa5d4dc59bc15ef610cb182257d9287

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-03 08:56:41 +01:00
Travis Nielsen 5371c943ca ceph: simplify the log-collector container name
The log-collector container name was exceeding the 63-char limit
if the parent CR name was too long. The container name just needs
to be unique to the pod spec, so we simplify it to remove the parent
name and avoid hitting the limit in the pod spec.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-02-02 12:42:53 -07:00
Travis Nielsen ad66fbe4a7 Merge pull request #6866 from jshen28/do-not-detect-csi-version-if-disabled
ceph: skip csi detection if CSI is disabled
2021-02-02 10:09:55 -07:00
Blaine Gardner 15a487cd5a ceph: do not force go path in unit tests
Do not force unit tests to be run while the rook repo is in the GOPATH.
Now that Rook uses go modules, this is no longer necessary. Allow this
by creating a helper function that unit tests can use that return the
on-host path to the `rook` project root.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2021-02-01 18:28:36 -07:00
shenjiatong 2b63fff087 ceph: skip csi detection if CSI is disabled
Before this patch, csi detection will run whether or
not rbd and cephfs are all disabled. Run detection only
if it is necessary.

Signed-off-by: shenjiatong <yshxxsjt715@gmail.com>
2021-02-02 08:28:35 +08:00
Sébastien Han 8b65eb6126 ceph: do not enable ShareProcessNamespace if HostPID
If HostPID is enabled, this means the Ceph version is older than Octopus
and we are still running OSD with HostPID due to an internal
inter-process check.
If the log collector is enabled we need to enable ShareProcessNamespace
**only** if HostIPC is disabled.

Both HostPID and ShareProcessNamespace cannot be enabled.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-01 18:23:19 +01:00
Sébastien Han efefb557a8 Merge pull request #7111 from leseb/fix-1922108
ceph: do not enable ShareProcessNamespace if HostIPC
2021-02-01 17:18:58 +01:00
Travis Nielsen 661b8c7336 Merge pull request #7075 from sp98/timeout-radosgw-admin-cmd
ceph: timeout `radosgw-admin` cli commands
2021-02-01 09:10:18 -07:00
Travis Nielsen d150980241 ceph: skip logging error for mon pdbs if single mon
If there is a single mon, we don't expect the PDBs to be created
and neither do we need to log that it is an error condition.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-02-01 07:57:53 -07:00
Sébastien Han 260274cdb3 ceph: do not enable ShareProcessNamespace if HostIPC
If HostIPC is enabled, this means the Ceph version is older than Octopus
and we are still running OSD with HostIPC due to an internal
inter-process check.
If the log collector is enabled we need to enable ShareProcessNamespace
**only** if HostIPC is disabled.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-02-01 15:50:16 +01:00
Santosh Pillai 113376f1ab ceph: timeout radosgw-admin cli commands
When creating object store, `radosgw-admin realm get ..` command is stuck forever when required number of OSDs are not available. Because of this the uninstall of object store is also stuck. User has to manually remove the finalizer to delete the object store.This PR uses `ExecuteCommandWithTimeout` for running `radosgw-admin` command. Timeout during installation will be reconciled. Cleanup will be treated as best effort. Any errors during uninstalling of single site object store will only be logged.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2021-02-01 10:57:04 +05:30
Blaine Gardner 1761874da2 Merge pull request #6999 from rohan47/clean_terminating_pods
ceph: clean pods stuck in terminating state on a failed node
2021-01-29 13:15:36 -07:00
Travis Nielsen 0a1bfe575c Merge pull request #7062 from leseb/cephfs-mirror
ceph: add cephfs mirroring support
2021-01-29 09:09:56 -07:00
Santosh Pillai 5831c0f0d0 ceph: add --public-addr args to ceph mds command
add --public-addr=<podIP> args to ceph mds command when host network is not enabled.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2021-01-28 12:40:42 -07:00
Travis Nielsen 4f7250298c Merge pull request #7084 from travisn/maxmonid-commit
ceph: Only commit the maxmonid after starting a mon daemon
2021-01-28 11:30:10 -07:00
Sébastien Han c0123cf182 ceph: add cephfs mirroring support
With Ceph Pacific, Rook can now deploy the cephfs-mirror daemon.
This initial commit covers the deployment of a single daemon only.
Multiple mirror daemons is currently untested.
Only a single mirror daemon is recommended.

The configuration of peers will come in a later PR since the mgr module
is still pending upstream: https://github.com/ceph/ceph/pull/39050

The same goes for integration tests, they will get added later once we
start testing on Pacific.

Closes: https://github.com/rook/rook/issues/7002
Signed-off-by: Sébastien Han <seb@redhat.com>
2021-01-28 19:21:18 +01:00
rohan47 0876a20e7c ceph: clean pods stuck in terminating state
when a node fails some pods remains in terminating while other manage to
be rescheduled on another node successfully.
this commit adds code to clean up all the Rook and CSI pods that are stuck in terminating
state on a failed node.

Signed-off-by: rohan47 <rohgupta@redhat.com>
2021-01-28 23:21:53 +05:30