apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "claude-terminal.fullname" . }}
  labels:
    {{- include "claude-terminal.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "claude-terminal.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "claude-terminal.selectorLabels" . | nindent 8 }}
    spec:
      containers:
      - name: claude-terminal
        image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
        imagePullPolicy: {{ .Values.image.pullPolicy }}
        ports:
        - name: http
          containerPort: 8080
          protocol: TCP
        livenessProbe:
          httpGet:
            path: /
            port: http
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /
            port: http
          initialDelaySeconds: 5
          periodSeconds: 5
        resources:
          {{- toYaml .Values.resources | nindent 12 }}
        volumeMounts:
        - name: claude-storage
          mountPath: {{ .Values.persistence.mountPath }}
      volumes:
      - name: claude-storage
        persistentVolumeClaim:
          claimName: {{ include "claude-terminal.fullname" . }}-pvc
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
