diff --git a/kubernetes/apps/default/plex/kometa-image-maid/externalsecret.yaml b/kubernetes/apps/default/plex/kometa-image-maid/externalsecret.yaml new file mode 100644 index 00000000..e08cd582 --- /dev/null +++ b/kubernetes/apps/default/plex/kometa-image-maid/externalsecret.yaml @@ -0,0 +1,19 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/external-secrets.io/externalsecret_v1beta1.json +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: kometa-image-maid +spec: + refreshInterval: 5m + secretStoreRef: + kind: ClusterSecretStore + name: onepassword-connect + target: + name: kometa-image-maid-secret + creationPolicy: Owner + data: + - secretKey: PLEX_TOKEN + remoteRef: + key: Plex + property: token diff --git a/kubernetes/apps/default/plex/kometa-image-maid/helmrelease.yaml b/kubernetes/apps/default/plex/kometa-image-maid/helmrelease.yaml new file mode 100644 index 00000000..bc947936 --- /dev/null +++ b/kubernetes/apps/default/plex/kometa-image-maid/helmrelease.yaml @@ -0,0 +1,95 @@ +--- +# 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: plex-image-cleanup +spec: + chart: + spec: + chart: app-template + version: 3.5.1 + interval: 30m + sourceRef: + kind: HelmRepository + name: bjw-s + namespace: flux-system + interval: 30m + values: + controllers: + kometa-image-maid: + type: cronjob + annotations: + reloader.stakater.com/auto: "true" + cronjob: + schedule: "30 8 * * 6" + pod: + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/name + operator: In + values: + - plex + topologyKey: kubernetes.io/hostname + securityContext: + runAsUser: 568 + runAsGroup: 568 + runAsNonRoot: true + + containers: + app: + image: + repository: docker.io/kometateam/imagemaid + tag: v1.1.1 + env: + PLEX_URL: http://plex.default.svc.cluster.local:32400 + PLEX_TOKEN: + valueFrom: + secretKeyRef: + name: kometa-image-maid-secret + key: PLEX_TOKEN + PLEX_PATH: /data/plex_config/Library/Application Support/Plex Media Server + MODE: remove + PHOTO_TRANSCODER: true + probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false + resources: + requests: + cpu: 25m + memory: 128Mi + limits: + memory: 128Mi + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: + - ALL + + persistence: + config: + type: emptyDir + advancedMounts: + kometa-image-maid: + app: + - path: /config + plex-config: + existingClaim: plex-config + advancedMounts: + kometa-image-maid: + app: + - path: /data/plex_config + plex-cache: + existingClaim: plex-cache + advancedMounts: + kometa-image-maid: + app: + - path: /data/plex_config/Library/Application Support/Plex Media Server/Cache diff --git a/kubernetes/apps/default/plex/kometa-image-maid/kustomization.yaml b/kubernetes/apps/default/plex/kometa-image-maid/kustomization.yaml new file mode 100644 index 00000000..a530998c --- /dev/null +++ b/kubernetes/apps/default/plex/kometa-image-maid/kustomization.yaml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./helmrelease.yaml + - ./externalsecret.yaml diff --git a/kubernetes/apps/default/plex/ks.yaml b/kubernetes/apps/default/plex/ks.yaml index 5c50fedd..e396f32a 100644 --- a/kubernetes/apps/default/plex/ks.yaml +++ b/kubernetes/apps/default/plex/ks.yaml @@ -10,14 +10,16 @@ spec: commonMetadata: labels: app.kubernetes.io/name: *app - dependsOn: - - name: external-secrets-stores path: ./kubernetes/apps/default/plex/app prune: true sourceRef: kind: GitRepository name: theshire - wait: false + wait: true + dependsOn: + - name: rook-ceph-cluster + - name: volsync + - name: external-secrets-stores interval: 30m timeout: 5m postBuild: @@ -25,3 +27,59 @@ spec: APP: *app GATUS_PATH: /web/index.html VOLSYNC_CAPACITY: 30Gi +# --- +# # 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 plex-trakt-sync +# namespace: flux-system +# spec: +# targetNamespace: default +# commonMetadata: +# labels: +# app.kubernetes.io/name: *app +# interval: 30m +# timeout: 5m +# path: "./kubernetes/apps/default/plex/trakt-sync" +# prune: true +# sourceRef: +# kind: GitRepository +# name: theshire +# wait: true +# dependsOn: +# - name: rook-ceph-cluster +# - name: volsync +# - name: external-secrets-stores +# - name: plex +# postBuild: +# substitute: +# APP: *app +# APP_UID: "1000" +# APP_GID: "1000" +--- +# 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 kometa-image-maid + namespace: flux-system +spec: + targetNamespace: default + commonMetadata: + labels: + app.kubernetes.io/name: *app + interval: 30m + timeout: 5m + path: "./kubernetes/apps/default/plex/kometa-image-maid" + prune: true + sourceRef: + kind: GitRepository + name: theshire + wait: false + dependsOn: + - name: external-secrets-stores + - name: plex + postBuild: + substitute: + APP: *app