maestro

module
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: MIT

README ΒΆ

Maestro 🎼

Go Report Card License

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. πŸš€

Features ✨

  • πŸŽ‰ Simple and intuitive API for building reconcilers
  • πŸ” Supports generic parent and child objects that implement the client.Object interface
  • πŸ—οΈ 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

Getting Started 🌟

Prerequisites
Installation

To install Maestro, use the following command:

go get github.com/ethan-gallant/maestro
Usage

Here'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.

Key Components πŸ”‘

Conductor πŸŽ›

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.

Reconciler πŸ”„

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.

Binder πŸ”—

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.

Documentation πŸ“š

For detailed documentation and examples, please refer to the individual package READMEs:

Contributing 🀝

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.

License πŸ“œ

Maestro is released under the MIT License.

Happy orchestrating with Maestro! πŸŽ‰

Directories ΒΆ

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL