Skip to content

Conversation

Zerpet
Copy link
Member

@Zerpet Zerpet commented Oct 15, 2025

This closes #1018

Note to reviewers: remember to look at the commits in this PR and consider if they can be squashed

Summary Of Changes

The RabbitMQ operator now respects default_user and default_pass
values provided in the additionalConfig field of the RabbitmqCluster
manifest when creating the default user secret. Previously, the operator
would generate random credentials, leading to mismatches and confusion.

This change modifies the Build function in
internal/resource/default_user_secret.go to parse the additionalConfig
string. If default_user and default_pass are present, their values
are used. Otherwise, random credentials are generated, maintaining backward
compatibility.

Unit tests in internal/resource/default_user_secret_test.go and
integration tests in controllers/rabbitmqcluster_controller_test.go have
been added to verify this behavior.

Local Testing

Unit and integration tests passing.

$ make unit-tests integration-tests

The RabbitMQ operator now respects `default_user` and `default_pass`
values provided in the `additionalConfig` field of the `RabbitmqCluster`
manifest when creating the default user secret. Previously, the operator
would generate random credentials, leading to mismatches and confusion.

This change modifies the `Build` function in
`internal/resource/default_user_secret.go` to parse the `additionalConfig`
string. If `default_user` and `default_pass` are present, their values
are used. Otherwise, random credentials are generated, maintaining backward
compatibility.

Unit tests in `internal/resource/default_user_secret_test.go` and
integration tests in `controllers/rabbitmqcluster_controller_test.go` have
been added to verify this behavior.
@Zerpet Zerpet added this to the 2.18.0 milestone Oct 15, 2025
@Zerpet Zerpet changed the title Fix: consider additional config for default user creds DO NOT MERGE - Fix: consider additional config for default user creds Oct 15, 2025
@Zerpet
Copy link
Member Author

Zerpet commented Oct 15, 2025

Hold merge until we have produced 2.17.0

Copy link
Contributor

@mkuratczyk mkuratczyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks. My only worry is the compatibility of the ini format as used by RabbitMQ vs github.com/go-ini/ini/. If I'm not mistaken, with this change, we now require additionalConfig to pass go-ini validation, which was not the case before. I'm sure it it will work in most cases, but I don't know about the compatibility of ini formats with more complex content

@Zerpet Zerpet changed the title DO NOT MERGE - Fix: consider additional config for default user creds Fix: consider additional config for default user creds Oct 17, 2025
@Zerpet
Copy link
Member Author

Zerpet commented Oct 17, 2025

That's an interesting point I hadn't consider 🤔 It's always possible to fallback to advanced config. Undesirable, but go-ini validation won't block any user completely. Happy to hold if you want to try to break this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

user secret not updated when creating cluster with default_user config

2 participants