Skip to content

LogicFlowDefinition Controller #6

Description

@ricardozanini

Goal

Implement controller to manage workflow definitions and ConfigMap updates

Phase: 1 (Months 1-2)

Scope

1. Core Reconciliation

  • Watch LogicFlowDefinition resources
  • Resolve LogicFlowRuntime from serviceRef → LogicFlowService → runtimeRef
  • Auto-create LogicFlowService if not exists
  • Update Runtime's ConfigMap with workflow YAML file

2. Workflow Document Construction

  • Extract workflow name from annotations["org.kubesmarts.logic/flow-name"]
  • Extract DSL version from annotations["logic.kubesmarts.io/dsl-version"]
  • Extract metadata (title, summary) from annotations
  • Extract tags from labels (filter logic.kubesmarts.io/*)
  • Merge with spec.definition to create complete SW document
  • Marshal to YAML and add to ConfigMap as <flow-name>-v<version>.yaml

3. ConfigMap Management

  • Find Runtime's ConfigMap (<runtime-name>-workflows)
  • Add/update workflow file in ConfigMap data
  • Trigger Runtime pod restart (update annotation checksum)

4. Status Management

  • Update status with activeInstances (placeholder for now)
  • Set phase (Active, Draining, Decommissioned)
  • Track runtimeRef in status

5. Validation Webhooks

  • ValidatingWebhook: Prevent deletion if activeInstances > 0
  • ValidatingWebhook: Validate org.kubesmarts.logic/flow-name annotation exists
  • ValidatingWebhook: Validate spec.definition immutability
  • ValidatingWebhook: Validate serviceRef exists

Deliverables

  • Controller implementation
  • Workflow document construction logic
  • ConfigMap update logic
  • Validation webhooks
  • Unit tests
  • Integration tests (envtest)

Dependencies: EPIC 2 (Runtime controller creates ConfigMap)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions