Commit Graph
115 Commits
Author SHA1 Message Date
df511fb58f ci: update golangci-lint to the latest version (v1.62)
The ci was using a pretty old version og golangci-lint.
This updates to the latest version.

Additionally, it  silences some
gosec integer conversion overflow false positves
and fixes some real errors of this category
 and string format errors found by golangci-lint, while at it.

Co-authored-by: Blaine Gardner <b.blaine.gardner@gmail.com>
Co-authored-by: Travis Nielsen <tnielsen@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
2024-12-14 14:47:30 +01:00
Santosh Pillai a344ff53f3 core: add pool IDs to cephBlockPool CR status
Adding pool ID of the cephBlockPool in the CR status

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2024-11-08 21:07:48 +05:30
parth-gr ed5013e9c6 rbdmirror: add disable check for status check
enable and disable the status of rados namespace
mirroring by looking at statusCheck spec of blockpool

Signed-off-by: parth-gr <partharora1010@gmail.com>
2024-11-06 22:42:46 +05:30
parth-gr eec2b3e581 rbdmirror: fix mirroring monitoring settings for blockpool
currently if we disable the monitoring for cephblockpool
it didnt worked, as there was no check to cancel it
if the mirroring is still enabled

Add a check to disable the monitoring if mirroring is still enabled

closes: https://github.com/rook/rook/issues/14958

Signed-off-by: parth-gr <partharora1010@gmail.com>
2024-11-06 11:56:16 +05:30
Blaine Gardner 8f6da3d6da Merge pull request #14897 from OdedViner/delete_pool_item
rbd: CephBlockPool enableRBDStats not clearing rbd_stats_pools
2024-11-05 11:07:31 -07:00
Travis Nielsen 7692cae359 Merge pull request #14896 from parth-gr/rbd-mirror-rados-monitor
rbd: enable periodic monitoring for rados namespace mirroring
2024-11-05 09:15:32 -07:00
Oded Viner 8dea77255b pool: fix CephBlockPool enableRBDStats not clearing rbd_stats_pools
This PR fixes an issue where disabling enableRBDStats in CephBlockPool did not remove
the pool from rbd_stats_pools, leading to unnecessary monitoring.
The update ensures that when enableRBDStats is set to false,
the pool is properly removed from rbd_stats_pools, optimizing resource tracking.

Signed-off-by: Oded Viner <oviner@redhat.com>
2024-11-05 15:03:21 +02:00
parth-gr 9785ef5c8d rbdmirror: enable periodic monitoring for rados namespace
enable monitoring for rados namespace

Signed-off-by: parth-gr <partharora1010@gmail.com>
2024-11-05 13:45:02 +05:30
Madhu Rajanna 4e29717317 core: cleanup blockpool with annotation
This is similar to #14052 we did for radosnamespace
and this is an extension to support cleanup
at the blockpool level to cleanup the images
and the snapshots in a pool.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-10-23 12:20:31 +02:00
Travis Nielsen 0fa21969df Merge pull request #14701 from parth-gr/rbd-mirror-rados
rbdmirror: enable rbd rados namespace mirroring
2024-10-10 09:35:22 -06:00
parth-gr 2cef47a9b7 rbdmirror: enable rbd rados namespace mirroring
Modify the CR to allow mirroring of an rados namespace
to a differently named namespace on the remote cluster

1) enable rados namesapce mirroring only
if the blockpool mirrroing is enabled

2) disable blockpool mirroing only if
all the namesapce mirroing is disabled

if the rbd mirroring fails and ceph version is not supported
provide a error message with supported version details
and reason of failing

Signed-off-by: parth-gr <partharora1010@gmail.com>
2024-10-10 14:23:11 +05:30
Santosh Pillai 1a95d6f533 core: preserve pool application name change
default application name is updated inside the `CreatePool` method. Send
pool spec as address in order to preserve this change.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2024-09-25 12:12:01 +05:30
Travis Nielsen 0bea31ef7f pool: return error if device class update fails
Updating the device class swallowed any error if updated
for the pool. The error was not even logged, so we couldn't
troubleshoot why the new crush rule was not applied.
Log the error for troubleshooting and also fail the pool
reconcile since the desired configuration was not applied.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2024-07-10 12:59:43 -06:00
subhamkrai d429ed8be4 build: update controller runtime to v0.18.4
this commit update cntrl runtime to v0.18.4 and other related deps/

