# Deployment 範本
# 使用方式：複製此檔案，將 {{APP_NAME}} 替換為你的應用名稱

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{APP_NAME}}
  namespace: default
  labels:
    app: {{APP_NAME}}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: {{APP_NAME}}
  template:
    metadata:
      labels:
        app: {{APP_NAME}}
    spec:
      containers:
        - name: {{APP_NAME}}
          image: {{IMAGE}}:{{TAG|latest}}
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: {{PORT|8080}}
          # 資源限制（建議設定）
          resources:
            limits:
              memory: "512Mi"
              cpu: "500m"
            requests:
              memory: "256Mi"
              cpu: "250m"
          # 健康檢查（可選）
          livenessProbe:
            httpGet:
              path: /
              port: http
            initialDelaySeconds: 30
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /
              port: http
            initialDelaySeconds: 5
            periodSeconds: 10
          volumeMounts:
            - name: data-vol
              mountPath: {{DATA_MOUNT_PATH|/data}}
      volumes:
        - name: data-vol
          persistentVolumeClaim:
            claimName: {{APP_NAME}}-pvc
