Skip to content

Conversation

@miguelmdh
Copy link

This closes #2017

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

Summary Of Changes

This PR introduces a new optional field, spec.persistence.emptyDir, allowing users to configure emptyDir volume properties when persistence is disabled (i.e., when spec.persistence.storage is set to "0").

This change addressed the need discussed in #2018. The primary goal is to protect host node's disk storage from being exhausted by a RabbitMQ instance, ensuring other workloads on the node are not negatively impacted.

Specifically, this PR adds:

  • A new RabbitmqClusterEmptyDirSpec struct nested under spec.persistence.
  • Fields for medium (defaulting to the node's default) and sizeLimit.
  • Logic to apply these configurations to the StatefulSet's volume templates when storage is "0" and emptyDir is defined.

Additional Context

It is important to note the behavioral difference regarding sizeLimit depending on the chosen medium:

  • Default Medium (Disk): Setting sizeLimit does not strictly limit the filesystem size visible to the application (e.g., via df -h or the RabbitMQ UI). Instead, the Kubelet monitors disk usage. If the Pod exceeds the sizeLimit, the Kubelet evicts the Pod, effectively clearing the data.
  • Memory Medium (tmpfs): When medium is set to Memory, Kubernetes mounts a tmpfs volume. In this case, the filesystem size is strictly limited to sizeLimit. The Pod cannot write beyond this limit, preventing eviction caused by usage spikes, though the application will receive "No space left on device" errors if it hits the limit.

Local Testing

Please ensure you run the unit, integration and system tests before approving the PR.

To run the unit and integration tests:

$ make unit-tests integration-tests

You will need to target a k8s cluster and have the operator deployed for running the system tests.

For example, for a Kubernetes context named dev-bunny:

$ kubectx dev-bunny
$ make destroy deploy-dev
# wait for operator to be deployed
$ make system-tests

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.

Allow setting sizeLimit when persistence disabled

1 participant