Commit Graph
201 Commits
Author SHA1 Message Date
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
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
Blaine Gardner 7a4cf8d93c Merge pull request #14819 from BlaineEXE/holder-pods-remove-config
multus: finish deprecating holder pods
2024-10-24 10:55:02 -06:00
Blaine Gardner 5539eedd1b multus: finish deprecating holder pods
Finish the process of deprecating holder pods by removing Rook's ability
to deploy them. The intent of this change is to make the most
superficial changes possible to accomplish this. There are still
remnants of code in Rook (particularly the CSI controller) that helped
configure or deploy holder pods. Due to the risk of breaking some
features, cleanup work of hose remnants will be deferred for future
work.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
2024-10-23 16:29:02 -06:00
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