Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to reconciliation loop using controller-runtime #208

Merged

Conversation

adriandieter
Copy link

@adriandieter adriandieter commented Dec 2, 2024

Based on the sattwood/codegen_update branch. Once it gets merged, this branch can be rebased onto main. (Diff without those changes)

This adds the foundation to migrate to a full control-loop using the controller-runtime.

Adds a config flag control-loop to use the alternative implementation. Setting this flag to true executes runControlLoop instead of the regular main function.

Adds empty controllers for accounts, consumers and streams in internal/controller. These come with a test suite with an envtest control-plane and a jetStream server to test against. The Reconcile functions of these controllers need to be implemented to add functionality.

Updates the rbac.yml to include the update permission for the streams/finalizers, consumers/finalizers and accounts/finalizers resources.

Removes the kubeconfig flag and instead uses ctrl.RegisterFlags(fs)
 and ctrl.GetConfig(). The controller-runtime currently registers the kubeconfig flag, which lead to a redefined flag error when registering it again.
This is based on the Makefile of an operator-sdk based project.
Controllers and tests are based on files generated by operator-sdk.
Adds a minimal test suite for the controllers with a etcd test env and a test nats jetStream server to test against.
@adriandieter adriandieter changed the base branch from main to feature/controller-runtime December 9, 2024 15:46
@adriandieter adriandieter marked this pull request as ready for review December 9, 2024 15:47
Copy link
Member

@samuelattwood samuelattwood left a comment

Choose a reason for hiding this comment

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

WIP - Approved to merge to feature branch

@samuelattwood samuelattwood merged commit 42f8cfe into nats-io:feature/controller-runtime Dec 9, 2024
2 of 3 checks passed
samuelattwood pushed a commit that referenced this pull request Dec 9, 2024
* Setup optional controller-runtime manager in main

Removes the kubeconfig flag and instead uses ctrl.RegisterFlags(fs)
 and ctrl.GetConfig(). The controller-runtime currently registers the kubeconfig flag, which lead to a redefined flag error when registering it again.

* Add update permissions for resource finalizers

* Add envtest to Makefile

This is based on the Makefile of an operator-sdk based project.

* Update test to include envtest and run the internal/controller test suite

* Add account, consumer and stream controller stubs to be implemented

Controllers and tests are based on files generated by operator-sdk.
Adds a minimal test suite for the controllers with a etcd test env and a test nats jetStream server to test against.

* Add logs to Reconcile functions

* Add internal/controller to jetstreamSrc

* Register account, consumer and stream reconcilers

* Add jsClient to test suit variables

* Remove format from log string
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.

2 participants