apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
  name: simple-ha-flink-cluster
  namespace: freeleaps-data-platform
  labels:
    app: flink
    component: streaming
    cluster-type: simple-ha
spec:
  flinkVersion: v1_18
  image: flink:1.18
  flinkConfiguration:
    # Basic Configuration
    taskmanager.numberOfTaskSlots: "2"
    # High Availability Configuration (using ephemeral storage)
    high-availability.type: kubernetes
    high-availability.storageDir: file:///tmp/flink/ha-data
    # Checkpointing Configuration (using ephemeral storage)
    state.backend.type: filesystem
    state.checkpoints.dir: file:///tmp/flink/checkpoints
    state.savepoints.dir: file:///tmp/flink/savepoints
    execution.checkpointing.interval: 60s
    execution.checkpointing.min-pause: 5s
    execution.checkpointing.timeout: 10min
    # Memory Configuration
    taskmanager.memory.process.size: 2048m
    jobmanager.memory.process.size: 1024m
    # Restart Strategy
    restart-strategy.type: exponential-delay
    restart-strategy.exponential-delay.initial-backoff: 10s
    restart-strategy.exponential-delay.max-backoff: 2min
    restart-strategy.exponential-delay.backoff-multiplier: "2.0"
    restart-strategy.exponential-delay.reset-backoff-threshold: 10min
    restart-strategy.exponential-delay.jitter-factor: "0.1"
  serviceAccount: flink
  jobManager:
    replicas: 2
    resource:
      memory: "1024m"
      cpu: 1.0
  taskManager:
    replicas: 3
    resource:
      memory: "2048m"
      cpu: 2.0
