Commit Graph
664 Commits
Author SHA1 Message Date
Carlos Barria c63ebbe0e3 core: fix golangci-lint check ST1019
This change cleans up and standardizes import statements across the Ceph operator code. It removes redundant or duplicate imports and reorganizes alias names for improved clarity and consistency. Additionally, the ST1019 exception was removed from .golangci.yaml now that the code complies with the rule.

Signed-off-by: Carlos Barria <cbarria@yahoo.com>
2025-05-27 17:38:22 -04:00
Carlos Barria 030ada45b0 core: fix golangci-lint check QF1003 QF1002
Refactored multiple conditional if-else blocks into switch statements to improve readability and maintainability. Also removed outdated staticcheck rule comments (QF1002, QF1003) from .golangci.yaml.

Signed-off-by: Carlos Barria <cbarria@yahoo.com>
2025-05-27 13:49:49 -04:00
Carlos Barria 8afc4ee548 core: fix golangci-lint check QF1004
Signed-off-by: Carlos Barria <cbarria@yahoo.com>
2025-05-22 11:21:45 -04:00
Carlos Barria 61494d1baf core: fix golangci-lint check ST1005
Signed-off-by: Carlos Barria <cbarria@yahoo.com>
2025-05-19 17:52:22 -04:00
Santosh Pillai fe77108e1e rgw: fix do-not-reconcile label
fix do-not-reconcile label to prevent RGW deployment reconcile if
`ceph.rook.io/do-not-reconcile:<storeName>` is applied.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2025-05-12 16:59:56 +05:30
Joshua Hoblitt f1fad531eb object: change CephObjectStore "foo" found log level to debug
When multiple `CephObjectStoreUser` CRs are present, the operator logs a
high volume of `CephObjectStore "foo" found` messages during reconcile.

Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-05-08 09:28:19 -07:00
Artem Torubarov d5e4df2186 rgw: cleanup prev ops log config from mon db
Signed-off-by: Artem Torubarov <artem.torubarov@sap.com>
2025-04-30 10:00:14 +02:00
Artem Torubarov c1fd2f2ee8 rgw: use pod name in ops log filename
Signed-off-by: Artem Torubarov <artem.torubarov@sap.com>
2025-04-29 09:43:35 +02:00
Blaine Gardner 7a2e65f288 Merge pull request #15764 from BlaineEXE/notification-log-level-change
object: lower retry log verbosity in notification OBC controller
2025-04-22 10:54:00 -06:00
Blaine Gardner 08233d5b6d object: lower retry log verbosity in notification OBC controller
Lower the verbosity of a message in the notification controller's OBC
label watcher. If the OBC controller is having issues provisioning the
OBC, this log will spam every 10 seconds. Reduce the message verbosity
level to debug.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
2025-04-22 10:06:27 -06:00
Travis Nielsen 95a5920bef object: log all reconcile errors during object store creation
The object store controller was swallowing errors of the
type not found, assuming a certain category of errors
when ceph may still be initializing. But some of these
errors could be user error and they need to troubleshoot
the details of the error, so we need to log the specific
error instead of swallowing it.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2025-04-18 11:35:09 -06:00
Joshua Hoblitt 7887f03c5c object: add CephBucketTopic .spec.endpoint.kafka.{user,password}SecretRef
userSecretRef and passwordSecretRef fields are added to allow the Kafka
endpoint username and password to be supplied from a Kubernetes Secret,
rather than exposed as plaintext as part of the endpoint URI. If the
endpoint URI has HTTP basic auth user-id and user-pass components, they
are overridden by userSecretRef and passwordSecretRef.

Squid added bucket topic attributes for configuring the user-name and
password for pushing notifications to Kafka as an alternative to
encoding credentials into the URI. However, these attributes are not
supported under Reef. Thus, this initial implementation relies on URI
mangling for compatible with both Reef and Squid. Future work could
using Ceph version detection and switch to the new attributes to be used
with Squid and/or the implementation could be converted exclusively to
use the new attributes once Rook has dropped support for Reef.

Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-04-16 10:53:11 -07: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
Joshua Hoblitt 6b2c357871 object: add CephObjectStoreUser.spec.keys
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-04-03 09:09:01 -07:00
Blaine Gardner 85440169dd Merge pull request #15554 from ragnard/kafka-topic-params
rgw: Support Kafka auth mechanism parameter
2025-04-01 10:44:36 -06:00
Blaine Gardner e783264652 Merge pull request #15588 from sp98/rgw-client-location
rgw: RGW read affinity for localized reads
2025-03-31 09:26:20 -06:00
Santosh Pillai deb010c32e rgw: support read affinty for localized reads
allows selecting Read Affinity policy from the ObjectStore API
aets `--crush-location=host` for RGW daemons.

