Commit Graph
210 Commits
Author SHA1 Message Date
Asish Kumar 24a35e4e74 pool: clean up unused crush rules
Clean up stale CRUSH rules after the Ceph mgr starts so rules left behind by pool failure-domain or device-class changes do not accumulate indefinitely.

The cleanup is guarded by a package-level RWMutex. Pool create and update paths hold the read lock while creating and assigning CRUSH rules, while cluster-wide cleanup holds the write lock before listing pools and deleting unused rules. This keeps pool reconciles parallel with each other while preventing cleanup from deleting a rule that another reconcile has just created but not yet attached to a pool.

Keep direct pool-delete cleanup for the pool's current CRUSH rule, make the cluster-wide cleanup best-effort across all unused rules, and add an operator-level ROOK_DELETE_UNUSED_CRUSH_RULES setting for clusters that need to leave unused custom rules in place.

Document the operator and Helm settings, regenerate the Helm chart docs, and add a pending release note for the default cleanup behavior.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
2026-04-24 23:57:40 +05:30
Travis Nielsen f6309dfc8d Merge pull request #17208 from OdedViner/ec_remove
pool: clean up erasure code profile on pool deletion
2026-03-19 10:03:53 -06:00
Oded Viner 3f63676ce3 pool: add tests for ec pool ready status
add unit and integration tests to verify that erasure
coded cephblockpool status transitions to ready and
does not remain stuck in progressing.

Signed-off-by: Oded Viner <oviner@redhat.com>
2026-03-19 16:02:03 +02:00
Oded Viner b88648d10f pool: clean up erasure code profile on pool deletion
deleting an erasure coded CephBlockPool left the ec profile
orphaned. recreating with different settings failed because
the old profile could not be overridden.
- delete ec profile during CephBlockPool deletion
- disable --format json on ec profile set command
- fix ec profile name mismatch in CephObjectStore deletion

Signed-off-by: Oded Viner <oviner@redhat.com>
2026-03-18 23:53:57 +02:00
Oded Viner ba9fad77a0 pool: set ec pool status to ready after reconcile
ec pools skip the mirroring configuration path where
the status is set to ready, leaving them stuck in
progressing state forever. add status update to ready
in the else branch when mirroring is skipped.

Signed-off-by: Oded Viner <oviner@redhat.com>
2026-03-17 19:05:56 +02:00
parth-gr 9f932d477e pool: skip miroring if the pool is ec
the ec pool doesnt support mirroring from ceph end
so skip if the mirroring spec is set on the ec pools

Signed-off-by: parth-gr <partharora1010@gmail.com>
2026-03-06 13:31:58 +05:30
subhamkrai 08344f39f6 build: update deprecated api GetEventRecorderFor
with controller runtime latest version vO.23.0, golangci lint
is complaining about deprecated api deprecated.
This commit updates the api and adds the requried rbacs

Signed-off-by: subhamkrai <srai@redhat.com>
2026-02-09 21:48:02 +05:30
Travis Nielsen 76e9c04b36 csi: disable read affinity for ceph v20.2.0
Read affinity in Ceph v20.2.0 can cause corruption.
Disable this feature for this version of Ceph to
avoid hitting any corruption in this case. When the next
patch release is out for tentacle, this issue will be
resolved and when upgrading to it, read affinity would
automatically be re-enabled if needed.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2026-01-12 13:46:43 -07:00
Jongwoo Han d59b4dcb84 core: replace custom contains() with slices.Contains()
Signed-off-by: Jongwoo Han <jongwooo.han@gmail.com>
2025-12-24 13:28:05 +09:00
Travis Nielsen 023608e6fd core: enhance logging with namespaced names
For all of the controllers besides the cluster controller,
the logging now includes the namespaced name of the resource
that is being reconciled. This will help with log troubleshooting
to help analyze logs consistently for the resource being
reconciled.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2025-12-04 12:00:42 -07:00
Travis Nielsen 9a79a48f9e Merge pull request #16661 from subhamkrai/fix-rns-race-condition
namespace: add retryOnConflict when updating status
2025-11-13 10:38:17 -07:00
parth-gr 7ef4b4849c pool: retry if pool status is empty in rn controller
if the pool is just created and getting the status
updated rn controller can still go and proceed to
check the pool status
If the pool status is empty we should retry instead of
proceeding further

