---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: soul-demo
  namespace: default
  labels:
    app: soul-demo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: soul-demo
  template:
    metadata:
      labels:
        app: soul-demo
    spec:
      containers:
      - name: soul-demo
        image: soul-demo:local
        imagePullPolicy: Never
        ports:
        - containerPort: 7772
        env:
        - name: NEURON_HOME
          value: /srv/soul/engram-demo
        - name: NEURON_PORT
          value: "7772"
        resources:
          requests:
            cpu: 250m
            memory: 256Mi
          limits:
            cpu: 1000m
            memory: 512Mi
        livenessProbe:
          httpGet:
            path: /healthz
            port: 7772
          initialDelaySeconds: 10
          periodSeconds: 15
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /healthz
            port: 7772
          initialDelaySeconds: 5
          periodSeconds: 10
        volumeMounts:
        - name: engram-data
          mountPath: /srv/soul/engram-demo
      volumes:
      - name: engram-data
        emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: soul-demo
  namespace: default
spec:
  type: NodePort
  selector:
    app: soul-demo
  ports:
  - port: 7772
    targetPort: 7772
    nodePort: 7772
    protocol: TCP
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: soul-demo
  namespace: default
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: soul-demo
  minReplicas: 1
  maxReplicas: 8
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 80
