apiVersion: v1
kind: Namespace
metadata:
  name: fenix-ai
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: crypto-forecast-api-deployment
  namespace: fenix-ai
spec:
  replicas: 0
  selector:
    matchLabels:
      app: crypto-forecast-api
  template:
    metadata:
      labels:
        app: crypto-forecast-api
    spec:
      containers:
      - name: crypto-forecast-api
        image: gitea.fenix-dev.com/fenix-gitea-admin/fenix-cripto-api:0.0.19
        ports:
        - containerPort: 8080
        resources:
          limits:
            nvidia.com/gpu: 1   # garante uso da tua RTX 4060 Ti
        env:
        - name: ASPNETCORE_ENVIRONMENT
          value: Development
        volumeMounts:
        - name: model
          mountPath: /models
      volumes:
      - name: model
        persistentVolumeClaim:
          claimName: crypto-forecast-api-model-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: crypto-forecast-api-svc
  namespace: fenix-ai
spec:
  selector:
    app: crypto-forecast-api
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 8080
  type: NodePort   # ou LoadBalancer se tiveres suporte
---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: crypto-forecast-api-model-pv
  namespace: fenix-ai
spec:
  capacity:
    storage: 20Gi
  storageClassName: fenix-ai-nfs-csi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  nfs:
    server: 192.168.1.22
    path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/fenix/ai/api/model
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: crypto-forecast-api-model-pvc
  namespace: fenix-ai
spec:
  storageClassName: fenix-ai-nfs-csi
  accessModes:
    - ReadWriteOnce
  volumeName: crypto-forecast-api-model-pv
  resources:
    requests:
      storage: 20Gi
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: fenix-ai-nfs-csi
  namespace: fenix-ai
provisioner: nfs.csi.k8s.io
parameters:
  server: 192.168.1.22
  share: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/
allowVolumeExpansion: true
reclaimPolicy: Retain