# PathwayViz Kubernetes Deployment
#
# Usage:
#   kubectl apply -f k8s-deployment.yaml
#   kubectl apply -f k8s-service.yaml
#   kubectl apply -f k8s-ingress.yaml  # Optional, for external access
#
# Prerequisites:
#   - Build and push your image: docker build -t your-registry/pathwayviz:v1 . && docker push ...
#   - Create the configmap: kubectl create configmap pathwayviz-config --from-literal=kafka_servers=kafka:9092

apiVersion: apps/v1
kind: Deployment
metadata:
  name: pathwayviz
  labels:
    app: pathwayviz
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pathwayviz
  template:
    metadata:
      labels:
        app: pathwayviz
    spec:
      containers:
        - name: pathwayviz
          image: your-registry/pathwayviz:latest
          ports:
            - containerPort: 3000
              name: http
          env:
            - name: KAFKA_BOOTSTRAP_SERVERS
              valueFrom:
                configMapKeyRef:
                  name: pathwayviz-config
                  key: kafka_servers
            - name: PATHWAYVIZ_PORT
              value: "3000"
          resources:
            requests:
              cpu: 500m
              memory: 512Mi
            limits:
              cpu: 2000m
              memory: 2Gi
          livenessProbe:
            httpGet:
              path: /
              port: 3000
            initialDelaySeconds: 10
            periodSeconds: 30
          readinessProbe:
            httpGet:
              path: /
              port: 3000
            initialDelaySeconds: 5
            periodSeconds: 10
          volumeMounts:
            - name: data
              mountPath: /app/data
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: pathwayviz-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pathwayviz-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
