# Resource constraints for the sandbox namespace
# These limits apply regardless of what the gateway requests
---
# LimitRange: per-container defaults and maximums
apiVersion: v1
kind: LimitRange
metadata:
  name: sandbox-limits
  namespace: sandbox
spec:
  limits:
    # Default limits applied if deployment doesn't specify
    - type: Container
      default:
        memory: "512Mi"
        cpu: "500m"
      defaultRequest:
        memory: "256Mi"
        cpu: "100m"
      # Maximum any single container can request
      max:
        memory: "8Gi"
        cpu: "4000m"
      min:
        memory: "32Mi"
        cpu: "10m"
    # PVC size limits
    - type: PersistentVolumeClaim
      max:
        storage: "10Gi"
      min:
        storage: "100Mi"
---
# ResourceQuota: total namespace limits
# Prevents a compromised gateway from exhausting cluster resources
apiVersion: v1
kind: ResourceQuota
metadata:
  name: sandbox-quota
  namespace: sandbox
spec:
  hard:
    # Total compute limits for all sandboxes combined
    requests.cpu: "20"
    requests.memory: "40Gi"
    limits.cpu: "40"
    limits.memory: "80Gi"
    # Object count limits
    pods: "100"
    persistentvolumeclaims: "100"
    services: "100"
    # Storage limits
    requests.storage: "500Gi"
