Add validation to require at least one RabbitMQ instance#1820
Add validation to require at least one RabbitMQ instance#1820lmiccini wants to merge 1 commit intoopenstack-k8s-operators:mainfrom
Conversation
This commit adds webhook validation to ensure that when RabbitMQ is enabled (spec.rabbitmq.enabled: true), at least one RabbitMQ instance must be defined in spec.rabbitmq.templates. Previously, the validation only checked the boolean flag (spec.rabbitmq.enabled) without verifying that actual RabbitMQ instances were configured. This allowed invalid configurations where services requiring RabbitMQ could pass validation but would fail at runtime when trying to create TransportURLs to non-existent clusters. Changes: - ValidateCreateServices: Reject creation when rabbitmq.enabled is true but templates is nil or empty - ValidateUpdateServices: Reject updates that remove all instances while RabbitMQ remains enabled - Allow disabling RabbitMQ and removing all instances in the same update operation - Add 7 comprehensive test cases covering CREATE and UPDATE scenarios The validation provides a clear error message: "At least one RabbitMQ instance must be defined when rabbitmq is enabled" Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lmiccini The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/test functional |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@lmiccini: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
This commit adds webhook validation to ensure that when RabbitMQ is enabled (spec.rabbitmq.enabled: true), at least one RabbitMQ instance must be defined in spec.rabbitmq.templates.
Previously, the validation only checked the boolean flag (spec.rabbitmq.enabled) without verifying that actual RabbitMQ instances were configured. This allowed invalid configurations where services requiring RabbitMQ could pass validation but would fail at runtime when trying to create TransportURLs to non-existent clusters.
Changes:
The validation provides a clear error message:
"At least one RabbitMQ instance must be defined when rabbitmq is enabled"