# Kubernetes Kustomization - ERP全量服务统一部署
# 用法: kubectl apply -k infrastructure/kubernetes/overlays/prod
#
# 基础配置
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: erp-prod

resources:
  # 全局基础设施
  - ../base/erp-global-infra.yaml
  # 数据库初始化Job（首次部署时需要）
  # - ../base/erp-db-init-job.yaml

commonLabels:
  app.kubernetes.io/name: erp
  app.kubernetes.io/managed-by: kustomize
  app.kubernetes.io/part-of: erp-java-backend

secretGenerator:
  - name: erp-secrets
    literals:
      - DB_PASSWORD=REPLACE_WITH_DB_PASSWORD
      - MYSQL_ROOT_PASSWORD=REPLACE_WITH_ROOT_PASSWORD
      - REDIS_PASSWORD=REPLACE_WITH_REDIS_PASSWORD
      - JWT_SECRET=REPLACE_WITH_JWT_SECRET_MIN_32_CHARS
    options:
      disableNameSuffixHash: true

configMapGenerator:
  - name: erp-config
    literals:
      - NACOS_HOST=nacos
      - NACOS_PORT=8848
      - NACOS_NAMESPACE=prod
      - DB_HOST=mysql
      - DB_PORT=3306
      - DB_NAME=erp_java
      - DB_USERNAME=erp_user
      - REDIS_HOST=redis
      - REDIS_PORT=6379
    options:
      disableNameSuffixHash: true

replicas:
  - name: gateway
    count: 2
  - name: user-service
    count: 3
  - name: product-service
    count: 3
  - name: order-service
    count: 3
