parallax

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2025 License: MIT

README ΒΆ

🌌 Parallax Operator

GitHub Release CI/CD Pipeline codecov Go Report Card

Container Images Helm Charts Kubernetes Go Version

Dynamic parallel execution for Kubernetes workloads

Transform any list into parallel, scalable Jobs with enterprise-grade reliability

πŸš€ Quick Start β€’ πŸ“– Documentation β€’ πŸ’‘ Examples β€’ 🀝 Community


✨ What is Parallax?

Parallax is a production-ready Kubernetes operator that enables dynamic, list-driven parallel execution of Jobs and CronJobs. It abstracts away the complexity of sharding workloads over a list of inputs β€” whether from APIs, databases, or static lists β€” and manages concurrency, indexing, and job orchestration transparently.

🎯 Key Features
Feature Description Benefits
πŸ”„ Dynamic Data Sources REST APIs, PostgreSQL, Static Lists Real-time data processing
⚑ Parallel Execution Configurable concurrency with indexed jobs Faster processing, better resource utilization
πŸ“… Cron Scheduling Built-in cron scheduling with concurrency policies Automated recurring workflows
πŸ”’ Enterprise Security RBAC, signed images, vulnerability scanning Production-ready security
πŸ“Š Multi-Platform linux/amd64, linux/arm64 support Run anywhere
πŸŽ›οΈ Flexible Configuration Environment variables, resource limits, custom templates Fits any use case
πŸ—οΈ Architecture Overview
graph TB
    subgraph "Data Sources"
        A1[🌐 REST APIs]
        A2[πŸ—„οΈ PostgreSQL]  
        A3[πŸ“ Static Lists]
    end
    
    subgraph "Parallax Operator"
        B1[ListSource Controller]
        B2[ListJob Controller]
        B3[ListCronJob Controller]
    end
    
    subgraph "Kubernetes Resources"
        C1[πŸ“¦ ConfigMaps]
        C2[βš™οΈ Jobs]
        C3[⏰ CronJobs]
        C4[πŸƒβ€β™‚οΈ Pods]
    end
    
    A1 --> B1
    A2 --> B1  
    A3 --> B1
    B1 --> C1
    C1 --> B2
    C1 --> B3
    B2 --> C2
    B3 --> C3
    C2 --> C4
    C3 --> C4
    
    style B1 fill:#e1f5fe
    style B2 fill:#e1f5fe
    style B3 fill:#e1f5fe
    style C1 fill:#f3e5f5
    style C2 fill:#e8f5e8
    style C3 fill:#fff3e0
🚦 How It Works
  1. πŸ“‹ ListSource fetches your data and creates a ConfigMap with items
  2. πŸ”€ ListJob reads the ConfigMap and creates parallel Kubernetes Jobs
  3. ⏰ ListCronJob schedules ListJobs to run on cron schedules
  4. πŸƒβ€β™‚οΈ Each Job processes one item with the item available as an environment variable

πŸš€ Quick Start

Prerequisites
  • Kubernetes 1.20+ cluster
  • Helm 3.0+ (recommended)
  • kubectl configured
Installation
# Step 1: Install CRDs first
helm install parallax-crds \
  https://github.com/matanryngler/parallax/releases/latest/download/parallax-crds-0.1.0.tgz

# Step 2: Install the operator
helm install parallax \
  https://github.com/matanryngler/parallax/releases/latest/download/parallax-0.1.0.tgz

# Or customize the operator installation
helm install parallax \
  https://github.com/matanryngler/parallax/releases/latest/download/parallax-0.1.0.tgz \
  --set replicaCount=2 \
  --set resources.limits.memory=512Mi
Option 2: Local Charts

For development or when you have the repository cloned:

# Install CRDs
helm install parallax-crds ./charts/parallax-crds

# Install operator
helm install parallax ./charts/parallax
Verify Installation
# Check if the operator is running
kubectl get deployment parallax -n parallax-system

# Verify CRDs are installed
kubectl get crd | grep batchops.io

πŸ’‘ Examples

Example 1: Process API Results
# Create a ListSource that fetches user IDs from an API
apiVersion: batchops.io/v1alpha1
kind: ListSource
metadata:
  name: user-api-source