Signed-off-by: parth-gr <partharora1010@gmail.com>
2025-11-12 11:51:53 +05:30
subhamkrai c8ee7305d4 namespace: add retryOnConflict when updating status
currently, in RNS crd while updating status we don't
have retryOnConflicts, similar to other CRD due to
this RNS status was not updated succesfully and to
fix this we have restart the rook operator pod.

Signed-off-by: subhamkrai <srai@redhat.com>
2025-11-12 10:16:43 +05:30
parth-gr ec242d5ee7 pool: fix pool status check in rn controller
if the pool is just created and getting the status updated
rn controller can still go and proceed to check the pool status
which result in panic
and later it stop re-trying because of panic get swallowed
https://github.com/rook/rook/commit/cf13deee6f0aaa1ff854d57493bf91df70f8f436

Signed-off-by: parth-gr <partharora1010@gmail.com>
2025-11-11 18:39:01 +05:30
parth-gr 49c26dbfb0 rbdmirror: fix mirroring monitoring settings for rn
currently if we disable the monitoring for rn,
it doesnt reset the status

Signed-off-by: parth-gr <partharora1010@gmail.com>
2025-09-25 19:26:52 +05:30
cuiweixie 20b3b9deef operator: refactor to use reflect.TypeFor
Signed-off-by: cuiweixie <cuiweixie@gmail.com>
2025-08-28 23:02:19 +08:00
Blaine Gardner 2fd9c9a88c core: finalize CephCluster CephX status handling
Cleanup up overall usage of CephX statuses in CephCluster.

Convert all CephX statuses to non-pointer types. There is no specific
need for pointer types, and keeping these as non-pointers means there is
not a risk of nil pointer exceptions in all the various Rook controllers
for upgraded clusters.

Move initialization of CephCluster CephX status items to
`preMonStartupActions()`. This helps resolve 2 issues:

1. 'Uninitialized' state was being set for external CephClusters where
   CephX statuses are not relevant.
2. 'Uninitialized' state was being set for upgraded clusters whose key
   status cannot be determined.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
2025-08-18 14:53:08 -06:00
Denis Egorenko c9e0f89a8b pool: fix cephblockpool remove when related pool is already removed from cluster
When removeing CephBlockPool check first that related ceph pool is exist in cluster,
since it may be manually removed by mistake.

Related-Issue: #16328
Signed-off-by: Denis Egorenko <degorenko@mirantis.com>
2025-08-15 22:59:34 +04:00
Travis Nielsen 1deec3a396 Merge pull request #16290 from parth-gr/fix-mirror-status
rbdmirror: fix status check for rbd rn mirroring
2025-08-13 08:15:39 -06:00
parth-gr 11b3d7e16e rbdmirror: fix status check for rbd rn mirroring
if the blockpool mirroring is disabled and status check
is not removed, currently rn cr still watches for the status

Add a check if the pool or rados mirroring is disabled then dont
watch for status