Signed-off-by: subhamkrai <srai@redhat.com>
2024-07-05 09:05:12 +05:30
subham rai 71b3728a99 Merge pull request #13958 from NymanRobin/improve-kubectl-get-output
operator: improve the output of kubectl get
2024-04-03 10:42:17 +05:30
NymanRobin 17adb16d0b operator: improve the output of kubectl get
make the kubectl output for crds more verbose.
Following changes was done for each crd:

CephBlockPool:
Added print columns:
 - Type
 - FailureDomain
 - Replication
 - EC-CodingChunks
 - EC-DataChunks
 - Age
Extended info field of status to include:
type and failureDomain

CephObjectStore:
Added print columns:
 - Endpoint
 - SecureEndpoint
 - Age

Added Age to print columns of following crds:
CephObjectStoreUser, CephObjectZoneGroup,
CephObjectZone, CephBucketTopic, CephClient,
CephRBDMirror, CephFilesystemMirror,
CephFilesystemSubVolumeGroup

Signed-off-by: NymanRobin <nyman.robin@gmail.com>
2024-04-02 20:41:13 +03:00
sp98 996d9e136a core: use correct pool name to disable mirroring
Pool name either come from CephBlockPool name or
form the CephBlockPool Spec. Use the correct name
when trying to disable mirroring.

Signed-off-by: sp98 <sapillai@redhat.com>
2024-04-02 21:35:59 +05:30
sp98 a37c47641f core: disable mirroring in image mode
For image mode mirroring, if cephBlockPool.Pool.Spec.Mirroring.Enable
is set to false, then remove the peer cluster and disable mirroring on
all the pool if the user has disabled mirroring on all the pool images.

If mirroring is not disabled on all the pool images, then reconcile will
fail asking the users to manually disable mirroring on those images.

Signed-off-by: sp98 <sapillai@redhat.com>
2024-03-19 14:20:51 +05:30
travisn 806608cdbc pool: allow setting the application on a pool
Rook has been setting the application automatically on all
pools to rbd for CephBlockPools, rook-ceph-rgw for
CephObjectStores, mgr on the built-in .mgr pool,
and nfs on the built-in .nfs pool.

The legacy pool device_health_metrics is long gone
from Pacific which is no longer supported, so we can
remove special handling for that pool in the upgrade
guide and in the code.

The application setting is now available on the pool spec
although it is not expected to commonly need to override
the default applications set by Rook.

The application for CephFilesystem pools is now being
set to cephfs, where it was previously blank.

Signed-off-by: travisn <tnielsen@redhat.com>
2024-02-14 16:53:25 -07:00
travisn 557a3e06cc core: api updates for controller runtime v0.15
For the controller runtime v0.15 there are some breaking
changes to the api that need to be updated.

Signed-off-by: travisn <tnielsen@redhat.com>
2023-06-22 10:33:28 -06:00
Travis Nielsen 95b84a6c12 Merge pull request #11099 from avanthakkar/fix-configure-rbd-stat-pools
operator: Don't remove existing pools for mgr/prometheus/rbd_stats_pools
2022-10-12 14:20:47 -06:00
Avan Thakkar e8b74207dd operator: don't remove existing pools for mgr/prometheus/rbd_stats_pools
Rook currently knows rbd pools only if they defined through CephBlockPool, so it overrides the config
mgr/prometheus/rbd_stats_pools which may have already been set for pools external to Rook. Check config
before running set command and if there some existing pools append them to enableStatsForCephBlockPools.

Signed-off-by: Avan Thakkar <athakkar@redhat.com>
2022-10-12 20:59:44 +05:30
Travis Nielsen 4c11ba76d7 Merge pull request #10721 from zhucan/bugfix-10712
pool: add timeout to ceph cmd
2022-10-12 08:31:52 -06:00
parth-gr 26584fc6e5 core: update loadclusterInfo with multus check
if Multus is enabled the clusterinfo should be updated with
network as multus as to run the ceph cmds in remote
executor

