Skip to content

Repository files navigation

FlowOps - GitOps for Kubernetes Operators

Transform any workflow into a production-grade Kubernetes operator without writing code.

FlowOps is a Kubernetes operator platform that enables building operators using declarative YAML workflows instead of writing Go code. Define your operator logic as simple workflow steps, and FlowOps handles the rest.

Features

  • Declarative Workflows: Define operators using YAML workflows, no Go code required
  • Dynamic Controller Spawning: Automatically creates and manages controllers for each Flow
  • Built-in Step Executors: kubectl, script (bash/python), template (Helm/Kustomize), HTTP
  • Advanced Error Handling: Configurable retry policies, exponential backoff, conditional retries
  • Template System: Go template-based variable substitution with access to resource fields
  • Hot Reloading: Update Flows without restarting the controller
  • GitOps Ready: Version control your operator definitions alongside your infrastructure

Quick Start

Prerequisites

  • Kubernetes 1.20+
  • kubectl configured

Installation

# Install FlowOps engine
kubectl apply -k config/default
# Verify installation
kubectl get pods -n flowops-system

Create Your First Operator

  1. Define a target CRD (the resource your operator will manage):
# database-crd.yamlapiVersion: apiextensions.k8s.io/v1kind: CustomResourceDefinitionmetadata:
name: databases.example.comspec:
group: example.comnames:
kind: Databaseplural: databasesscope: Namespacedversions:
- name: v1served: truestorage: trueschema:
openAPIV3Schema:
type: objectproperties:
spec:
type: objectproperties:
engine:
type: stringreplicas:
type: integer
  1. Create a Flow (your operator logic):
# database-flow.yamlapiVersion: flowops.io/v1kind: Flowmetadata:
name: database-operatorspec:
watch:
apiVersion: example.com/v1kind: Databasereconcile:
steps:
- name: create-statefulsettype: kubectlaction: applymanifests: | apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ .Resource.metadata.name }} namespace: {{ .Resource.metadata.namespace }} spec: serviceName: {{ .Resource.metadata.name }} replicas: {{ .Resource.spec.replicas }} selector: matchLabels: app: {{ .Resource.metadata.name }} template: metadata: labels: app: {{ .Resource.metadata.name }} spec: containers: - name: database image: {{ .Resource.spec.engine }}:latest
  1. Deploy and test:
# Install the CRD
kubectl apply -f database-crd.yaml
# Install the Flow
kubectl apply -f database-flow.yaml
# Create a database instance
kubectl apply -f - <<EOFapiVersion: example.com/v1kind: Databasemetadata: name: my-postgresspec: engine: postgres replicas: 3EOF# Watch your operator in action
kubectl get flows
kubectl get databases
kubectl get statefulsets

Architecture

┌─────────────────────────────────────────────────────────────┐
│ FlowOps Engine │
├─────────────────────────────────────────────────────────────┤
│ Flow Watcher (Meta-Controller) │
│ ↓ │
│ Flow Registry │
│ ↓ │
│ Dynamic Controller Manager │
│ ↓ │
│ Workflow Execution Engine │
│ ↓ │
│ Step Executors (kubectl, script, template, http) │
└─────────────────────────────────────────────────────────────┘

Core Concepts

Flow CRD

A Flow defines:

  • watch: Which Kubernetes resource to watch
  • reconcile: Workflow steps to execute on changes
  • onDelete: Cleanup steps when resource is deleted (optional)
  • onError: Error handling workflow (optional)

Step Types

kubectl

Execute Kubernetes operations:

- name: apply-resourcestype: kubectlaction: applymanifests: | # Your Kubernetes manifests here

script

Run bash or python scripts:

- name: validatetype: scriptscript: | #!/bin/bash if [[ {{ .Resource.spec.replicas }} -lt 1 ]]; then echo "ERROR: replicas must be >= 1" exit 1 fi

template

Render Helm charts or Kustomize:

- name: render-charttype: templateengine: helmchart: ./charts/my-appvalues:
replicas: {{ .Resource.spec.replicas }}

http

Make HTTP requests:

- name: webhooktype: httpurl: https://api.example.com/provisionmethod: POSTbody:
name: {{ .Resource.metadata.name }}

Templating

Access resource fields in your workflows:

# Resource metadata{{ .Resource.metadata.name }}{{ .Resource.metadata.namespace }}# Resource spec{{ .Resource.spec.replicas }}{{ .Resource.spec.engine }}# Step outputs{{ steps.previous-step.outputs.key }}# Current time{{ .Now }}

Error Handling

Configure retry behavior per step:

steps:
- name: create-resourcetype: kubectlaction: applymanifests: | # ...errorHandling:
type: retryable # permanent | temporary | retryablemaxRetries: 5backoff: exponential # fixed | linear | exponentialretryDelay: "1s"timeout: "5m"retryOn:
- statusCode: 429# Retry on rate limit
- statusCode: 503# Retry on service unavailablefailOn:
- statusCode: 400# Don't retry bad requests

kubectl Commands

# List Flows
kubectl get flows
kubectl get fl # short form# Describe a Flow
kubectl describe flow database-operator
# View FlowOps engine logs
kubectl logs -n flowops-system -l app=flowops-engine --tail=100 -f
# Edit a Flow (hot-reload)
kubectl edit flow database-operator
# Delete a Flow
kubectl delete flow database-operator

Examples

Check out the examples/ directory for complete operator examples:

  • database-operator: Simple database operator using StatefulSets
  • More examples coming soon!

Development

Building from Source

# Clone repository
git clone https://github.com/flowops-io/flowops-engine.git
cd flowops-engine
# Install dependencies
go mod download
# Build binary
make build
# Run tests
make test# Build Docker image
make docker-build IMG=flowops-engine:dev

Local Development

# Install CRDs
make install
# Run controller locally (against your kubeconfig cluster)
make run
# Deploy to cluster
make deploy IMG=flowops-engine:dev
# Undeploy
make undeploy

Testing Examples

# Deploy database operator example
make example-db
# Create test database
make example-db-test
# Clean up
make example-db-clean

Project Structure

flowops-engine/
├── cmd/manager/ # Main entry point
├── pkg/
│ ├── apis/flow/v1/ # Flow CRD types
│ ├── controller/ # Meta-controller and dynamic controllers
│ ├── registry/ # Flow registry
│ ├── engine/ # Workflow execution engine
│ ├── executor/ # Step executors
│ └── utils/ # Utilities
├── config/
│ ├── crd/ # CRD manifests
│ ├── rbac/ # RBAC configurations
│ ├── manager/ # Deployment manifests
│ └── default/ # Kustomize config
├── examples/ # Example operators
├── Makefile # Build automation
└── Dockerfile # Container image

Roadmap

v0.1.0 - MVP (Current)

  • ✅ Core Flow CRD
  • ✅ Dynamic controller spawning
  • ✅ Basic executors: kubectl, script
  • ✅ Simple error handling and retries
  • ✅ Basic templating system

v0.2.0 - Enhanced Executors

  • template executor (Helm, Kustomize)
  • http executor
  • Advanced error handling (retryOn, failOn)
  • Step outputs and chaining
  • Conditional step execution

v0.3.0 - Production Ready

  • Comprehensive validation
  • Metrics and observability (Prometheus)
  • Flow admission webhooks
  • Performance optimizations
  • HA support (leader election)

Future

  • Visual Flow editor (UI)
  • Plugin system for custom executors
  • GitOps integration (Argo CD, Flux)
  • Multi-cluster support

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

Apache License 2.0

Support


FlowOps - Making Kubernetes operators as simple as YAML workflows

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages