app:
  env: preprd-use1-1
  port: 50051
  team: "internal-platform"
  group: "internal-platform"
  seaLights:
    disabled: false
    logLevel: fatal
  prometheus:
    enabled: true
    path: /metrics
    port: 9464
    scrape: true

cluster:
  region: us-east-1
  environment: preprd
  increment: 1

image:
  repository: "plutotv/service-dal"
  pullPolicy: IfNotPresent

configMap:
  environmentVariables:
    LOG_LEVEL: "info"
    NODE_ENV: "preprod"
    PLUTO_OPENTELEMETRY_TRACING_DEBUG: "false"
    USE_MOCK_KUE_RUNNER: "true"
    DISABLE_DYNAMIC_CONFIG: "false"
    GRPC_SOCKET_ADDRESS: "0.0.0.0:50051"
    PLUTO_OPENTELEMETRY_ENDPOINT: "http://otel-collector:9411"

service:
  port:
    servicePort: 50051
    targetPort: 50051
    name: grpc
  healthcheck:
    servicePort: 5071
    targetPort: 5071
  headless:
    enabled: true

istio:
  enabled: true
  gateway:
    grpc:
      enabled: true
      virtualService:
        httpRoute:
          configOverride:
            - name: headless
              route:
                - destination:
                    host: service-dal-headless.preprd-service-dal.svc.cluster.local
                    port:
                      number: 50051
              match:
                - port: 50051
            - name: healthcheck
              route:
                - destination:
                    host: service-dal.preprd-service-dal.svc.cluster.local
                    port:
                      number: 5071
              match:
                - port: 5071
  destinationRules:
    enabled: true
    customPolicies:
      - trafficPolicy:
          loadBalancer:
            simple: LEAST_CONN
          connectionPool:
            http:
              http1MaxPendingRequests: 200
              http2MaxRequests: 10000
              maxRequestsPerConnection: 10000
            tcp:
              maxConnections: 10000
          outlierDetection:
            baseEjectionTime: 180s
            consecutive5xxErrors: 5
            consecutiveGatewayErrors: 5
            interval: 3s
            maxEjectionPercent: 100
          tls:
            mode: ISTIO_MUTUAL

externalSecrets:
  enabled: true
  secret:
    useSecretRef: true
    secretVariables:
      - secretKey: MONGO_DB_URL
        remoteRef:
          key: app/preprd-service-dal/mongodb/url
          property: value
      - secretKey: PLUTO_DAL_WRITE_TOKENS
        remoteRef:
          key: app/preprd-service-dal/auth/dalWriteTokens
          property: value

autoscaling:
  horizontal:
    enabled: true
    minReplicas: 50
    maxReplicas: 300
    metrics:
      - type: Resource
        resource:
          name: cpu
          target:
            type: Utilization
            averageUtilization: 60
      - type: Resource
        resource:
          name: memory
          target:
            type: Utilization
            averageUtilization: 60
    behavior:
      scaleDown:
        stabilizationWindowSeconds: 180
        policies:
          - type: Percent
            value: 25
            periodSeconds: 30
      scaleUp:
        stabilizationWindowSeconds: 10
        policies:
          - type: Percent
            value: 200
            periodSeconds: 90
        selectPolicy: Max

resources:
  limits:
    cpu: 5
    memory: 8Gi
  requests:
    cpu: 500m
    memory: 1Gi

pod:
  livenessProbe:
    path: "/healthz"
    initialDelaySeconds: 30
    periodSeconds: 15
    timeoutSeconds: 10
    successThreshold: 1
    failureThreshold: 5
  readinessProbe:
    path: "/healthz"
    initialDelaySeconds: 30
    periodSeconds: 15
    timeoutSeconds: 10
    successThreshold: 1
    failureThreshold: 5
  annotations:
    sidecar.istio.io/proxyCPU: "100m"
    sidecar.istio.io/proxyCPULimit: "2"
    sidecar.istio.io/proxyMemory: "256Mi"
    sidecar.istio.io/proxyMemoryLimit: "512Mi"

node:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
          - matchExpressions:
              - key: pluto.tv/instance-compute-type
                operator: In
                values:
                  - "true"