Signed-off-by: parth-gr <paarora@redhat.com>
2022-09-22 14:46:51 +05:30
zhucan aa41742c83 pool: add timeout to rbd cmd
Signed-off-by: zhucan <zhucan.k8s@gmail.com>
2022-09-16 10:26:20 +08:00
Rakshith R c02f3194d1 pool: initialize only rbd application pools
`rbd pool init` cmd initializes pool for rbd images.
This commit makes modification to init only
rbd application pools, since it is not required
by other pools like ".nfs",".mgr" & "mgr_devicehealth".

Signed-off-by: Rakshith R <rar@redhat.com>
2022-09-13 18:18:26 +05:30
Travis Nielsen 89fadabcc1 Merge pull request #10575 from shalevpenker97/EnableRBDStats-mgr-fix
Fix EnableRBDStats mgr
2022-07-18 12:57:54 -06:00
shalev.p 49996522bf pool: configureRBDStats remove postfix dot in mgr config path
The ceph rbd_stats does not take affect with dot postfix.

Closes: https://github.com/rook/rook/issues/10574
Signed-off-by: shalev.p <shalev.p@taboola.com>
2022-07-11 18:21:42 +03: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 e3ca5bfbcc pool: delete ceph pool when blockpool cr is deleted
During deletion of a CephBlockPool CR, the underlying ceph
pool was not being deleted. During the deletion sequence
this is due to the spec being refreshed upon a call to
check for dependents in ReportDeletionNotBlockedDueToDependents().
The pool name was then coming up blank during the deletion
request and rook of course then wasn't finding the pool
to delete.

Now Rook properly sets the pool name in the named spec
every time it is converted internally from a CephBlockPool
type to a NamedPoolSpec.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-06-01 10:20:57 -06: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
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
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
Sébastien Han 18b19de639 Merge pull request #9687 from parth-gr/observedGeneration
core: add observedGeneration to CR status
2022-03-17 10:36:11 +01:00
Travis Nielsen ad99f9e205 pool: update the quincy default pool to .mgr
In Quincy, the device_health_metrics pool is renamed to .mgr.
In the example cluster-test.yaml, we therefore update the
example to create the pool with the new name.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2022-03-16 14:18:49 -06:00
parth-gr 2dfd64a97c core: add observedGeneration to CR status
adding observedGeneration field in the cephcluster cr
status for having better control on reconciling,
as observedGeneration field will be updated by the controller

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

Signed-off-by: parth-gr <paarora@redhat.com>
2022-03-16 19:58:35 +05:30
subhamkrai 6a9ff434d2 core: add k8s events in controller reconciler
adding k8s event in controller reconciler when
1. when reconciler starts
2. when deletion reconcile triggered.

Closes: https://github.com/rook/rook/issues/9462
Signed-off-by: subhamkrai <srai@redhat.com>
2022-03-14 18:55:26 +05:30
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
Travis Nielsen 7ee9cc9d56 pool: allow configuration of built-in pools with non-k8s names
The built-in pools device_health_metrics and .nfs created by ceph
need to be configured for replicas, failure domain, etc.
To support this, we allow the pool to be created as a CR.
Since K8s does not support underscores in the resource names
the operator must translate this special pool name into
the name expected by ceph.

This also sets the basis for allowing filesystem data
pools to specify the desired pool name instead of requiring
a generated name.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-12-15 15:32:02 -07:00
Blaine Gardner 0c76be8c38 pool: file: object: clean up health checkers for force deletion
When CephBlockPool, CephFilesystem, or CephObjectStore resources are
deleted after removing their finalizer, the code path to stop monitoring
was not stopping monitoring since a non-present resource does not have a
name and namespace attached. When the object is deleted, ensure the
internal representation used to stop monitoring has a name and namespace
to fix the issue.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2021-12-13 16:07:01 -07:00
Blaine Gardner 03ba7dec64 pool: file: object: clean up stop health checkers
Clean up the code used to stop health checkers for all controllers
(pool, file, object). Health checkers should now be stopped when
removing the finalizer for a forced deletion when the CephCluster does
not exist. This prevents leaking a running health checker for a resource
that is going to be imminently removed.

