Skip to content

Conversation

@Zerpet
Copy link
Member

@Zerpet Zerpet commented Jan 14, 2026

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

Summary Of Changes

  • Plugin completely re-written in Go
  • Updated CI to build the plugin binaries and attach to release

Additional Context

The kubectl plugin is its own Go module. The cluster-operator version is always the local repo (observe the replace directive in Go mod). There are integration tests that create rabbits in a local Kubernetes(KinD). The coverage shows a sad 30%, however, it's not considering the statement hits by the integration tests, because those build the binary and call it via os.Exec; this dodges the coverage accounting.

The command to create rabbits has been extended to cover almost any possible option in the spec. The override is left out, because that feature is too complex to support in a CLI flag.

Local Testing

Make sure you cd into the plugin directory: cd bin/kubectl-rabbitmq-plugin/

To run unit tests: make tests

To run all tests, including integration: make tests TEST_TAGS="integration"
Make sure you have a Kubernetes environment accessible in your current kubectl context.

This commit adds a first version of kubectl-rabbitmq plugin. This is an
effort to move away from the Bash version of kubectl-rabbitmq, which has
some limitations and known quirks.
Because otherwise tests may take up to the timeout to fail
This commit also updates the default installation to use GHCR
Adding additional coverage, and more flexibility to run
tests via Makefile
The plugin is now a Go application. It has its own Go tests and build
system. The plugin version is aligned with the cluster operator version.
Because the cli is single-module, and its code is not reusable by
external programs.
@Zerpet Zerpet force-pushed the rewrite-kubectl-plugin branch from be18696 to 04e114c Compare January 14, 2026 11:20
@Zerpet Zerpet force-pushed the rewrite-kubectl-plugin branch from 04e114c to b0a2df7 Compare January 14, 2026 11:49
@Zerpet Zerpet marked this pull request as ready for review January 14, 2026 12:10
@Zerpet Zerpet added this to the v2.20.0 milestone Jan 14, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR rewrites the kubectl-rabbitmq plugin from Bash to Go, providing a more maintainable and testable codebase with comprehensive command coverage.

Changes:

  • Complete rewrite of kubectl plugin from Bash shell script to Go using cobra framework
  • Added comprehensive unit and integration test coverage
  • Updated CI/CD pipeline to build and release cross-platform binaries (darwin/linux, amd64/arm64)

Reviewed changes

Copilot reviewed 2 out of 18 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
bin/kubectl-rabbitmq-plugin/main.go New Go entry point with cobra command structure
bin/kubectl-rabbitmq-plugin/commands.go Implements all plugin commands (create, list, delete, manage, etc.)
bin/kubectl-rabbitmq-plugin/kubectl.go Kubectl command executor with namespace handling
bin/kubectl-rabbitmq-plugin/cluster.go RabbitMQ cluster building and YAML generation
bin/kubectl-rabbitmq-plugin/jobs.go Performance test job creation
bin/kubectl-rabbitmq-plugin/credentials.go Credential fetching from Kubernetes secrets
bin/kubectl-rabbitmq-plugin/*_test.go Comprehensive unit and integration tests
bin/kubectl-rabbitmq-plugin/go.mod Go module definition with dependencies
bin/kubectl-rabbitmq-plugin/Makefile Build and test automation
bin/kubectl-rabbitmq Removed old Bash implementation
bin/kubectl-rabbitmq.bats Removed old Bash tests
hack/rabbitmq.yaml Updated krew plugin manifest for binary distribution
.github/workflows/build-test-publish.yml CI pipeline updates for building and releasing plugin

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@MirahImage MirahImage left a comment

Choose a reason for hiding this comment

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

My one recommendation would be to include a dependabot group for the kubectl-rabbitmq-plugin. Otherwise, looks good

@Zerpet Zerpet merged commit 2bc5b86 into main Jan 15, 2026
84 of 88 checks passed
@Zerpet Zerpet deleted the rewrite-kubectl-plugin branch January 15, 2026 11:40
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.

3 participants