Signed-off-by: Santosh Pillai <sapillai@redhat.com>
2025-03-31 18:24:32 +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
Joshua Hoblitt dcf0a57d11 object: all CephBucketTopic reconcile errors set .status.phase
topic.reconcile() had a number of error triggered return statements
which did not update the CR's status to reflect a reconcile failure.

Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-03-25 09:52:37 -07:00
Blaine Gardner 20d85409ba Merge pull request #15498 from cobaltcore-dev/watch-rgw-config-secrets
Watch rgw config secrets
2025-03-25 09:33:50 -06:00
Ragnar Dahlén 8bf7c679bb rgw: support kafka auth mechanism parameter
Ceph has support [1,2] for configuring which authentication
mechanism to use for bucket notifications using Kafka topics.

This commit adds the corresponding support to rook.

[1]: https://github.com/ceph/ceph/pull/48181/commits/d5dce601f65974a21c83c4b1add036030a75c3c4
[2]: https://tracker.ceph.com/issues/57608

Signed-off-by: Ragnar Dahlén <r.dahlen@gmail.com>
2025-03-24 21:53:49 +01:00
Artem Torubarov e2f7caf193 rgw: simplify map secret func
Signed-off-by: Artem Torubarov <artem.torubarov@sap.com>
2025-03-21 16:11:34 +01:00
Joshua Hoblitt 01bbcf7857 object: all CephObjectStoreUser reconcile errors set .status.phase
objectuser.reconcile() had a number of error triggered return statements
which do not update the CR's status to reflect a reconcile failure.

Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-03-17 09:56:54 -07:00
Artem Torubarov dd0d500980 rgw: watch referenced secrets
Signed-off-by: Artem Torubarov <artem.torubarov@sap.com>
2025-03-17 14:09:05 +01:00
Artem Torubarov 00aa282074 rgw: use list in secret watch map func
Signed-off-by: Artem Torubarov <artem.torubarov@clyso.com>
2025-03-13 11:19:45 +01:00
Artem Torubarov bed0c23274 rgw: watch config secret changes
Implements #15460. If ObjectStore reading value from a secret
provided by user, the secret will be annotated with ObjectStore
name and ObjectStore will be reconciled on secret change.

Signed-off-by: Artem Torubarov <artem.torubarov@clyso.com>
2025-03-12 11:37:12 +01:00
Artem Torubarov 81d0f69aae object: change log level for config from secret
Signed-off-by: Artem Torubarov <artem.torubarov@clyso.com>
2025-03-03 14:48:55 +01:00
Artem Torubarov 3b2e6f5bf6 object: allow overriding rgw config value from secret
Implements #15422
Extends existing ObjectStore configuration options with
rgwConfigFromSecret allowing to refer config value from
kubernetes secret.

Signed-off-by: Artem Torubarov <artem.torubarov@clyso.com>
2025-03-03 14:48:55 +01:00
Travis NielsenandDmitry Mishin d109dc9029 core: implement operator settings as env vars
The operator settings loaded from the configmap have proven
inefficient for load time and frequently checking the configmap.
To avoid this ineffenciency, the configmap is only loaded once
each time it is created or updated. The values in the configmap
are applied as environment variables, which then are very efficient
to query throughout the various controllers, without needing
to be concerned about loading the configmap again.

Co-authored-by: Dmitry Mishin <dmitry.mishin@gmail.com>
Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
2025-02-24 12:12:45 -07:00
Blaine Gardner 73c931fc0a Merge pull request #15376 from BlaineEXE/obc-allow-list-obc-fields
object: disallow unsafe OBC fields by default
2025-02-19 12:00:54 -07:00
Blaine Gardner 0e33536539 object: disallow unsafe OBC fields by default
Implement an allow list mechanism that disables potentially unsafe OBC
fields by default. OBC fields beyond `maxObjects` and `maxSize` don't
neatly fit into the OBC framework as it was originally envisioned and
implemented.

