Commit Graph
674 Commits
Author SHA1 Message Date
Travis Nielsen e3256c07fe Merge pull request #10523 from leseb/fix-stuck-reconciler
core: fix stuck reconciler (more checkpoints for cancelled context)
2022-07-18 08:58:07 -06:00
Eng Zer Jun 8a25b1d903 test: use T.Setenv to set env vars in tests
This commit replaces `os.Setenv` with `t.Setenv` in tests. The
environment variable is automatically restored to its original value
when the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.Setenv
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-07-15 23:07:19 +08:00
Travis Nielsen fc541764f1 Merge pull request #10484 from jsoref/spelling
core: fix spelling
2022-07-15 08:31:41 -06:00
Liang Zheng 7609dad72f osd: metadata device supports udev path
This commit adds udev path for metadata device

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

Signed-off-by: Liang Zheng <zhengliang0901@gmail.com>
2022-07-14 10:26:33 +08:00
Sébastien Han 247d725aac core: let IsInitialized return errors
Let's return an error instead of a bool so we can better parse it and
decide what to do with it.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-07-12 12:07:57 +02:00
Satoru Takeuchi 7e571f6114 osd: support OSD on logical volume in host-based cluster
Rook supports raw mode OSD in host-based cluster. So we can also
support OSD on logical volume in this kind of cluster.

Logical volumes aren't picked by filters (i.e. `useAllDevices: true`
and `device{Path,}Filter` to avoid unwanted LV consumption on upgrade.

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

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2022-07-11 21:08:50 +00:00
Josh Soref 6e7b8767f3 core: fix spelling
* another
* are
* availability
* available
* bootstrap
* boundaries
* ceph
* certificate
* class
* codifies
* consuming
* corrupted
* createor
* csi
* deployments
* exceeded
* execute
* filesystem
* healthiness
* heuristics
* immediately
* insecure
* installed
* isolated
* maintained
* maximum
* minute
* monitor
* new
* nginx
* nonexistent
* not
* occurs
* omitempty
* operator
* orchestration
* persistentvolumes
* placement
* preexisting
* prometheus
* protecting
* provisioner
* purposes
* reconcile
* regex
* related
* requests
* returns
* rubbish
* running
* schedulable
* schedule
* serviceaccount
* simulating
* snapshots
* statement
* static
* tenants
* the
* unavailable
* volumeattachment
* waiting
* with
* wrapper
* zonegroup

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-07-07 18:10:47 -04:00
Travis Nielsen dad97f3425 core: remove support for ceph octopus
With octopus coming to end of life, we remove support from
Rook for deploying Ceph Octopus and assume a min version of
Pacific v16. Any checks for octopus or earlier are removed
from the reconciles since they are obsolete.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-07-07 15:03:26 -06:00
Blaine Gardner 800d3e5050 Merge pull request #9915 from BlaineEXE/dependents-cephfilesystem
file: block deletion on more dependents
2022-06-17 14:07:07 -06:00
Sébastien Han bfe4f7c111 osd: do not return if deactivate fail
Let it fail further once we run c-v activate. The error reported by LVM
could potentially ignored. If there is a failure, the c-v command will
fail anyways.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-06-15 15:42:48 +02:00
Blaine Gardner a63844f8bf file: block deletion on more dependents
Block deletion of CephFilesystems when there are any raw Ceph
subvolumegroups present that have subvolumes in them. Empty
subvolumegroups will not block deletion.

One important subvolume group is "csi" which is the default location
where CSI subvolumes are kept. If this group is empty, it means that
there are no PVCs created based on the CephFilesystem in question. This
also holds true if there are external consumers of the filesystem in
external cluster mode.

Similarly, if there are any subvolumegroups (for example "_nogroup",
which includes subvolumes in the filesystem root) that contain
manually-created subvolumes, Rook will also see this and block deletion.
This comes into play currently with manually-created NFS exports.

A work-in progress aims to create a Ceph-CSI NFS export provisioner
which will likely create subvolumes in the "csi" group as well. This
implementation will catch this case also.

