From 570a777c81c6d1e2dd4ad9f13c52374e67052445 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:25:23 -0500 Subject: [PATCH] fix(autobrr) mount config.toml for autobrr (#17740) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** fixes issues with ingress due to the host needing to be set to 0.0.0.0 and additional configs options set. ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [X] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- charts/stable/autobrr/Chart.yaml | 2 +- charts/stable/autobrr/questions.yaml | 25 ++++++ .../stable/autobrr/templates/_configmap.tpl | 84 +++++++++++++++++++ charts/stable/autobrr/templates/common.yaml | 12 ++- charts/stable/autobrr/values.yaml | 39 +++++---- 5 files changed, 140 insertions(+), 22 deletions(-) create mode 100644 charts/stable/autobrr/templates/_configmap.tpl diff --git a/charts/stable/autobrr/Chart.yaml b/charts/stable/autobrr/Chart.yaml index 892bc101a62..f4c5aa83a67 100644 --- a/charts/stable/autobrr/Chart.yaml +++ b/charts/stable/autobrr/Chart.yaml @@ -34,4 +34,4 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/stable/autobrr - https://ghcr.io/autobrr/autobrr type: application -version: 7.3.0 +version: 7.3.1 diff --git a/charts/stable/autobrr/questions.yaml b/charts/stable/autobrr/questions.yaml index 3ffb1c88230..c9ffdfa3e54 100644 --- a/charts/stable/autobrr/questions.yaml +++ b/charts/stable/autobrr/questions.yaml @@ -12,6 +12,31 @@ questions: # Include{containerBasic} # Include{containerAdvanced} # Include{containerConfig} + + - variable: autobrr + group: App Configuration + label: Autobrr Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: log_level + label: Log Level + schema: + type: string + default: "DEBUG" + enum: + - value: "ERROR" + description: "Error" + - value: "DEBUG" + description: "Debug" + - value: "INFO" + description: "Info" + - value: "WARN" + description: "Warn" + - value: "TRACE" + description: "Trace" + # Include{podOptions} # Include{serviceRoot} - variable: main diff --git a/charts/stable/autobrr/templates/_configmap.tpl b/charts/stable/autobrr/templates/_configmap.tpl new file mode 100644 index 00000000000..6516653db43 --- /dev/null +++ b/charts/stable/autobrr/templates/_configmap.tpl @@ -0,0 +1,84 @@ +{{/* Define the configmap */}} +{{- define "autobrr.configmaps" -}} +{{- $fullname := (include "tc.v1.common.lib.chart.names.fullname" $) -}} +{{- $secretName := printf "%s-autobrr-secret" (include "tc.v1.common.lib.chart.names.fullname" .) }} + +{{- $mainPort := .Values.service.main.ports.main.port -}} +{{- $logLevel := .Values.autobrr.log_level -}} + +{{- $sessionSecret := randAlphaNum 32 -}} + + {{- with lookup "v1" "Secret" .Release.Namespace $secretName -}} + {{- $sessionSecret = index .data "sessionSecret" | b64dec -}} + {{- end }} + +autobrr-config: + enabled: true + data: + config.toml: | + # config.toml + # Hostname / IP + # + # Default: "localhost" + # + host = "0.0.0.0" + + # Port + # + # Default: 7474 + # + port = {{ $mainPort }} + + # Base url + # Set custom baseUrl eg /autobrr/ to serve in subdirectory. + # Not needed for subdomain, or by accessing with the :port directly. + # + # Optional + # + baseUrl = "/" + + # autobrr logs file + # If not defined, logs to stdout + # + # Optional + # + #logPath = "log/autobrr.log" + + # Log level + # + # Default: "DEBUG" + # + # Options: "ERROR", "DEBUG", "INFO", "WARN", "TRACE" + # + logLevel = "{{ $logLevel }}" + + # Log Max Size + # + # Default: 50 + # + # Max log size in megabytes + # + #logMaxSize = 50 + + # Log Max Backups + # + # Default: 3 + # + # Max amount of old log files + # + #logMaxBackups = 3 + + # Check for updates + # + # Default: true + # + checkForUpdates = true + + # Session secret + # + sessionSecret = "{{ $sessionSecret }}" + + # Custom definitions + # + #customDefinitions = "test/definitions" +{{- end -}} diff --git a/charts/stable/autobrr/templates/common.yaml b/charts/stable/autobrr/templates/common.yaml index b51394e00a4..177ccd838e1 100644 --- a/charts/stable/autobrr/templates/common.yaml +++ b/charts/stable/autobrr/templates/common.yaml @@ -1 +1,11 @@ -{{ include "tc.v1.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . -}} + +{{/* Render configmaps for all pods */}} +{{- $configmaps := include "autobrr.configmaps" . | fromYaml -}} +{{- if $configmaps -}} + {{- $_ := mustMergeOverwrite .Values.configmap $configmaps -}} +{{- end -}} + +{{/* Render the templates */}} +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/stable/autobrr/values.yaml b/charts/stable/autobrr/values.yaml index 3cdf43e4bb4..8fbfcc8b63c 100644 --- a/charts/stable/autobrr/values.yaml +++ b/charts/stable/autobrr/values.yaml @@ -2,13 +2,18 @@ image: repository: ghcr.io/autobrr/autobrr pullPolicy: IfNotPresent tag: v1.36.0@sha256:14eaf6809f431cd38afdfa3e498e01e88b9a86a54ea9ecb8ae608d48d5aa81f0 + service: main: ports: main: - port: 7474 protocol: http - targetPort: 7474 + port: 7474 + +autobrr: + # ERROR | DEBUG |INFO | WARN | TRACE + log_level: DEBUG + workload: main: podSpec: @@ -16,30 +21,24 @@ workload: main: probes: liveness: - enabled: true - type: exec - command: - - /bin/sh - - -c - - curl --fail localhost:7474/ + type: http readiness: - enabled: true - type: exec - command: - - /bin/sh - - -c - - curl --fail localhost:7474/ + type: http startup: - enabled: true - type: exec - command: - - /bin/sh - - -c - - curl --fail localhost:7474/ + type: tcp + persistence: config: enabled: true mountPath: /config + autobrr-config: + enabled: true + type: configmap + objectName: autobrr-config + mountPath: /config/config.toml + subPath: config.toml + readOnly: true + portal: open: enabled: true