Also tidy the health checker stopping code so that it is similar for all
3 controllers. Of note, the object controller now uses namespace and
name for the object health checker, which would create a problem for
users who create a CephObjectStore with the same name in different
namespaces.

Signed-off-by: Blaine Gardner <blaine.gardner@redhat.com>
2021-11-19 10:29:12 -07:00
Yuichiro Ueno 0b575703c7 core: add context parameter to k8sutil deployment
This commit adds context parameter to k8sutil deployment functions. By
this, we can handle cancellation during API call of deployment resource.

Signed-off-by: Yuichiro Ueno <y1r.ueno@gmail.com>
2021-11-13 14:58:13 +09:00
Travis Nielsen fd10d98dc6 core: treat cluster as not existing if the cleanup policy is set
The cluster CR can be forcefully deleted and cleanup the
cluster resources if the yes-really-destroy-data policy
is set on the CR. In this case, the other controllers should
treat the cluster CR as not existing and allow the finalizers
to be removed on those resources if they are requested for
deletion.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2021-10-27 10:25:06 -06:00
Blaine Gardner 2f850b6ae6 Merge pull request #8613 from subhamkrai/remove-nautilus
ceph: remove ceph nautilus, ceph octopus to default
2021-10-25 09:09:18 -06:00
Yuichiro Ueno 3fd86f83ae core: add context parameter to opcontroller
This commit adds context parameter to utilities in opcontroller to
remove context.TODO use in opcontroller. By this, we can handle
cancellation of reconcilers in a fine-grained way.

Signed-off-by: Yuichiro Ueno <y1r.ueno@gmail.com>
2021-10-25 20:45:06 +09:00
subhamkrai 0150966024 ceph: remove ceph nautilus, ceph octopus to default
since rook 1.8, ceph nautilus no longer supported,
ceph octopus will be the minimum ceph version.

Closes: https://github.com/rook/rook/issues/7908
Signed-off-by: subhamkrai <srai@redhat.com>
2021-10-20 14:45:12 +05:30
Rakshith R ab87e1d238 ceph: initialize rbd block pool after creation
This is done in order to prevent deadlock when parallel
PVC create requests are issued on a new uninitialized
rbd block pool due to https://tracker.ceph.com/issues/52537.

Fixes: #8696

Signed-off-by: Rakshith R <rar@redhat.com>
2021-10-06 19:54:51 +05:30
Sébastien Han b89730d895 ceph: refactor operator initialization sequence
This commit is a large refactor on how the operator starts, stops and
how it starts various sub-components such as the ceph-csi driver. It
also refines the way we cancel orchestrations. We don't use breakpoints
anymore but send our self a SIGUP to reload our controller runtime
manager.
The reload will happen under different circonstances like:

* a new adminission controller secret is created/deleted/changed
* a CephCluster CR is edited

As mentioned earlier, the csi driver now has its own controller, just
like flex. It reacts to change in the operator config map for particular
ROOK_CSI_ fields.

A second new controller for the operator's general config has been
created, it manages:

* the logging level
* the ceph CLI command timeout
* the discovery daemon

The operator reacts much more rapidly to cancellation events by stopping
the manager's context and reloading it.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-09-17 16:57:12 +02:00
Sébastien Han 4cb9b53487 ceph: fix pool deletion when running on multus
The ceph-block-pool controller was missing the network spec from the
cephcluster that contains all the details about networking.
So when the pool was deleting on multus the controller was not proxying
the rbd command to the mgr pod but executed the command in the operator
pod which does not have the network annotation and then connect to the
ceph cluster.

Signed-off-by: Sébastien Han <seb@redhat.com>
2021-09-08 16:10:31 +02:00
Sébastien Han d4dd0577f9 Merge pull request #8529 from sp98/id-mapping
ceph: add ClusterID and PoolID mappings between local and peer cluster
2021-08-31 17:32:14 +02:00