# All 10 product backends — Deployment + ClusterIP Service + NodePort Service
# Each backend: Fastify 5 + TypeScript, /health endpoint, shared ConfigMap + Secrets
# ═══════════════════════════════════════════════════════════════════════

# ── PeakPulse Backend (:4010) ─────────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: peakpulse-backend
  namespace: bytelyst-products
  labels:
    app: peakpulse-backend
    tier: backend
    product: peakpulse
spec:
  replicas: 1
  selector:
    matchLabels:
      app: peakpulse-backend
  template:
    metadata:
      labels:
        app: peakpulse-backend
        tier: backend
        product: peakpulse
    spec:
      containers:
      - name: backend
        image: bytelyst/peakpulse-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4010
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4010"
        - name: NODE_ENV
          value: "production"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4010
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4010
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: peakpulse-backend
  namespace: bytelyst-products
spec:
  selector:
    app: peakpulse-backend
  ports:
  - port: 4010
    targetPort: 4010
---
apiVersion: v1
kind: Service
metadata:
  name: peakpulse-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: peakpulse-backend
  ports:
  - port: 4010
    targetPort: 4010
    nodePort: 4010

---
# ── ChronoMind Backend (:4011) ────────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: chronomind-backend
  namespace: bytelyst-products
  labels:
    app: chronomind-backend
    tier: backend
    product: chronomind
spec:
  replicas: 1
  selector:
    matchLabels:
      app: chronomind-backend
  template:
    metadata:
      labels:
        app: chronomind-backend
        tier: backend
        product: chronomind
    spec:
      containers:
      - name: backend
        image: bytelyst/chronomind-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4011
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4011"
        - name: NODE_ENV
          value: "production"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4011
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4011
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: chronomind-backend
  namespace: bytelyst-products
spec:
  selector:
    app: chronomind-backend
  ports:
  - port: 4011
    targetPort: 4011
---
apiVersion: v1
kind: Service
metadata:
  name: chronomind-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: chronomind-backend
  ports:
  - port: 4011
    targetPort: 4011
    nodePort: 4011

---
# ── JarvisJr Backend (:4012) ──────────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: jarvisjr-backend
  namespace: bytelyst-products
  labels:
    app: jarvisjr-backend
    tier: backend
    product: jarvisjr
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jarvisjr-backend
  template:
    metadata:
      labels:
        app: jarvisjr-backend
        tier: backend
        product: jarvisjr
    spec:
      containers:
      - name: backend
        image: bytelyst/jarvisjr-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4012
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4012"
        - name: NODE_ENV
          value: "production"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4012
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4012
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: jarvisjr-backend
  namespace: bytelyst-products
spec:
  selector:
    app: jarvisjr-backend
  ports:
  - port: 4012
    targetPort: 4012
---
apiVersion: v1
kind: Service
metadata:
  name: jarvisjr-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: jarvisjr-backend
  ports:
  - port: 4012
    targetPort: 4012
    nodePort: 4012

---
# ── NomGap Backend (:4013) ────────────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nomgap-backend
  namespace: bytelyst-products
  labels:
    app: nomgap-backend
    tier: backend
    product: nomgap
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nomgap-backend
  template:
    metadata:
      labels:
        app: nomgap-backend
        tier: backend
        product: nomgap
    spec:
      containers:
      - name: backend
        image: bytelyst/nomgap-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4013
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4013"
        - name: NODE_ENV
          value: "production"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4013
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4013
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: nomgap-backend
  namespace: bytelyst-products
spec:
  selector:
    app: nomgap-backend
  ports:
  - port: 4013
    targetPort: 4013
---
apiVersion: v1
kind: Service
metadata:
  name: nomgap-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: nomgap-backend
  ports:
  - port: 4013
    targetPort: 4013
    nodePort: 4013

---
# ── MindLyst Backend (:4014) ──────────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mindlyst-backend
  namespace: bytelyst-products
  labels:
    app: mindlyst-backend
    tier: backend
    product: mindlyst
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mindlyst-backend
  template:
    metadata:
      labels:
        app: mindlyst-backend
        tier: backend
        product: mindlyst
    spec:
      containers:
      - name: backend
        image: bytelyst/mindlyst-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4014
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4014"
        - name: NODE_ENV
          value: "production"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4014
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4014
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: mindlyst-backend
  namespace: bytelyst-products
spec:
  selector:
    app: mindlyst-backend
  ports:
  - port: 4014
    targetPort: 4014
---
apiVersion: v1
kind: Service
metadata:
  name: mindlyst-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: mindlyst-backend
  ports:
  - port: 4014
    targetPort: 4014
    nodePort: 4014

---
# ── LysnrAI Backend (:4015) ──────────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: lysnrai-backend
  namespace: bytelyst-products
  labels:
    app: lysnrai-backend
    tier: backend
    product: lysnrai
spec:
  replicas: 1
  selector:
    matchLabels:
      app: lysnrai-backend
  template:
    metadata:
      labels:
        app: lysnrai-backend
        tier: backend
        product: lysnrai
    spec:
      containers:
      - name: backend
        image: bytelyst/lysnrai-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4015
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4015"
        - name: NODE_ENV
          value: "production"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4015
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4015
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: lysnrai-backend
  namespace: bytelyst-products