spec:
  type: api
  intervalSeconds: 300  # Refresh every 5 minutes
  api:
    url: "https://jsonplaceholder.typicode.com/users"
    jsonPath: "$[*].id"
    headers:
      Content-Type: "application/json"
---
# Process each user ID in parallel
apiVersion: batchops.io/v1alpha1
kind: ListJob
metadata:
  name: process-users
spec:
  listSourceRef: user-api-source
  parallelism: 5
  template:
    image: curlimages/curl:latest
    command: 
      - "sh"
      - "-c"
      - "echo 'Processing user $USER_ID' && curl -s https://jsonplaceholder.typicode.com/users/$USER_ID"
    envName: USER_ID
    resources:
      requests:
        cpu: "100m"
        memory: "128Mi"
      limits:
        cpu: "500m"
        memory: "256Mi"
Example 2: Database-Driven Processing
# Secret for database credentials
apiVersion: v1
kind: Secret
metadata:
  name: postgres-credentials
type: Opaque
stringData:
  username: "myuser" 
  password: "mypassword"
---
# ListSource that queries PostgreSQL
apiVersion: batchops.io/v1alpha1
kind: ListSource
metadata:
  name: database-source
spec:
  type: postgresql
  intervalSeconds: 600  # Refresh every 10 minutes
  postgres:
    connectionString: "host=postgres.example.com port=5432 dbname=mydb sslmode=require"
    query: "SELECT order_id FROM orders WHERE status = 'pending' ORDER BY created_at"
    auth:
      secretRef:
        name: postgres-credentials
        key: password
      passwordKey: password
---
# Process each pending order
apiVersion: batchops.io/v1alpha1  
kind: ListJob
metadata:
  name: process-orders
spec:
  listSourceRef: database-source
  parallelism: 10
  template:
    image: my-order-processor:latest
    command: ["./process-order"]
    envName: ORDER_ID
    resources:
      requests:
        cpu: "200m"
        memory: "256Mi"
Example 3: Scheduled Processing
# Daily processing of a static list
apiVersion: batchops.io/v1alpha1
kind: ListCronJob
metadata:
  name: daily-reports
spec:
  schedule: "0 2 * * *"  # Every day at 2 AM
  parallelism: 3
  template:
    image: my-report-generator:latest
    command: ["./generate-report"]
    envName: REPORT_TYPE
    resources:
      requests:
        cpu: "500m"
        memory: "1Gi"
  staticList:
    - "sales-report"
    - "inventory-report" 
    - "customer-report"
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 5
  failedJobsHistoryLimit: 2

πŸ“Š Performance & Scalability

Benchmarks
Metric Value Notes
Max Concurrent Jobs 1000+ Limited by cluster resources
Items per Second 500+ Depends on job complexity
Memory Usage ~128Mi Operator base memory
CPU Usage ~100m Operator base CPU
Startup Time <30s Time to process first job
Resource Requirements
Component Minimum Recommended Max Tested
CPU 100m 500m 2 cores
Memory 128Mi 256Mi 1Gi
Jobs 1 50 1000+

πŸ”§ Configuration

ListSource Types
πŸ“‘ REST API Configuration
spec:
  type: api
  api:
    url: "https://api.example.com/items"
    jsonPath: "$.data[*].id"  # JSONPath to extract items
    headers:                  # Custom headers
      Authorization: "Bearer token"
      Content-Type: "application/json"
    auth:                     # Optional authentication
      type: bearer            # or 'basic'
      secretRef:
        name: api-credentials
        key: token
πŸ—„οΈ PostgreSQL Configuration
spec:
  type: postgresql
  postgres:
    connectionString: "host=db.example.com port=5432 dbname=mydb"
    query: "SELECT id FROM items WHERE processed = false"
    auth:
      secretRef:
        name: db-credentials
        key: password
      passwordKey: password
πŸ“ Static List Configuration
spec:
  type: static
  staticList:
    - "item-1"
    - "item-2"
    - "item-3"
Environment Variables
Variable Description Default
METRICS_BIND_ADDRESS Metrics server address :8080
LEADER_ELECT Enable leader election false
LOG_LEVEL Log level (debug, info, warn, error) info
NAMESPACE Watch specific namespace All namespaces

