From 9df1e73b6ebcf4514e3d4c888cc39c324fbcfe75 Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Wed, 2 Oct 2024 12:55:45 -0500 Subject: [PATCH] add nh --- .../default/nicehash/app/externalsecret.yaml | 20 ++++++ .../default/nicehash/app/helmrelease.yaml | 72 +++++++++++++++++++ .../default/nicehash/app/kustomization.yaml | 8 +++ kubernetes/apps/default/nicehash/ks.yaml | 27 +++++++ 4 files changed, 127 insertions(+) create mode 100644 kubernetes/apps/default/nicehash/app/externalsecret.yaml create mode 100644 kubernetes/apps/default/nicehash/app/helmrelease.yaml create mode 100644 kubernetes/apps/default/nicehash/app/kustomization.yaml create mode 100644 kubernetes/apps/default/nicehash/ks.yaml diff --git a/kubernetes/apps/default/nicehash/app/externalsecret.yaml b/kubernetes/apps/default/nicehash/app/externalsecret.yaml new file mode 100644 index 00000000..74774621 --- /dev/null +++ b/kubernetes/apps/default/nicehash/app/externalsecret.yaml @@ -0,0 +1,20 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/external-secrets.io/externalsecret_v1beta1.json +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: nicehash +spec: + refreshInterval: 1m + secretStoreRef: + kind: ClusterSecretStore + name: onepassword-connect + target: + name: nicehash-secret + template: + type: Opaque + data: + MINING_ADDRESS: "{{ .MINING_ADDRESS }}" + dataFrom: + - extract: + key: nicehash diff --git a/kubernetes/apps/default/nicehash/app/helmrelease.yaml b/kubernetes/apps/default/nicehash/app/helmrelease.yaml new file mode 100644 index 00000000..fd2e7b7e --- /dev/null +++ b/kubernetes/apps/default/nicehash/app/helmrelease.yaml @@ -0,0 +1,72 @@ +--- +# 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.4.0 + 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/ diff --git a/kubernetes/apps/default/nicehash/app/kustomization.yaml b/kubernetes/apps/default/nicehash/app/kustomization.yaml new file mode 100644 index 00000000..be13d2db --- /dev/null +++ b/kubernetes/apps/default/nicehash/app/kustomization.yaml @@ -0,0 +1,8 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./externalsecret.yaml + - ./helmrelease.yaml + - ../../../../templates/volsync diff --git a/kubernetes/apps/default/nicehash/ks.yaml b/kubernetes/apps/default/nicehash/ks.yaml new file mode 100644 index 00000000..97ded0f6 --- /dev/null +++ b/kubernetes/apps/default/nicehash/ks.yaml @@ -0,0 +1,27 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: &app nicehash + namespace: flux-system +spec: + targetNamespace: default + commonMetadata: + labels: + app.kubernetes.io/name: *app + dependsOn: + - name: external-secrets-stores + - name: rook-ceph-cluster + path: ./kubernetes/apps/default/nicehash/app + prune: true + sourceRef: + kind: GitRepository + name: theshire + wait: false + interval: 30m + retryInterval: 1m + timeout: 5m + postBuild: + substitute: + APP: *app