# discover-svc — агрегация новостей
# docs/architecture: 02-k3s-microservices-spec.md
apiVersion: apps/v1
kind: Deployment
metadata:
  name: discover-svc
  namespace: gooseek
spec:
  replicas: 2
  selector:
    matchLabels:
      app: discover-svc
  template:
    metadata:
      labels:
        app: discover-svc
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "3002"
        prometheus.io/path: "/metrics"
    spec:
      containers:
        - name: discover-svc
          image: gooseek/discover-svc:latest
          ports:
            - containerPort: 3002
          env:
            - name: REDIS_URL
              valueFrom:
                secretKeyRef:
                  name: redis-credentials
                  key: url
            - name: SEARXNG_URL
              value: "http://searxng.gooseek-infra:8080"
            - name: GHOST_URL
              valueFrom:
                secretKeyRef:
                  name: ghost-credentials
                  key: url
                  optional: true
            - name: GHOST_CONTENT_API_KEY
              valueFrom:
                secretKeyRef:
                  name: ghost-credentials
                  key: content_api_key
                  optional: true
          livenessProbe:
            httpGet:
              path: /health
              port: 3002
            initialDelaySeconds: 5
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /ready
              port: 3002
            initialDelaySeconds: 3
            periodSeconds: 5
          resources:
            requests:
              cpu: 50m
              memory: 128Mi
            limits:
              cpu: 500m
              memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
  name: discover-svc
  namespace: gooseek
spec:
  selector:
    app: discover-svc
  ports:
    - port: 3002
      targetPort: 3002
