# Default values for flink-sql-gateway.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

# Global settings
global:
  namespace: flink-sql-test
  image:
    repository: paasup/flink-sql-gateway
    tag: 1.20-kafka
    pullPolicy: IfNotPresent
  labels:
    app: flink-sql-gateway
    version: v1.20.0
  annotations: {}

# Flink Session Cluster configuration
sessionCluster:
  enabled: true
  name: flink-session-cluster
  flinkVersion: v1_20
  jobManager:
    replicas: 1
    resources:
      memory: 1024m
      cpu: 0.5
  taskManager:
    replicas: 1
    resources:
      memory: 2048m
      cpu: 1
  flinkConfiguration:
    taskmanager.numberOfTaskSlots: "2"
    parallelism.default: "1"
    execution.checkpointing.storage.fs.path: file:///tmp/flink-checkpoints
    execution.savepoint.path: file:///tmp/flink-savepoints
    execution.checkpointing.interval: 60s
    table.exec.source.idle-timeout: 30s
    table.exec.resource.default-parallelism: "1"
  # Optional environment variables for the session cluster
  env: []
  # Example:
  # env:
  #   - name: KAFKA_BOOTSTRAP_SERVERS
  #     value: "kafka-cluster:9092"
  
  # Optional volume mounts for the session cluster
  volumeMounts: []
  # Example:
  # volumeMounts:
  #   - name: truststore-certs
  #     mountPath: /opt/flink/certs
  #     readOnly: true
  
  # Optional volumes for the session cluster
  volumes: []
  # Example:
  # volumes:
  #   - name: truststore-certs
  #     secret:
  #       secretName: truststore-secret

# SQL Gateway configuration
sqlGateway:
  enabled: true
  name: flink-sql-gateway
  replicas: 1
  port: 8083
  resources:
    requests:
      memory: 512Mi
      cpu: 0.25
    limits:
      memory: 1Gi
      cpu: 0.5
  livenessProbe:
    httpGet:
      path: /v1/info
      port: 8083
    initialDelaySeconds: 60
    periodSeconds: 30
  readinessProbe:
    httpGet:
      path: /v1/info
      port: 8083
    initialDelaySeconds: 30
    periodSeconds: 10
  config:
    endpoint:
      rest:
        address: 0.0.0.0
        port: 8083
        bindAddress: 0.0.0.0
    session:
      maxNum: 1000
      idleTimeout: 600000  # 10 minutes
      checkInterval: 60000  # 1 minute
      planCache:
        enabled: true
        maxSize: 100
        ttl: 3600000  # 1 hour

  # Optional Flink configuration for SQL Gateway
  flinkConfiguration: {}
  # Example:
  # flinkConfiguration:
  #   env.java.opts: "-Djavax.net.ssl.trustStore=/opt/flink/certs/ca.p12 -Djavax.net.ssl.trustStoreType=PKCS12 -Djavax.net.ssl.trustStorePassword=${TRUSTSTORE_PASSWORD}"
        
  # Optional environment variables for the SQL Gateway
  env: []
  # Example:
  # env:
  #   - name: KAFKA_BOOTSTRAP_SERVERS
  #     value: "kafka-cluster:9092"
  
  # Optional volume mounts for the SQL Gateway
  volumeMounts: []
  # Example:
  # volumeMounts:
  #   - name: truststore-certs
  #     mountPath: /opt/flink/certs
  #     readOnly: true
  
  # Optional volumes for the SQL Gateway
  volumes: []
  # Example:
  # volumes:
  #   - name: truststore-certs
  #     secret:
  #       secretName: truststore-secret

# SQL Client configuration (optional - for interactive SQL queries)
sqlClient:
  enabled: false  # Set to true if you need interactive SQL client
  name: flink-sql-client
  resources:
    requests:
      memory: 512Mi
      cpu: 0.25
    limits:
      memory: 1Gi
      cpu: 0.5
  # Optional environment variables for the SQL Client
  env: []
  # Example:
  # env:
  #   - name: KAFKA_BOOTSTRAP_SERVERS
  #     value: "kafka-cluster:9092"
  
  # Optional volume mounts for the SQL Client
  volumeMounts: []
  # Example:
  # volumeMounts:
  #   - name: truststore-certs
  #     mountPath: /opt/flink/certs
  #     readOnly: true
  
  # Optional volumes for the SQL Client
  volumes: []
  # Example:
  # volumes:
  #   - name: truststore-certs
  #     secret:
  #       secretName: truststore-secret

# Service configuration
services:
  sqlGateway:
    type: ClusterIP
    port: 8083
    targetPort: 8083
  sessionCluster:
    type: ClusterIP
    port: 8081
    targetPort: 8081

# RBAC configuration
rbac:
  create: true
  serviceAccountName: flink-sql-gateway

# Security configuration
security: {}
# Example security configurations can be added here if needed
# security:
#   runAsUser: 1000
#   runAsGroup: 1000
#   fsGroup: 1000

# Monitoring configuration
monitoring:
  enabled: false
  prometheus:
    enabled: false
  grafana:
    enabled: false

# Ingress configuration
ingress:
  enabled: false
  className: ""
  annotations: {}
  hosts:
    - host: flink-sql-gateway.local
      paths:
        - path: /
          pathType: Prefix
  tls: []

# Node selector and tolerations
nodeSelector: {}
tolerations: []
affinity: {}

# Pod security context
podSecurityContext: {}

# Container security context
securityContext: {}