# api-gateway — прокси к микросервисам
# namespace: gooseek
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-gateway
  namespace: gooseek
spec:
  replicas: 1
  selector:
    matchLabels:
      app: api-gateway
  template:
    metadata:
      labels:
        app: api-gateway
    spec:
      containers:
        - name: api-gateway
          image: gooseek/api-gateway:latest
          imagePullPolicy: Never
          ports:
            - containerPort: 3015
          env:
            - name: PORT
              value: "3015"
            - name: CHAT_SVC_URL
              value: "http://chat-svc.gooseek:3005"
            - name: LIBRARY_SVC_URL
              value: "http://library-svc.gooseek:3009"
            - name: DISCOVER_SVC_URL
              value: "http://discover-svc.gooseek:3002"
            - name: SEARCH_SVC_URL
              value: "http://search-svc.gooseek:3001"
            - name: FINANCE_SVC_URL
              value: "http://finance-svc.gooseek:3003"
            - name: TRAVEL_SVC_URL
              value: "http://travel-svc.gooseek:3004"
            - name: CREATE_SVC_URL
              value: "http://create-svc.gooseek:3011"
            - name: MEMORY_SVC_URL
              value: "http://memory-svc.gooseek:3010"
            - name: PROJECTS_SVC_URL
              value: "http://projects-svc.gooseek:3006"
            - name: NOTIFICATIONS_SVC_URL
              value: "http://notifications-svc.gooseek:3013"
            - name: BILLING_SVC_URL
              value: "http://billing-svc.gooseek:3008"
            - name: AUDIT_SVC_URL
              value: "http://audit-svc.gooseek:3012"
            - name: AUTH_SVC_URL
              value: "http://auth-svc.gooseek-auth:3014"
            - name: PROFILE_SVC_URL
              value: "http://profile-svc.gooseek:3019"
            - name: LLM_SVC_URL
              value: "http://llm-svc.gooseek:3020"
            - name: ALLOWED_ORIGINS
              valueFrom:
                configMapKeyRef:
                  name: gooseek-env
                  key: allowed-origins
          livenessProbe:
            httpGet:
              path: /health
              port: 3015
            initialDelaySeconds: 5
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /ready
              port: 3015
            initialDelaySeconds: 3
            periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  name: api-gateway
  namespace: gooseek
spec:
  selector:
    app: api-gateway
  ports:
    - port: 3015
      targetPort: 3015