spec:
  selector:
    app: lysnrai-backend
  ports:
  - port: 4015
    targetPort: 4015
---
apiVersion: v1
kind: Service
metadata:
  name: lysnrai-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: lysnrai-backend
  ports:
  - port: 4015
    targetPort: 4015
    nodePort: 4015

---
# ── NoteLett Backend (:4016) ──────────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: notelett-backend
  namespace: bytelyst-products
  labels:
    app: notelett-backend
    tier: backend
    product: notelett
spec:
  replicas: 1
  selector:
    matchLabels:
      app: notelett-backend
  template:
    metadata:
      labels:
        app: notelett-backend
        tier: backend
        product: notelett
    spec:
      containers:
      - name: backend
        image: bytelyst/notelett-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4016
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4016"
        - name: NODE_ENV
          value: "production"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4016
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4016
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: notelett-backend
  namespace: bytelyst-products
spec:
  selector:
    app: notelett-backend
  ports:
  - port: 4016
    targetPort: 4016
---
apiVersion: v1
kind: Service
metadata:
  name: notelett-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: notelett-backend
  ports:
  - port: 4016
    targetPort: 4016
    nodePort: 4016

---
# ── FlowMonk Backend (:4017) ─────────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: flowmonk-backend
  namespace: bytelyst-products
  labels:
    app: flowmonk-backend
    tier: backend
    product: flowmonk
spec:
  replicas: 1
  selector:
    matchLabels:
      app: flowmonk-backend
  template:
    metadata:
      labels:
        app: flowmonk-backend
        tier: backend
        product: flowmonk
    spec:
      containers:
      - name: backend
        image: bytelyst/flowmonk-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4017
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4017"
        - name: NODE_ENV
          value: "production"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4017
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4017
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: flowmonk-backend
  namespace: bytelyst-products
spec:
  selector:
    app: flowmonk-backend
  ports:
  - port: 4017
    targetPort: 4017
---
apiVersion: v1
kind: Service
metadata:
  name: flowmonk-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: flowmonk-backend
  ports:
  - port: 4017
    targetPort: 4017
    nodePort: 4017

---
# ── ActionTrail Backend (:4018) ───────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: actiontrail-backend
  namespace: bytelyst-products
  labels:
    app: actiontrail-backend
    tier: backend
    product: actiontrail
spec:
  replicas: 1
  selector:
    matchLabels:
      app: actiontrail-backend
  template:
    metadata:
      labels:
        app: actiontrail-backend
        tier: backend
        product: actiontrail
    spec:
      containers:
      - name: backend
        image: bytelyst/actiontrail-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4018
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4018"
        - name: NODE_ENV
          value: "production"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4018
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4018
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: actiontrail-backend
  namespace: bytelyst-products
spec:
  selector:
    app: actiontrail-backend
  ports:
  - port: 4018
    targetPort: 4018
---
apiVersion: v1
kind: Service
metadata:
  name: actiontrail-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: actiontrail-backend
  ports:
  - port: 4018
    targetPort: 4018
    nodePort: 4018

---
# ── LocalMemGPT Backend (:4019) ──────────────────────────────────────
apiVersion: apps/v1
kind: Deployment
metadata:
  name: localmemgpt-backend
  namespace: bytelyst-products
  labels:
    app: localmemgpt-backend
    tier: backend
    product: localmemgpt
spec:
  replicas: 1
  selector:
    matchLabels:
      app: localmemgpt-backend
  template:
    metadata:
      labels:
        app: localmemgpt-backend
        tier: backend
        product: localmemgpt
    spec:
      containers:
      - name: backend
        image: bytelyst/localmemgpt-backend:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 4019
        env:
        - name: HOST
          value: "0.0.0.0"
        - name: PORT
          value: "4019"
        - name: NODE_ENV
          value: "production"
        - name: OLLAMA_URL
          value: "http://ollama.bytelyst-infra.svc:11434"
        envFrom:
        - configMapRef:
            name: bytelyst-config
        - secretRef:
            name: bytelyst-secrets
        resources:
          requests:
            cpu: "100m"
            memory: "256Mi"
          limits:
            cpu: "500m"
            memory: "512Mi"
        readinessProbe:
          httpGet:
            path: /health
            port: 4019
          initialDelaySeconds: 15
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /health
            port: 4019
          initialDelaySeconds: 30
          periodSeconds: 30
---
apiVersion: v1
kind: Service
metadata:
  name: localmemgpt-backend
  namespace: bytelyst-products
spec:
  selector:
    app: localmemgpt-backend
  ports:
  - port: 4019
    targetPort: 4019
---
apiVersion: v1
kind: Service
metadata:
  name: localmemgpt-backend-ext
  namespace: bytelyst-products
spec:
  type: NodePort
  selector:
    app: localmemgpt-backend
  ports:
  - port: 4019
    targetPort: 4019
    nodePort: 4019
