From e974a01cb30403a025822f7e01b59f2be59c87c8 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Mon, 3 Jul 2023 16:44:31 -0400 Subject: [PATCH] migrate(plexanisync) migrate to new common (#10001) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [X] ⚠️ 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 opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ 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._ --------- Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/incubator/plexanisync/Chart.yaml | 6 +-- charts/incubator/plexanisync/questions.yaml | 17 ++++--- .../incubator/plexanisync/templates/NOTES.txt | 1 + .../plexanisync/templates/_config.tpl | 7 +++ .../plexanisync/templates/_secret.tpl | 37 ++++----------- .../plexanisync/templates/common.yaml | 17 +++++-- charts/incubator/plexanisync/values.yaml | 47 ++++++++++--------- 7 files changed, 66 insertions(+), 66 deletions(-) create mode 100644 charts/incubator/plexanisync/templates/NOTES.txt create mode 100644 charts/incubator/plexanisync/templates/_config.tpl diff --git a/charts/incubator/plexanisync/Chart.yaml b/charts/incubator/plexanisync/Chart.yaml index f0abc4b7962..0c878525053 100644 --- a/charts/incubator/plexanisync/Chart.yaml +++ b/charts/incubator/plexanisync/Chart.yaml @@ -1,9 +1,9 @@ apiVersion: v2 -appVersion: "latest" +appVersion: "1.3.25" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 + version: 12.14.6 deprecated: false description: Plex to AniList Sync. home: https://truecharts.org/charts/incubator/plexanisync @@ -22,7 +22,7 @@ sources: - https://github.com/RickDB/PlexAniSync - https://github.com/RickDB/PlexAniSync/pkgs/container/plexanisync type: application -version: 2.0.0 +version: 3.0.0 annotations: truecharts.org/catagories: | - media diff --git a/charts/incubator/plexanisync/questions.yaml b/charts/incubator/plexanisync/questions.yaml index 173a739523b..7c008467bd6 100644 --- a/charts/incubator/plexanisync/questions.yaml +++ b/charts/incubator/plexanisync/questions.yaml @@ -4,13 +4,13 @@ questions: # Include{global} # Include{workload} # Include{workloadDeployment} - # Include{replicas1} # Include{podSpec} # Include{containerMain} - # Include{containerBasic} # Include{containerAdvanced} +# Include{containerConfig} +# Include{podOptions} - variable: plexanisync group: App Configuration label: PlexAniSync Configuration @@ -31,16 +31,16 @@ questions: additional_attrs: true type: dict attrs: - - variable: plex_section - label: Plex Section + - variable: anime_section + label: Anime Section description: The libraries where your anime resides. schema: type: list required: true default: [] items: - - variable: plex_section_library_entry - label: Plex Section Library Entry + - variable: anime_section_library_entry + label: Anime Section Library Entry description: Single library per entry. schema: type: string @@ -227,14 +227,13 @@ questions: type: string required: true default: "" -# Include{containerConfig} -# Include{podOptions} + # Include{serviceExpertRoot} # Include{serviceExpert} # Include{serviceList} # Include{persistenceList} - # Include{securityContextRoot} + - variable: runAsUser label: "runAsUser" description: "The UserID of the user running the application" diff --git a/charts/incubator/plexanisync/templates/NOTES.txt b/charts/incubator/plexanisync/templates/NOTES.txt new file mode 100644 index 00000000000..efcb74cb772 --- /dev/null +++ b/charts/incubator/plexanisync/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "tc.v1.common.lib.chart.notes" $ -}} diff --git a/charts/incubator/plexanisync/templates/_config.tpl b/charts/incubator/plexanisync/templates/_config.tpl new file mode 100644 index 00000000000..8679eb8b753 --- /dev/null +++ b/charts/incubator/plexanisync/templates/_config.tpl @@ -0,0 +1,7 @@ +{{- define "plexanisync.config" -}} +{{- $pas := .Values.plexanisync }} +enabled: true +data: + SETTINGS_FILE: {{ .Values.persistence.settings.mountPath }} + INTERVAL: {{ $pas.interval | quote }} +{{- end -}} diff --git a/charts/incubator/plexanisync/templates/_secret.tpl b/charts/incubator/plexanisync/templates/_secret.tpl index da5a9502768..728cbbd00b1 100644 --- a/charts/incubator/plexanisync/templates/_secret.tpl +++ b/charts/incubator/plexanisync/templates/_secret.tpl @@ -1,31 +1,13 @@ -{{/* Define the secret */}} {{- define "plexanisync.secret" -}} -{{- $secretName := printf "%s-secret" (include "tc.common.names.fullname" .) }} -{{- $secretConfigName := printf "%s-config-secret" (include "tc.common.names.fullname" .) }} -{{- $pas := .Values.plexanisync }} +{{- $pas := .Values.plexanisync -}} {{- $cm := .Values.custom_mappings }} ---- -apiVersion: v1 -kind: Secret -metadata: - name: {{ $secretName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -stringData: - SETTINGS_FILE: {{ .Values.persistence.settings.mountPath }} - INTERVAL: {{ $pas.interval | quote }} ---- -apiVersion: v1 -kind: Secret -metadata: - name: {{ $secretConfigName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -stringData: + +enabled: true +data: settings.ini: | [PLEX] - anime_section = {{ join "|" $pas.plex.plex_section }} + anime_section = {{ join "|" $pas.plex.anime_section }} authentication_method = {{ $pas.plex.plex_auth_method }} @@ -52,6 +34,7 @@ stringData: skip_list_update = {{ ternary "True" "False" $pas.anilist.skip_list_update }} username = {{ $pas.anilist.ani_username }} log_failed_matches = {{ ternary "True" "False" $pas.anilist.log_failed_matches }} + custom_mappings.yaml: | # https://github.com/RickDB/PlexAniSync/blob/master/custom_mappings.yaml.example {{- if $cm }} @@ -60,7 +43,7 @@ stringData: {{- range $url := . }} - {{ . | quote }} {{- end }} - {{- end }} + {{- end -}} {{- with $cm.entries }} entries: @@ -72,7 +55,7 @@ stringData: - season: {{ $season_entry.season }} anilist-id: {{ $season_entry.anilist_id }} {{- end }} - {{- end }} + {{- end -}} {{- with $entry.synonyms }} synonyms: {{- range $synonym := . }} @@ -80,6 +63,6 @@ stringData: {{- end }} {{- end }} {{- end }} - {{- end }} - {{- end }} + {{- end -}} + {{- end -}} {{- end -}} diff --git a/charts/incubator/plexanisync/templates/common.yaml b/charts/incubator/plexanisync/templates/common.yaml index b476d39f3d6..87b68afe11f 100644 --- a/charts/incubator/plexanisync/templates/common.yaml +++ b/charts/incubator/plexanisync/templates/common.yaml @@ -1,15 +1,22 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.common.loader.init" . }} +{{- include "tc.v1.common.loader.init" . }} -{{/* Render secret */}} -{{- include "plexanisync.secret" . }} +{{- $config := (include "plexanisync.config" . | fromYaml) }} +{{- if $config -}} + {{- $_ := set .Values.configmap "config" $config -}} +{{- end -}} + +{{- $secret := (include "plexanisync.secret" . | fromYaml) }} +{{- if $secret -}} + {{- $_ := set .Values.secret "secret" $secret -}} +{{- end -}} {{- define "plexanisync.custom.mappings" -}} enabled: true type: secret readOnly: true defaultMode: "0600" -objectName: '{{ include "tc.common.names.fullname" . }}-config-secret' +objectName: secret mountPath: /plexanisync/custom_mappings.yaml subPath: custom_mappings.yaml {{- end -}} @@ -19,4 +26,4 @@ subPath: custom_mappings.yaml {{- end -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/incubator/plexanisync/values.yaml b/charts/incubator/plexanisync/values.yaml index d6e18b7f8fb..3dd249ec325 100644 --- a/charts/incubator/plexanisync/values.yaml +++ b/charts/incubator/plexanisync/values.yaml @@ -1,20 +1,18 @@ image: repository: tccr.io/truecharts/plexanisync pullPolicy: IfNotPresent - tag: latest@sha256:f9db346735f4e316b0c363d1bf73826daa7d5feafed20c2d73bdb732ff2c798c + tag: v1.3.25@sha256:f9db346735f4e316b0c363d1bf73826daa7d5feafed20c2d73bdb732ff2c798c securityContext: - readOnlyRootFilesystem: false - runAsNonRoot: false - -podSecurityContext: - runAsUser: 0 - runAsGroup: 0 - + container: + runAsNonRoot: false + readOnlyRootFilesystem: false + runAsUser: 0 + runAsGroup: 0 plexanisync: interval: 3600 plex: - plex_section: + anime_section: [] # - section1 # - section2 @@ -50,9 +48,21 @@ custom_mappings: # synonyms: # - asfdasd -envFrom: - - secretRef: - name: '{{ include "tc.common.names.fullname" . }}-secret' +workload: + main: + podSpec: + containers: + main: + probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false + envFrom: + - configMapRef: + name: config service: main: @@ -61,23 +71,16 @@ service: main: enabled: false -probes: - liveness: - enabled: false - readiness: - enabled: false - startup: - enabled: false - persistence: settings: enabled: true type: secret readOnly: true defaultMode: "0600" - objectName: '{{ include "tc.common.names.fullname" . }}-config-secret' + objectName: secret mountPath: /plexanisync/settings.ini subPath: settings.ini portal: - enabled: false + open: + enabled: false