diff --git a/kubernetes/apps/default/lychee/app/kustomization.yaml b/kubernetes/apps/default/lychee/app/kustomization.yaml index 48e972b27..c5e641ed5 100644 --- a/kubernetes/apps/default/lychee/app/kustomization.yaml +++ b/kubernetes/apps/default/lychee/app/kustomization.yaml @@ -6,5 +6,6 @@ namespace: default resources: - ./externalsecret.yaml - ./helmrelease.yaml + - ./sync - ../../../../templates/gatus/guarded - ../../../../templates/volsync diff --git a/kubernetes/apps/default/lychee/app/sync/helmrelease.yaml b/kubernetes/apps/default/lychee/app/sync/helmrelease.yaml new file mode 100644 index 000000000..f67bbe2fa --- /dev/null +++ b/kubernetes/apps/default/lychee/app/sync/helmrelease.yaml @@ -0,0 +1,63 @@ +--- +# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/helm.toolkit.fluxcd.io/helmrelease_v2beta2.json +apiVersion: helm.toolkit.fluxcd.io/v2beta2 +kind: HelmRelease +metadata: + name: lychee-sync + namespace: default +spec: + interval: 30m + chart: + spec: + chart: app-template + version: 2.5.0 + sourceRef: + kind: HelmRepository + name: bjw-s + namespace: flux-system + maxHistory: 2 + install: + createNamespace: true + remediation: + retries: 3 + upgrade: + cleanupOnFail: true + remediation: + retries: 3 + uninstall: + keepHistory: false + values: + controllers: + main: + type: cronjob + cronjob: + concurrencyPolicy: Forbid + schedule: "0 0 * * 1" # At 00:00 on Monday + containers: + main: + image: + repository: ghcr.io/auricom/kubectl + tag: 1.29.1@sha256:fb732755039305d01cc996f539a42860924a877728ac9bfaec076538b49ee1c4 + command: + - "/bin/bash" + - "-c" + - | + #!/bin/bash + + set -o errexit + set -o nounset + + result=$(kubectl get pod --selector app.kubernetes.io/name=lychee --output custom-columns=:metadata.name --namespace default) + LYCHEE_POD=$(echo $result | awk '{ print $NF }') + if [[ $LYCHEE_POD == *"lychee"* ]]; then + kubectl exec --stdin --container main $LYCHEE_POD -- php artisan lychee:sync /mnt/storage/photo/Gallery/ --skip_duplicates=1 + else + echo "lychee deployment not found" + exit 1 + fi + service: + main: + enabled: false + serviceAccount: + create: false + name: "jobs" diff --git a/kubernetes/apps/default/lychee/app/sync/kustomization.yaml b/kubernetes/apps/default/lychee/app/sync/kustomization.yaml new file mode 100644 index 000000000..09bc749a9 --- /dev/null +++ b/kubernetes/apps/default/lychee/app/sync/kustomization.yaml @@ -0,0 +1,6 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/kustomization.json +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./helmrelease.yaml