Some of the newly added configs could allow users to cause confusion for
themselves. Others might allow users to hijack others buckets. Some
might allow bricking the entire S3 store.

Out of an abundance of safety, allow-list the known-safe options by
default, and require administrators to enable potentially troublesome
options via the new operator-level config
`ROOK_OBC_ALLOW_ADDITIONAL_CONFIG_FIELDS`.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
2025-02-12 14:18:01 -07:00
Joshua Hoblitt 37b7930e13 object: rm ReconcileObjectStoreUser.userConfig field
This field held state for a single reconciliation request, which
should not have been retrained / reused across multiple, possibly concurrent,
reconciliations.

Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-02-07 14:37:14 -07:00
Joshua Hoblitt 0eef85357a object: obc should not modify existing users
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-02-03 15:19:48 -07:00
Joshua Hoblitt 48a9b90642 object: add obc bucketOwner
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-01-31 08:48:41 -07:00
Blaine Gardner bcb1db361a Merge pull request #15255 from cobaltcore-dev/hostname-topology-label
Hostname topology label
2025-01-28 09:00:50 -07:00
Artem Torubarov 25ee6b4f59 operator: custom hostname topology label
Signed-off-by: Artem Torubarov <artem.torubarov@clyso.com>
2025-01-24 15:59:07 +01:00
Santosh Pillai e23e921f28 Merge pull request #15306 from sfackler/wait-for-secret
rgw: fix error handling for secret lookup
2025-01-24 12:06:39 +05:30
Joshua Hoblitt a55fdb3fbe object: add obc bucketLifecycle
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-01-21 16:01:37 -07:00
Joshua Hoblitt f52f48c477 ci: codespell: s/re-using/reusing/
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2025-01-21 15:11:33 -07:00
Steven Fackler 6935dfdc47 rgw: fix error handling for secret lookup
Get will return a non-nil pointer even in the error case.

Signed-off-by: Steven Fackler <sfackler@gmail.com>
2025-01-21 09:42:46 -05:00
Blaine Gardner ebd3c512b9 Merge pull request #15189 from BlaineEXE/test-fix-object-spec-test-added-flags
test: ignore rgw cli flag order in unit test
2024-12-17 12:41:16 -07:00
Blaine Gardner 37c3cc9fba test: ignore rgw cli flag order in unit test
In the unit test that ensures `rgwCommandFlags` works properly, ignore
the ordering of the flags. Golang maps are used underneath, which
results in random flag ordering. This is fine as long as the
`rgwCommandFlags` are still guaranteed to be appended to the args Rook
normally applies.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
2024-12-17 12:21:50 -07:00
Blaine Gardner dde609a9d4 Merge pull request #15185 from BlaineEXE/test-fix-flaky-unit
test: fix flaky object config unit test
2024-12-17 10:35:19 -07:00
Blaine Gardner 92c95fcc16 test: fix flaky object config unit test
Use testify/assert.Equal() to compare maps. Comparing string
representations of maps is supposed to be stable but is flaking in GH
actions CI.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
2024-12-17 10:12:04 -07:00
Deepika Upadhyay c5d27467d6 object: add rgw ops sidecar for op logs
the rgw operations for s3 can now be accessible using sidecar
rgw-ops-log availabe in json form that can be further filtered logging
for observability, this will set the rgw_enable_ops_log setting

Signed-off-by: Deepika Upadhyay <deepika.upadhyay@clyso.com>
2024-12-17 22:36:03 +05:30
Blaine Gardner aaa16488de object: allow overriding rgw configs and flags
Implement #15119

Allow users to override RGW configurations by specifying Ceph config
options in the CephObjectStore. For configurations that require RGW to
be restarted when the config is applied, allow configs to be specified
as CLI arguments to the RGW as well.

This is an advanced option and is documented as such. Users should be
careful to understand the values they are setting, as there is no
validation to prevent the object store from breaking when these configs
are used.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
2024-12-16 14:57:15 -07: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
Joshua Hoblitt 97b904c717 object: add obc bucketPolicy
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2024-12-12 13:36:26 -07:00
Joshua Hoblitt 57b7eeec80 object: add httpClient param to object.NewS3Agent()
To allow the caller to pass in their own transport when testing.

Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
2024-12-12 10:20:41 -07:00