Rook still checks for CephFilesystemSubVolumeGroups explicitly in
addition to the check added here. This is to ensure that even empty
groups will block deletion if they are created via this CR type.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2022-06-14 13:02:35 -06:00
Sébastien Han 219e017564 osd: do not hide the error
Return the error instead of hiding it, err could be non-nil for a lot of
reasons, eg: a canceled context or a non-existing object.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-06-03 11:00:10 +02:00
Travis Nielsen dd3ea3e760 pool: built-in pools require flag to force creation
Ceph added a check recently that prevents creation of the
built-in pools that start with a dot, such as .nfs, .mgr,
and .rgw.root. These pools require a --yes-i-really-mean-it
flag to be passed to force the creation now.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-05-25 17:26:15 -06:00
Satoru Takeuchi e66b35aa55 Merge pull request #10230 from leseb/fix-9470
core: append filesystem property on disk
2022-05-10 09:07:09 +09:00
Sébastien Han 8328ec6d31 core: add mountpoint detection to the prepare pod
Amount various filters let's add a mountpoint property and skip the
device if its filesystem is mounted.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-05-09 15:26:50 +02:00
Satoru Takeuchi 4c46dd1abd osd: fix disk uuid management
- disk UUID should only be got for "disk" type device.
- It's not necessary to fail prepare job when failing to get disk UUID
- We should consider that `sgdisk` reports UUID even if there is no GPT.

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

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2022-05-09 18:25:09 +09:00
Sébastien Han 6ef491d9fc osd: close the encrypted disk after cleanup is done
Once we are done cleaning up the content of the encrypted osd, let's
close the main LUKS device.
This avoids having dm devices on the system after the cleanup.

Closes: https://github.com/rook/rook/issues/10181
Signed-off-by: Sébastien Han <seb@redhat.com>
2022-05-03 16:47:59 +02:00
Sébastien Han 583791c45c core: move clusterInfo code to the controller package
The CSI package needs to load clusterInfo, today this code is in the mon
package which makes the call of LoadClusterInfo impossible without
having a circular import.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-04-26 11:05:02 +02:00
Sébastien Han 6bc7827150 osd: only set kek to env var on encryption scenario
There is a corner case where an env variable populated with the prepare
job could influence and trigger some encryption code. We have an env
variable to discover whether the prepare job will encrypt a drive or not
so let's use that instead of running code as a noop and sometimes
trigger a corner case. In this scenario, the prepare job had an "IBM_"
env variable present in the OS image (IBM OS) so the setKEKinEnv()
  function would get called for no reason.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-04-11 16:54:18 +02:00
Madhu Rajanna b0fc7c9b92 namespace: add new CRD
This introduces a new CRD to add the ability
to create rados namespace for a given
ceph block pool. Typically the name of the pool
is the name of the blockpool created by rook.

Closes: #7035

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2022-04-05 10:10:04 +05:30
subhamkrai 24802c559e core: fix golangci linter
fix golangci linter

Signed-off-by: subhamkrai <srai@redhat.com>
2022-04-04 20:59:31 +05:30
Krzysztof Nazarewski 352df4e62f osd: add NixOS specific PATHs
This commits makes Rook usable on NixOS.

NixOS system holds "installed" binaries in `/run/current-system/sw/{bin,sbin}`.
The only binaries residing outside those paths are `/usr/bin/env` and `/bin/sh`.

I got a suggestion on Slack to simply add those NixOS specific paths

Signed-off-by: Krzysztof Nazarewski <3494992+nazarewk@users.noreply.github.com>
2022-04-01 16:37:23 +02:00
Divyansh Kamboj 9008409f87 core: add context parameter to functions
This commit adds context parameter to various functions, and remove the
usage of context.TODO.

