From e59e0e3360e197fd1537caed3eca526656d060c6 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Sun, 24 Sep 2023 07:28:31 -0400 Subject: [PATCH] migrate(plextraktsync) migrate plextraktsync to new common **BREAKING CHANGES** (#12887) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** migrate app and set a static semver tag ⚒️ 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: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/incubator/plextraktsync/Chart.yaml | 16 ++-- charts/incubator/plextraktsync/questions.yaml | 76 +++++++++++-------- .../plextraktsync/templates/NOTES.txt | 1 + .../plextraktsync/templates/_cronjob.tpl | 73 ++++++------------ .../plextraktsync/templates/common.yaml | 14 +++- charts/incubator/plextraktsync/values.yaml | 61 ++++++++------- 6 files changed, 119 insertions(+), 122 deletions(-) create mode 100644 charts/incubator/plextraktsync/templates/NOTES.txt diff --git a/charts/incubator/plextraktsync/Chart.yaml b/charts/incubator/plextraktsync/Chart.yaml index dee805c1480..38d071c536a 100644 --- a/charts/incubator/plextraktsync/Chart.yaml +++ b/charts/incubator/plextraktsync/Chart.yaml @@ -1,14 +1,9 @@ -annotations: - truecharts.org/SCALE-support: "true" - truecharts.org/catagories: | - - Tools-Utilities - - MediaApp-Other apiVersion: v2 -appVersion: "latest" +appVersion: "0.27.7" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 + version: 14.0.3 deprecated: false description: Two-way-sync between trakt.tv and Plex Media Server. home: https://truecharts.org/charts/incubator/plextraktsync @@ -27,4 +22,9 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/plextraktsync - https://github.com/Taxel/PlexTraktSync type: application -version: 3.0.19 +version: 4.0.0 +annotations: + truecharts.org/catagories: | + - Tools-Utilities + - MediaApp-Other + truecharts.org/SCALE-support: "true" diff --git a/charts/incubator/plextraktsync/questions.yaml b/charts/incubator/plextraktsync/questions.yaml index 97c8131349f..3d4bbd82374 100644 --- a/charts/incubator/plextraktsync/questions.yaml +++ b/charts/incubator/plextraktsync/questions.yaml @@ -8,65 +8,75 @@ questions: # Include{replicas1} # Include{podSpec} # Include{containerMain} + # Include{containerBasic} # Include{containerAdvanced} - - variable: plexTraktSync + - variable: plextraktsync group: App Configuration label: Plex Trakt Sync Config schema: additional_attrs: true type: dict attrs: - - variable: task - label: Task - description: Task to run on schedule. Leave empty for default. Default is + - variable: cron_enabled + label: "Enable cronjob" schema: - type: string - default: "" - - variable: schedule - label: Schedule - description: How often to run the task - schema: - type: string - default: "0 */6 * * *" + type: boolean + default: true + show_subquestions_if: true + subquestions: + - variable: task + label: Task + description: Task to run on schedule. Leave empty for default. Default is + schema: + type: string + default: "" + - variable: schedule + label: Schedule + description: How often to run the task. + schema: + type: string + default: "0 */6 * * *" + # Include{containerConfig} +# Include{podOptions} # Include{serviceExpertRoot} # Include{serviceExpert} # Include{serviceList} # Include{persistenceRoot} - variable: config - label: Config Storage - description: Container Path Config + label: App Config Storage + description: Stores the Application Configuration. schema: additional_attrs: true type: dict attrs: # Include{persistenceBasic} # Include{persistenceList} +# Include{securityContextRoot} -# Include{podSecurityContextRoot} - - variable: runAsUser - label: runAsUser - description: The UserID of the user running the application - schema: - type: int - default: 0 - - variable: runAsGroup - label: runAsGroup - description: The groupID this App of the user running the application - schema: - type: int - default: 0 + - variable: runAsUser + label: "runAsUser" + description: "The UserID of the user running the application" + schema: + type: int + default: 0 + - variable: runAsGroup + label: "runAsGroup" + description: "The groupID this App of the user running the application" + schema: + type: int + default: 0 # Include{securityContextContainer} # Include{securityContextAdvanced} # Include{securityContextPod} - - variable: fsGroup - label: fsGroup - description: The group that should own ALL storage. - schema: - type: int - default: 568 + - variable: fsGroup + label: "fsGroup" + description: "The group that should own ALL storage." + schema: + type: int + default: 568 # Include{resources} # Include{advanced} diff --git a/charts/incubator/plextraktsync/templates/NOTES.txt b/charts/incubator/plextraktsync/templates/NOTES.txt new file mode 100644 index 00000000000..efcb74cb772 --- /dev/null +++ b/charts/incubator/plextraktsync/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "tc.v1.common.lib.chart.notes" $ -}} diff --git a/charts/incubator/plextraktsync/templates/_cronjob.tpl b/charts/incubator/plextraktsync/templates/_cronjob.tpl index bb874ccc23e..2ad8eb383da 100644 --- a/charts/incubator/plextraktsync/templates/_cronjob.tpl +++ b/charts/incubator/plextraktsync/templates/_cronjob.tpl @@ -1,52 +1,27 @@ {{/* Define the cronjob */}} {{- define "plextraktsync.cronjob" -}} -{{- $jobName := include "tc.common.names.fullname" . }} - ---- -apiVersion: batch/v1 -kind: CronJob -metadata: - name: {{ printf "%s-cronjob" $jobName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -spec: - schedule: "{{ .Values.plexTraktSync.schedule }}" - concurrencyPolicy: Forbid - {{- with .Values.cronjob.failedJobsHistoryLimit }} - failedJobsHistoryLimit: {{ . }} - {{- end }} - {{- with .Values.cronjob.successfulJobsHistoryLimit }} - successfulJobsHistoryLimit: {{ . }} - {{- end }} - jobTemplate: - metadata: - spec: - template: - metadata: - spec: - securityContext: - runAsUser: 0 - runAsGroup: 0 - restartPolicy: Never - containers: - - name: {{ .Chart.Name }} - securityContext: - privileged: false - readOnlyRootFilesystem: false - allowPrivilegeEscalation: false - runAsNonRoot: false - capabilities: - drop: - - ALL - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - command: - - plextraktsync - {{- if .Values.plexTraktSync.task }} - - {{ .Values.plexTraktSync.task }} - {{- else }} - - sync --sync=all - {{- end }} - resources: -{{ toYaml .Values.resources | indent 16 }} - +enabled: true +type: "CronJob" +schedule: "{{ .Values.plextraktsync.schedule }}" +podSpec: + restartPolicy: Never + containers: + cron: + enabled: true + primary: true + imageSelector: "image" + command: + - plextraktsync + {{- if .Values.plextraktsync.task }} + - {{ .Values.plextraktsync.task }} + {{- else }} + - sync --sync=all + {{- end }} + probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false {{- end -}} diff --git a/charts/incubator/plextraktsync/templates/common.yaml b/charts/incubator/plextraktsync/templates/common.yaml index 1d3683f7681..f21ed3d43ed 100644 --- a/charts/incubator/plextraktsync/templates/common.yaml +++ b/charts/incubator/plextraktsync/templates/common.yaml @@ -1,7 +1,13 @@ -{{- include "tc.common.loader.init" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . }} -{{/* Render cronjob for clamav */}} -{{- include "plextraktsync.cronjob" . }} +{{- if and .Values.plextraktsync.cron_enabled .Values.plextraktsync.schedule}} + {{/* Render cronjob for plextraktsync */}} + {{- $cronjob := include "plextraktsync.cronjob" . | fromYaml -}} + {{- if $cronjob -}} + {{- $_ := set .Values.workload "cron" $cronjob -}} + {{- end -}} +{{- end -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/incubator/plextraktsync/values.yaml b/charts/incubator/plextraktsync/values.yaml index c22ea016559..8a4514b0340 100644 --- a/charts/incubator/plextraktsync/values.yaml +++ b/charts/incubator/plextraktsync/values.yaml @@ -1,30 +1,14 @@ image: pullPolicy: IfNotPresent repository: tccr.io/truecharts/plextraktsync - tag: latest@sha256:30cf60eb8d93995c358d88912c5dd7acf101a5673c0664016ca275718555d948 - -podSecurityContext: - runAsGroup: 0 - runAsUser: 0 + tag: v0.27.7@sha256:cefad9eed53955d91f1020d95c5f09f0f96c8cc5e89bcd25036cd6dd786d2a5d securityContext: - readOnlyRootFilesystem: false - runAsNonRoot: false - -tty: true -stdin: true - -plexTraktSync: - task: "" - schedule: "0 */6 * * *" - -probes: - liveness: - enabled: false - readiness: - enabled: false - startup: - enabled: false + container: + runAsNonRoot: false + readOnlyRootFilesystem: false + runAsUser: 0 + runAsGroup: 0 service: main: @@ -33,15 +17,36 @@ service: main: enabled: false +plextraktsync: + cron_enabled: true + task: "" + schedule: "0 */6 * * *" + +cronjob: + annotations: {} + failedJobsHistoryLimit: 5 + successfulJobsHistoryLimit: 2 + +workload: + main: + podSpec: + containers: + main: + tty: true + stdin: true + probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false + persistence: config: enabled: true mountPath: /app/config portal: - enabled: false - -cronjob: - annotations: {} - failedJobsHistoryLimit: 5 - successfulJobsHistoryLimit: 2 + open: + enabled: false