---
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: nicehash
spec:
  interval: 30m
  chart:
    spec:
      chart: app-template
      version: 3.5.1
      sourceRef:
        kind: HelmRepository
        name: bjw-s
        namespace: flux-system
  install:
    remediation:
      retries: 3
  upgrade:
    cleanupOnFail: true
    remediation:
      strategy: rollback
      retries: 3
  values:
    controllers:
      nicehash:
        annotations:
          reloader.stakater.com/auto: "true"
        containers:
          app:
            image:
              repository: docker.io/dockerhubnh/nicehash
              tag: latest
            envFrom:
              - secretRef:
                  name: nicehash-secret
            env:
              TZ: America/Chicago
              MINING_WORKER_NAME: shadowfax
            securityContext:
              allowPrivilegeEscalation: false
              readOnlyRootFilesystem: true
              capabilities: { drop: ["ALL"] }
            resources:
              requests:
                cpu: 10m
              limits:
                nvidia.com/gpu: 1 # requesting 1 GPU
                memory: 10Gi
    defaultPodOptions:
      securityContext:
        runAsNonRoot: true
        runAsUser: 568
        runAsGroup: 568
        fsGroup: 568
        fsGroupChangePolicy: OnRootMismatch
        seccompProfile: { type: RuntimeDefault }
      nodeSelector:
        nvidia.com/gpu.present: "true"
      runtimeClassName: nvidia
    persistence:
      logs:
        type: emptyDir
        globalMounts:
          - path: /var/log/
      tmp:
        type: emptyDir
      cache:
        existingClaim: nicehash
        globalMounts:
          - path: /var/cache/nhm4/