apiVersion: dragonflydb.io/v1alpha1
kind: Dragonfly
metadata:
  name: dragonfly-gitea
  namespace: gitea
spec:
  replicas: 1
  resources:
    requests:
      cpu: 150m
      memory: 256Mi
    limits:
      memory: 256Mi
  args:
    - --dbfilename=dump           # Static filename prevents disk exhaustion
    - --maxmemory=$(MAX_MEMORY)Mi # Graceful memory management (90% of limit)
    - --proactor_threads=1 # Auto-detect CPU cores (optimal threading)
    - --cluster_mode=emulated
    - --logtostderr
  env:
    - name: MAX_MEMORY
      valueFrom:
        resourceFieldRef:
          resource: limits.memory
          divisor: 1Mi