πŸ“– Documentation

Resource Description
πŸ“š User Guide Complete usage documentation
πŸ”§ Installation Guide Detailed installation options
πŸ‘©β€πŸ’» API Reference CRD specifications
🀝 Contributing How to contribute
πŸš€ Changelog Release notes

πŸ› οΈ Development

Local Development
# Clone the repository
git clone https://github.com/matanryngler/parallax.git
cd parallax

# Install dependencies and run tests  
make ci-quick

# Build the operator
make build

# Run locally (requires kubeconfig)
make run
Testing
# Unit tests with coverage
make test

# E2E tests (creates isolated Kind cluster)
make test-e2e

# All CI checks locally (matches GitHub Actions exactly)
make ci-all
Pre-commit Validation
# Run the same checks as CI
./scripts/pre-commit.sh

πŸ“Š Monitoring & Observability

Prometheus Metrics

The operator exposes comprehensive metrics for monitoring:

# Items processed by ListSource
parallax_listsource_items_total{name="my-source", namespace="default", type="api"}

# Job execution duration
parallax_listjob_duration_seconds{name="my-job", namespace="default"}

# Error counters
parallax_errors_total{controller="listsource", error_type="fetch_failed"}
Health Checks
# Health endpoint
curl http://localhost:8081/healthz

# Readiness endpoint  
curl http://localhost:8081/readyz

# Metrics endpoint
curl http://localhost:8080/metrics

πŸ”’ Security

Container Security
  • βœ… Signed Images: All images signed with Cosign
  • βœ… SBOM Included: Software Bill of Materials for compliance
  • βœ… Vulnerability Scanning: Regular scans with Trivy
  • βœ… Minimal Base Images: Distroless images for reduced attack surface
Kubernetes Security
  • βœ… RBAC: Minimal required permissions only
  • βœ… NetworkPolicies: Secure network communications
  • βœ… PodSecurityStandards: Restricted pod security context
  • βœ… Secret Management: Secure handling of credentials
Verify Image Signatures
# Verify the container image signature (replace v1.2.3 with actual version)
cosign verify ghcr.io/matanryngler/parallax:v1.2.3 \
  --certificate-identity "https://github.com/matanryngler/parallax/.github/workflows/release.yml@refs/tags/v1.2.3" \
  --certificate-oidc-issuer "https://token.actions.githubusercontent.com"

🀝 Community

Getting Help
Contributing

We welcome contributions! Here's how to get started:

  1. 🍴 Fork the repository
  2. 🌟 Star the project (helps others discover it!)
  3. πŸ”§ Create a feature branch: git checkout -b feature/my-feature
  4. πŸ“ Commit your changes: git commit -am 'Add my feature'
  5. πŸ“€ Push to the branch: git push origin feature/my-feature
  6. πŸ”„ Create a Pull Request
Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.


πŸ“ˆ Roadmap

Current Version (v0.1.x)
  • βœ… Core ListSource, ListJob, ListCronJob functionality
  • βœ… REST API and PostgreSQL data sources
  • βœ… Multi-platform container images
  • βœ… Helm charts and comprehensive testing
Upcoming (v0.2.x)
  • πŸ”„ MySQL and MongoDB data sources
  • πŸ”„ Webhook-triggered jobs
  • πŸ”„ Advanced scheduling policies
  • πŸ”„ Grafana dashboards
Future (v1.0.x)
  • πŸ”„ Job dependency management
  • πŸ”„ Advanced retry strategies
  • πŸ”„ Multi-cluster support
  • πŸ”„ Plugin architecture

πŸ“Š Project Stats

GitHub stars GitHub forks GitHub watchers

Star History Chart


πŸ“ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


Made with ❀️ by the Parallax community

⭐ Star this project β€’ πŸ› Report Issues β€’ πŸ’¬ Join Discussions

Directories ΒΆ

Path Synopsis
api
v1alpha1
Package v1alpha1 contains API Schema definitions for the batchops v1alpha1 API group.
Package v1alpha1 contains API Schema definitions for the batchops v1alpha1 API group.
internal
test

Jump to

Keyboard shortcuts

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