Maestro is an opinionated framework designed to streamline the orchestration of reconcilers within the Kubernetes ecosystem. By adopting a clear and structured approach, Maestro simplifies the registration, execution, and management of reconcilers, enabling developers to focus on the core logic of their applications without getting bogged down by the intricacies of Kubernetes resource management. 🚀
- 🎉 Simple and intuitive API for building reconcilers
- 🔍 Supports generic parent and child objects that implement
the
client.Objectinterface - 🏗️ Provides a fluent builder pattern for constructing reconcilers with ease
- 🎯 Offers customizable predicate functions to control reconciliation behavior
- 🔗 Supports optional owner references for child objects
- 🏃♂️ Enables dry-run mode for avoiding unnecessary requeues and optimizing performance
- 🔄 Allows customization of object comparison options to avoid unnecessary updates
- 🗑️ Supports deletion of child objects based on custom conditions
- 🔧 Integrates with the Conductor package for advanced status condition handling
- Go 1.18 or higher
- Kubernetes cluster
controller-runtimelibrary
To install Maestro, use the following command:
go get github.com/ethan-gallant/maestroHere's a minimal example of how to use the Simple Reconciler package to reconcile a child object for a parent object:
package main
import (
"context"
"github.com/ethan-gallant/maestro/pkg/reconciler/simple"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func podReconcileFunc(ctx context.Context, deployment *appsv1.Deployment) (*corev1.Pod, error) {
return &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: deployment.Name + "-pod",
Namespace: deployment.Namespace,
Labels: deployment.Spec.Template.Labels,
},
Spec: deployment.Spec.Template.Spec,
}, nil
}
func newPodReconciler() *simple.Reconciler[*appsv1.Deployment, *corev1.Pod] {
return simple.FromReconcileFunc(podReconcileFunc).
WithDetails(api.Descriptor{
Name: "PodReconciler",
Description: "Reconciles Pod for Deployment",
}).
Build()
}For more detailed examples and usage instructions, please refer to the Simple Reconciler Package README.
The Conductor is a generic interface that facilitates the registration and coordination of reconcilers. It acts as the central hub through which all reconcilers are managed. For more information, see the Conductor Package README.
The Reconciler is an interface defining the essential method Reconcile, which encapsulates the logic for reconciling
the state of a Kubernetes resource. Maestro provides a Simple Reconciler implementation in
the Simple Reconciler Package.
The Binder package provides a convenient way to bind and retrieve values from a context.Context using static or
dynamic keys. It offers a type-safe and flexible approach to store and access custom data within a context. For more
information, see the Binder Package README.
For detailed documentation and examples, please refer to the individual package READMEs:
We welcome contributions to Maestro! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request. For more information, see the Contributing Guide.
Maestro is released under the MIT License.
Happy orchestrating with Maestro! 🎉