resources:
  - ../base
  - resources.yaml
  - immich-config.yaml
namespace: immich-cloud
patches:
  - target:
      kind: Deployment
      name: immich
    patch: |-
      # Add fsGroup for PVC volume permissions
      - op: add
        path: /spec/template/spec/securityContext/fsGroup
        value: 581

      # Remove GPU resource requests/limits
      - op: remove
        path: /spec/template/spec/containers/0/resources/requests/gpu.intel.com~1i915
      - op: remove
        path: /spec/template/spec/containers/0/resources/limits/gpu.intel.com~1i915

      # Add PVC data volume
      - op: add
        path: /spec/template/spec/volumes/-
        value:
          name: data
          persistentVolumeClaim:
            claimName: immich-data

      # Add config volume from ConfigMap
      - op: add
        path: /spec/template/spec/volumes/-
        value:
          name: immich-config
          configMap:
            name: immich-config

      # Mount data volume on init container
      - op: add
        path: /spec/template/spec/initContainers/0/volumeMounts/-
        value:
          name: data
          mountPath: /data

      # Mount data volume on main container
      - op: add
        path: /spec/template/spec/containers/0/volumeMounts/-
        value:
          name: data
          mountPath: /data

      # Mount config volume on main container
      - op: add
        path: /spec/template/spec/containers/0/volumeMounts/-
        value:
          name: immich-config
          mountPath: /etc/immich
          readOnly: true

      # Set IMMICH_CONFIG_FILE env var
      - op: add
        path: /spec/template/spec/containers/0/env/-
        value:
          name: IMMICH_CONFIG_FILE
          value: /etc/immich/config.yaml
  - target:
      kind: PersistentVolumeClaim
      name: immich-model-cache
    patch: |-
      - op: add
        path: /spec/storageClassName
        value: customer-workload-storage
  - target:
      kind: Deployment
      name: redis
    patch: |-
      - op: add
        path: /spec/template/spec/containers/0/command
        value: ["valkey-server", "--save", "", "--appendonly", "no"]
  - target:
      kind: Cluster
      name: immich-database
    patch: |-
      - op: add
        path: /spec/storage/storageClass
        value: customer-workload-storage
