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
|
[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 |
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>
d85d9b2 to
cc45b15
Compare
OpenStackControlPlane CRD Size Report
Threshold reference
|
|
Build failed (check pipeline). Post https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/ae0bd4b8523d41ad90f6cf9915555322 ❌ openstack-k8s-operators-content-provider FAILURE in 3m 59s |
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"