Closes: https://github.com/rook/rook/issues/8701
Signed-off-by: Divyansh Kamboj <dkamboj@redhat.com>
2022-03-22 08:19:07 +05:30
Travis Nielsen 03c7164b15 mon: options for enabling msgr2 encryption and compression
msgr2 allows for encryption and/or compression across the wire.
Settings for enabling the encryption and compression are now
available in the cluster CR to that ceph will be automatically
configured with these settings when desired.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-03-10 11:50:42 -07:00
Travis Nielsen 9f6804515c mon: enable msgr2 by default for new mons
New mons all support msgr2, so there is no need to keep the default
msgr1 port for new mons.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-03-10 11:48:47 -07:00
Travis Nielsen 2b2231eb0c mon: no need to enable msgr2 since nautilus
Since Nautilus, mgr2 is already enabled by default. No longer
does the operator need to enable msgr2 after the mons are
configured or upgraded.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-03-10 11:48:47 -07:00
Sébastien Han 74081d90d3 osd: clarify vault auth error message
When kube authentication is used, let's clarify the error message and
hopefully lead to a better understanding on where to look for.
It could be misleading to print "token auth" when using kube auth,
although internally a token is used (the JWT from the Service
Account).

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-03-10 14:10:19 +01:00
Blaine Gardner 27ea49b9cd osd: disable raw mode for specific disk configs
If a specific disk is configured to have more than one OSD per device,
or if it has a metadata device specified, exclude it from raw mode on an
individual basis.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2022-03-07 08:35:14 -07:00
Travis Nielsen c8e68511ce Merge pull request #9804 from travisn/cleanup-metadata-pvcs
osd: Purge job will remove all pvcs for the osd
2022-02-28 11:08:38 -07:00
Travis Nielsen 879bde4416 osd: remove osd with purge instead of destroy
The osd destroy command leaves the osd id in use instead
of fully purging the osd id. If the osd id is not also
removed, it gives the impression that there is still
something that needs to be cleaned up from the old osd.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-02-25 12:02:20 -07:00
Travis Nielsen b3ca0f1b87 osd: purge job will remove all pvcs for the osd
The purge job is intended to clean up all the resources
related to an OSD that is to be removed. An OSD with
a metadata, wal, and data PVC was only cleaning up the
data PVC. Now the metadata and wal PVCs will also be
cleaned up.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-02-24 12:05:15 -07:00
Satoru Takeuchi 1fd8e9ef98 osd: re-enable raw mode on disk
We can re-enable raw mode OSD on disk if Ceph version is at least v16.2.6.

https://github.com/ceph/ceph/pull/42469

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

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2022-02-21 00:09:45 +00:00
Sébastien Han 3b0547a88c Merge pull request #9760 from leseb/fix-external-cluster-csi-validation
core: various external mode enhancements
2022-02-17 16:44:17 +01:00
Sébastien Han fdcad15b87 core: check for canceled context in external mode
This is fixing a potential race where the context is canceled and the
external cluster is trying to fetch the cluster info. If the context is
canceled then the loop will be stuck forever. Now we check for the
canceled context and return appropriately.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-02-17 15:30:25 +01:00
Travis Nielsen d4b8fa19b2 osd: return error if fail to list osds in prepare job
The OSD prepare job was succeeding even if the OSDs failed to be listed
by ceph-volume. These errors should be returned and fail the job, resulting
in a retry to retrieve the OSDs. Otherwise, the failure is masked and
the admin needs to dig through logs to find why the OSDs were not configured
on that node.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-02-15 15:49:50 -07:00
Sébastien Han 23832c8cc7 osd: add namespace in vault client
If the KMS connection details for Vault have a VAULT_NAMESPACE we must
use it when building the vault client to auto-detect the KV internal
version.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-02-10 12:13:41 +01:00
Travis Nielsen 221b3dfb72 object: update pool properties during reconcile
The reconcile was skipping updating most pool properties for
object stores. The implementation of pools between the file,
object, and pool controllers had some duplicate code, so
this change also factors out the common code for better
reuse in a single place. Anytime a pool is created or updated,
it will now consistently update all the pool properties
that are expected to be modifiable.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-02-04 13:41:12 -07:00
Satoru Takeuchi 2d8f9b67c6 core: eliminate unnecessary code
We can eliminate the OSD creation code for Ceph < v15.2.0 because Nautilus(v14.2.z)
is no longer supported. In other words, we can now expect that all newly-created
OSDs on PVC are raw mode.

Please note that the existing lvm mode OSDs on PVCs still be supported after this change.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
2022-02-04 13:59:01 +00:00
Sébastien Han 49f75c8ec3 subvolumegroup: handle external mode
If the cluster is external, users might still want to take advantage of
the ceph-csi configmap configuration for ceph filesystem subvolume
group. This configuration is handled by the controller whenever a
cephFilesystemSubVolumeGroup CR is created or deleted.
If the present cluster CephCluster is external, the controller
(cephFilesystemSubVolumeGroup) won't handle creation nor deletion of sub volume groups.
It just assumes that the given name is correct and the controller goes ahead with the
ceph-csi configuration.