Signed-off-by: parth-gr <partharora1010@gmail.com>
2025-08-13 13:33:05 +05:30
Blaine Gardner 59ca78229d Merge pull request #16075 from sp98/mirror-key-rotation
rbd mirror peer key rotation
2025-08-11 10:54:20 -06:00
Santosh Pillai ee0b137d75 core: rotate rbd mirror peer key
rotate the client.rbd-mirror-peer key based on the cephxconfig.
Also update the cephxStatus in the cephcluster as well as the
mirrored cephblockpool.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2025-08-11 21:53:14 +05:30
Madhu Rajanna 1ff3f07ac5 csi: use cluster namespace for cephConn
CephConnection CR is created with the
kubernetes namespace name as its the
unique name in the entire cluster.
This PR removes unwanted input
parameters and adjust the namespace
name for the cephConnection CR.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2025-08-11 07:38:27 +02:00
Travis Nielsen 7b2dfdba17 Merge pull request #16150 from OdedViner/log_panics_controller
core: log panics in controller reconcile functions
2025-07-29 09:59:27 -06:00
Oded Viner cf13deee6f core: log panics in controller reconcile functions
add RecoverAndLogException() helper to log panics with stack trace.
added defer call in all rook controller Reconcile() methods for
better error visibility in operator logs

Signed-off-by: Oded Viner <oviner@redhat.com>
2025-07-29 13:20:38 +03:00
Travis Nielsen 55e02436da Merge pull request #16102 from Madhu-1/add-clusterID
Provide option to set the clusterID in the RNS and SVG CR
2025-07-28 08:48:38 -06:00
Madhu Rajanna 2a41afcb28 core: add clusterID to rados namespace CRD
Providing an option for user to specify the clusterID
they want to use in the storageclass while creating
the radosnamespace.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2025-07-28 08:29:51 +02:00
subhamkrai 6df727b91a csi: update csi-operator yaml to v1
this commit updates the csi-operator complete deployment
file csi-operator.yaml to v1 from v1alpha1.

Signed-off-by: subhamkrai <srai@redhat.com>
2025-07-23 21:02:59 +05:30
Oded Viner e089092092 pool: remove redundant stats pools info log
remove unnecessary info-level log for enableStatsForPools;
detailed debug log already exists

Signed-off-by: Oded Viner <oviner@redhat.com>
2025-07-14 12:31:31 +03:00
Travis Nielsen b47f297608 namespace: report empty condition for rados namespace
The rados namespace status was not reporting if the namespace
was empty. Now the condition will be properly updated if
it is empty.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2025-06-13 10:06:37 -06:00
Oded Viner 41d6baf0e1 core: fix radosnamespace log message
change logger.info to logger.infof to correctly print
radosnamespace name and namespace

Signed-off-by: Oded Viner <oviner@redhat.com>
2025-06-11 14:29:28 +03:00
subhamkrai ebc1671ab7 namespace: delete old rns cr with same block pool name
there can be a scenario where a new RNS CR is created with
the same spec.blockPoolName and spec.name, in that case we want to delete
the old RNS CR without checking dependent child resources.

Signed-off-by: subhamkrai <srai@redhat.com>
2025-05-19 20:53:24 +05:30
Travis Nielsen 530223c5b4 namespace: add conditions blocking deletion for rados namespace
When a rados namespace is deleted, it cannot be purged
until its images and snapshots are deleted. Now a condition
is being added to the rados namespace CR status so the user
does not need to read the operator log to discover the cause.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2025-05-07 15:42:17 -06:00
Travis Nielsen 0a3a599580 block: add condition for deletion blocked with images
When the blockpool is deleted and there are images or
snapshots in the pool, the deletion is blocked by the
finalizer until they are all removed. The condition added
to the cephblockpool status only indicated if there were
radosnamespace dependencies. A new condition is now added
to describe if there are images or snapshots.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2025-05-07 15:42:17 -06:00
subhamkrai fe776fd4fe rbdmirror: logs message should not end with period
improving logging to include name and namespace of resource
and also namespace should not end with period.

Signed-off-by: subhamkrai <srai@redhat.com>
2025-04-29 20:55:36 +05:30
Travis Nielsen 08c97bc752 Merge pull request #15593 from prazumovsky/retry-pool-status
pool: retry status update on fail
2025-04-09 11:14:13 -06:00
Peter Razumovsky d7c67fecee pool: retry status update on fail
In some cases, for example, kube-api nods, CephBlockPool's status
could be failed to update. In that case, rook-operator does not
tries to update status again. This fix requests for requeue if pool's
status update is failed.

