apiVersion: apps/v1
kind: Deployment
metadata:
  name: firefly-ipfs
  namespace: firefly
spec:
  replicas: 1
  selector:
    matchLabels:
      app: firefly-ipfs
  template:
    metadata:
      labels:
        app: firefly-ipfs
    spec:
      containers:
      - name: ipfs
        image: ipfs/kubo:v0.23.0
        ports:
        - containerPort: 4001
          name: swarm
        - containerPort: 5001
          name: api
        - containerPort: 8080
          name: gateway
        env:
        - name: IPFS_PROFILE
          value: server
        volumeMounts:
        - name: ipfs-data
          mountPath: /data/ipfs
        - name: ipfs-staging
          mountPath: /data/staging
        resources:
          requests:
            cpu: "500m"
            memory: "1Gi"
          limits:
            cpu: "2"
            memory: "4Gi"
        livenessProbe:
          httpGet:
            path: /api/v0/version
            port: 5001
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /api/v0/version
            port: 5001
          initialDelaySeconds: 10
          periodSeconds: 5
      volumes:
      - name: ipfs-data
        persistentVolumeClaim:
          claimName: firefly-ipfs-pvc
      - name: ipfs-staging
        emptyDir: {}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: firefly-ipfs-pvc
  namespace: firefly
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
  storageClassName: managed-premium
---
apiVersion: v1
kind: Service
metadata:
  name: firefly-ipfs
  namespace: firefly
spec:
  selector:
    app: firefly-ipfs
  ports:
  - port: 4001
    targetPort: 4001
    name: swarm
  - port: 5001
    targetPort: 5001
    name: api
  - port: 8080
    targetPort: 8080
    name: gateway