Closes: #9551
Signed-off-by: Sébastien Han <seb@redhat.com>
2022-02-03 16:28:07 +01:00
subhamkrai 6bdd5b2062 core: remove obsolete ceph-volume executor code
In volume.go, remove if condition in `callCephVolume`
method where we always pass false.

In exec.go, removing `ExecuteCommandWithFile*` methods
which was not used anywhere.

Signed-off-by: subhamkrai <srai@redhat.com>
2022-01-28 20:17:55 +05:30
Sébastien Han d6c8512c7e Merge pull request #9654 from leseb/nits
core: fix some nits
2022-01-26 16:06:51 +01:00
Sébastien Han 58c175de47 core: add a break line before printing the ceph config
It's easier to read the config if there is a new line before instead
having a truncated version like:

```
2022-01-26 06:39:41.421373 D | cephclient: config file @ /etc/ceph/ceph.conf: [global]
fsid                = 0650a1d5-d688-4575-97fc-7b3052a8a3dd
mon initial members = a
mon host            = [v2:10.104.192.209:3300,v1:10.104.192.209:6789]

[client.admin]
keyring = /var/lib/rook/rook-ceph/client.admin.keyring
```

Now we have:

```
2022-01-26 06:39:41.421373 D | cephclient: config file @ /etc/ceph/ceph.conf:
[global]
fsid                = 0650a1d5-d688-4575-97fc-7b3052a8a3dd
mon initial members = a
mon host            = [v2:10.104.192.209:3300,v1:10.104.192.209:6789]

[client.admin]
keyring = /var/lib/rook/rook-ceph/client.admin.keyring
```

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-01-26 15:19:16 +01:00
Sébastien Han e31e4b49b0 core: print the stdout on errors
If we fail fetching the ceph version let's also print the stdout since
ceph tends to put the error here too.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-01-26 15:16:22 +01:00
Travis Nielsen e0cfb4fce6 pool: check for application already being set
If the pool application is already set, skip setting it again
to avoid a warning message being logged that it is already
set.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-01-25 15:05:18 -07:00
Eng Zer Jun ed63571530 test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir()` and is automatically removed when
the test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-01-24 23:52:54 +08:00
Sébastien Han 7cc6e23a0b osd: rename a few configuration flags
For better consistency with IBM_KP_SERVICE_API_KEY and use
"ibmkeyprotect" as a provider name for more clarity.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-01-20 16:01:26 +01:00
Sébastien Han a7acf490b6 osd: add ibm key protect kms
The cluster-wide encryption feature now has a new supported key
management system: IBM Key protect. More information about the backend
can be found in Rook documentation under the

Today's implementation stores OSD encryption keys has "Standard" keys.

Signed-off-by: Sébastien Han <seb@redhat.com>
2022-01-13 16:02:10 +01:00
Blaine Gardner bb0d0d39f6 Merge pull request #9384 from leseb/fix-7036
subvolumegroup: add new crd
2021-12-21 10:24:23 -07:00
Sébastien Han 6e9eb33782 subvolumegroup: add new crd
This introduces a new CRD to add the ability to create subvolumegroup
for a given ceph filesystem volume. Typically the name of the volume is
the name of the filesystem created by rook.

Closes: https://github.com/rook/rook/issues/7036
Signed-off-by: Sébastien Han <seb@redhat.com>
2021-12-21 16:28:38 +01:00
Sébastien Han 05775b068d osd: handle removal of encrypted osd deployment
This is handling a tricky scenario where the OSD deployment is manually
removed and the OSD never reconvers. This is unlikely to happen, but
still OSD should be able to run after that action. Essentially after a
manual deletion, we need to run the prepare job again to re-hydrate the
OSD information so that the OSD deployment can be deployed.
On encryption, it is a little bit tricky since ceph-volume list again
the main block won't return anything, so we need to target the encrypted
block to list.
There is another case this PR does not handle, which is the removal of
the OSD deployment and then the node is restarted. This means that the
encrypted container is not opened anymore. However, opening it requires
more work like writing the key on the filesystem (if not coming from the
Kubernete secret, eg,. KMS vault) and then run luksOpen. This is an
extreme corner case probably not worth worrying about for now.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-12-21 10:51:09 +01:00