Signed-off-by: Peter Razumovsky <prazumovsky@mirantis.com>
2025-04-09 18:47:38 +04:00
Travis Nielsen f7fb1bc0f2 core: skip reconcile when adding the finalizers
When finalizers are added to the CRs, a follow-up reconcile
will be triggered due to the increased generation on the CR.
Therefore, abort the initial reconcile when adding the finalizer,
and allow the follow-up reconcile to complete the configuration.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2025-04-08 13:42:58 -06:00
Joshua Hoblitt 9f1ed201db core: typed watch handlers and predicates
All existing controller runtime watches are converted to use "typed"
handlers and predicates instead of operating on `client.Object`.  The
intent is to be bug for bug equivalent with the existing logic while
replacing run time type assertions and switch statements with compile
time type constraints and type casts. In several cases, functions using
assertions were split up such that each function only handles a single
Kind at a time. It is hoped that this will improve readability and
maintainability while facilitating future refactoring such as migrating
some watches to using IndexFields.

Of particular note is that the massive switch statement in
`WatchControllerPredicate()`  from
`pkg/operator/ceph/controller/predicate.go` has been replaced with
generics, reflection, and splitting the obc logic into its own predicate
function. There are still many helper functions operating on
`client.Object`. These were not updated unless required by the compiler
in order to limit the size of this change. The type safety of these
funcs should be improved as followup work.

 It is strongly suggested that going forward, handlers and predicates
 only handle a single Kind (generic or not) and that switches / type
 assertions are heavily discouraged or forbidden. This PR removed all
 but a single switch statement in a predicate, which should be addressed
 in future work.

Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-04-04 09:40:56 -07:00
subhamkrai 420178fe3e rbdmirror: mirroring b/w implicit and defined ns
this commit add support for mirroring b/w implicit rados namespace and
defined rados namespace. To support this, rook will treat `<implicit>`
name on cephblockpool as `""` empty string. This will allow mirroring
b/w implicit and defined radosnamespace.

Signed-off-by: subhamkrai <srai@redhat.com>
2025-04-01 10:46:06 +05:30
Joshua Hoblitt 3cb343f62a core: run gofumpt on all files
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-03-26 10:41:48 -07:00
subhamkrai a25c57397e csi: add csi-op api in unit tests
let's just add csi-op unit tests in rns and svg
we'll add more code in future.

Signed-off-by: subhamkrai <srai@redhat.com>
2025-03-21 06:42:37 +05:30
subham rai 012428dc3a Merge pull request #15529 from subhamkrai/external-mode-csi-op
csi: create csi operator resources in external mode
2025-03-18 21:16:58 +05:30
subhamkrai 8ffb80f3d7 csi: create csi operator resources in external mode
today, csi operator cephConnection and client profile
CR's where not getting created in external mode. So, let's
start creating those.

Signed-off-by: subhamkrai <srai@redhat.com>
2025-03-18 15:16:02 +05:30
Artem Torubarov 0b2e830111 mon: support external mons in local rook cluster
Implements #14733. Allows to set IDs of external mons to
Cluster CRD. Rook will not remove external mons from quorum
and will add external mon addresses to mon endpoints.
Use-case for external mon is to maintain quorum for 2-AZ
k8s cluster in case of zone outage.

Signed-off-by: Artem Torubarov <artem.torubarov@clyso.com>
2025-03-03 14:49:39 +01:00
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
Travis Nielsen 2002d9c93d Merge pull request #15027 from parth-gr/external-radosnamespace
external: fix detect job in radosnamespace controller
2024-11-21 08:10:15 -07:00
parth-gr a484ff7d96 external: fix detect job in radosnamespace controller
in external mode deployments ceph iamge is not provided
and job keeps on failing to get the cephversion
fix by checking  if ceph iamge is available

Signed-off-by: parth-gr <partharora1010@gmail.com>
2024-11-21 16:42:55 +05:30
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