From c07b9611bd6c9640d6cf155cb78ca7b3e60245bf Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Tue, 7 May 2024 21:46:09 -0500 Subject: [PATCH] Switch to RWO --- .../apps/default/radarr/app/helmrelease.yaml | 12 -- .../default/radarr/app/kustomization.yaml | 4 - kubernetes/apps/default/radarr/app/pvc.yaml | 2 +- .../radarr/app/resources/pushover-notify.sh | 109 ------------------ kubernetes/apps/default/radarr/ks.yaml | 1 + 5 files changed, 2 insertions(+), 126 deletions(-) delete mode 100644 kubernetes/apps/default/radarr/app/resources/pushover-notify.sh diff --git a/kubernetes/apps/default/radarr/app/helmrelease.yaml b/kubernetes/apps/default/radarr/app/helmrelease.yaml index 234db953..91f1b8a2 100644 --- a/kubernetes/apps/default/radarr/app/helmrelease.yaml +++ b/kubernetes/apps/default/radarr/app/helmrelease.yaml @@ -22,9 +22,6 @@ spec: remediation: retries: 3 strategy: rollback - dependsOn: - - name: openebs-cluster - namespace: rook-ceph values: controllers: radarr: @@ -39,7 +36,6 @@ spec: # Ref: https://github.com/Radarr/Radarr/issues/7030#issuecomment-1039689518 # Ref: https://github.com/dotnet/runtime/issues/9336 COMPlus_EnableDiagnostics: "0" - PUSHOVER_DEBUG: "false" RADARR__AUTHENTICATION_METHOD: External RADARR__AUTHENTICATION_REQUIRED: DisabledForLocalAddresses RADARR__INSTANCE_NAME: Radarr @@ -109,14 +105,6 @@ spec: config: enabled: true existingClaim: radarr - pushover-notify: - type: configMap - name: radarr-configmap - defaultMode: 0775 - globalMounts: - - path: /scripts/pushover-notify.sh - subPath: pushover-notify.sh - readOnly: true tmp: type: emptyDir media: diff --git a/kubernetes/apps/default/radarr/app/kustomization.yaml b/kubernetes/apps/default/radarr/app/kustomization.yaml index 75d641c9..47a01f04 100644 --- a/kubernetes/apps/default/radarr/app/kustomization.yaml +++ b/kubernetes/apps/default/radarr/app/kustomization.yaml @@ -6,10 +6,6 @@ resources: - ./externalsecret.yaml - ./pvc.yaml - ./helmrelease.yaml -configMapGenerator: - - name: radarr-configmap - files: - - pushover-notify.sh=./resources/pushover-notify.sh generatorOptions: disableNameSuffixHash: true annotations: diff --git a/kubernetes/apps/default/radarr/app/pvc.yaml b/kubernetes/apps/default/radarr/app/pvc.yaml index 356db49a..1b0c8fd8 100644 --- a/kubernetes/apps/default/radarr/app/pvc.yaml +++ b/kubernetes/apps/default/radarr/app/pvc.yaml @@ -4,7 +4,7 @@ kind: PersistentVolumeClaim metadata: name: radarr spec: - accessModes: ["ReadWriteMany"] + accessModes: ["ReadWriteOnce"] resources: requests: storage: 15Gi diff --git a/kubernetes/apps/default/radarr/app/resources/pushover-notify.sh b/kubernetes/apps/default/radarr/app/resources/pushover-notify.sh deleted file mode 100644 index e7cf5e4c..00000000 --- a/kubernetes/apps/default/radarr/app/resources/pushover-notify.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env bash -# shellcheck disable=SC2154 - -PUSHOVER_DEBUG="${PUSHOVER_DEBUG:-"true"}" -# kubectl port-forward service/radarr -n default 7878:80 -# export PUSHOVER_TOKEN=""; -# export PUSHOVER_USER_KEY=""; -# export radarr_eventtype=Download; -# ./notify.sh - -CONFIG_FILE="/config/config.xml" && [[ "${PUSHOVER_DEBUG}" == "true" ]] && CONFIG_FILE="config.xml" -ERRORS=() - -# -# Configurable variables -# -# Required -PUSHOVER_USER_KEY="${PUSHOVER_USER_KEY:-}" && [[ -z "${PUSHOVER_USER_KEY}" ]] && ERRORS+=("PUSHOVER_USER_KEY not defined") -PUSHOVER_TOKEN="${PUSHOVER_TOKEN:-}" && [[ -z "${PUSHOVER_TOKEN}" ]] && ERRORS+=("PUSHOVER_TOKEN not defined") -# Optional -PUSHOVER_DEVICE="${PUSHOVER_DEVICE:-}" -PUSHOVER_PRIORITY="${PUSHOVER_PRIORITY:-"-2"}" -PUSHOVER_SOUND="${PUSHOVER_SOUND:-}" - -# -# Print defined variables -# -for pushover_vars in ${!PUSHOVER_*} -do - declare -n var="${pushover_vars}" - [[ -n "${var}" && "${PUSHOVER_DEBUG}" = "true" ]] && printf "%s - %s=%s\n" "$(date)" "${!var}" "${var}" -done - -# -# Validate required variables are set -# -if [ ${#ERRORS[@]} -gt 0 ]; then - for err in "${ERRORS[@]}"; do printf "%s - Undefined variable %s\n" "$(date)" "${err}" >&2; done - exit 1 -fi - -# -# Send Notification on Test -# -if [[ "${radarr_eventtype:-}" == "Test" ]]; then - PUSHOVER_TITLE="Test Notification" - PUSHOVER_MESSAGE="Howdy this is a test notification from ${radarr_instancename:-Radarr}" -fi - -# -# Send notification on Download or Upgrade -# -if [[ "${radarr_eventtype:-}" == "Download" ]]; then - if [[ "${radarr_isupgrade}" == "True" ]]; then pushover_title="Upgraded"; else pushover_title="Downloaded"; fi - printf -v PUSHOVER_TITLE "Movie %s" "${pushover_title}" - printf -v PUSHOVER_MESSAGE "%s (%s)\n%s\n\nClient: %s\nQuality: %s\nSize: %s" \ - "${radarr_movie_title}" \ - "${radarr_movie_year}" \ - "${radarr_movie_overview}" \ - "${radarr_download_client}" \ - "${radarr_moviefile_quality}" \ - "$(numfmt --to iec --format "%8.2f" "${radarr_release_size}")" - printf -v PUSHOVER_URL "%s/movie/%s" "${radarr_applicationurl:-localhost}" "${radarr_movie_tmdbid}" - printf -v PUSHOVER_URL_TITLE "View movie in %s" "${radarr_instancename:-Radarr}" -fi - -# -# Send notification on Manual Interaction Required -# -if [[ "${radarr_eventtype:-}" == "ManualInteractionRequired" ]]; then - PUSHOVER_PRIORITY="1" - printf -v PUSHOVER_TITLE "Movie requires manual interaction" - printf -v PUSHOVER_MESSAGE "%s (%s)\nClient: %s" \ - "${radarr_movie_title}" \ - "${radarr_movie_year}" \ - "${radarr_download_client}" - printf -v PUSHOVER_URL "%s/activity/queue" "${radarr_applicationurl:-localhost}" - printf -v PUSHOVER_URL_TITLE "View queue in %s" "${radarr_instancename:-Radarr}" -fi - -notification=$(jq -n \ - --arg token "${PUSHOVER_TOKEN}" \ - --arg user "${PUSHOVER_USER_KEY}" \ - --arg title "${PUSHOVER_TITLE}" \ - --arg message "${PUSHOVER_MESSAGE}" \ - --arg url "${PUSHOVER_URL}" \ - --arg url_title "${PUSHOVER_URL_TITLE}" \ - --arg priority "${PUSHOVER_PRIORITY}" \ - --arg sound "${PUSHOVER_SOUND}" \ - --arg device "${PUSHOVER_DEVICE}" \ - --arg html "1" \ - '{token: $token, user: $user, title: $title, message: $message, url: $url, url_title: $url_title, priority: $priority, sound: $sound, device: $device, html: $html}' \ -) - -status_code=$(curl \ - --write-out "%{http_code}" \ - --silent \ - --output /dev/null \ - --header "Content-Type: application/json" \ - --data-binary "${notification}" \ - --request POST "https://api.pushover.net/1/messages.json" \ -) - -if [[ "${status_code}" -ne 200 ]] ; then - printf "%s - Unable to send notification with status code %s and payload: %s\n" "$(date)" "${status_code}" "$(echo "${notification}" | jq -c)" >&2 - exit 1 -else - printf "%s - Sent notification with status code %s and payload: %s\n" "$(date)" "${status_code}" "$(echo "${notification}" | jq -c)" -fi diff --git a/kubernetes/apps/default/radarr/ks.yaml b/kubernetes/apps/default/radarr/ks.yaml index 81b9d5e8..6edffe9e 100644 --- a/kubernetes/apps/default/radarr/ks.yaml +++ b/kubernetes/apps/default/radarr/ks.yaml @@ -13,6 +13,7 @@ spec: dependsOn: - name: crunchy-postgres-operator - name: external-secrets-stores + - name: openebs-cluster path: ./kubernetes/apps/default/radarr/app prune: true sourceRef: