From 1f551b086dca92cf3572c12f1cc196edbbd92da6 Mon Sep 17 00:00:00 2001 From: StevenMcElligott <89483932+StevenMcElligott@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:03:10 -0400 Subject: [PATCH] migrate(Owntracks): Migrate to New Common BREAKING (#10686) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Looks cool so I decided to migrate it ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 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 - [ ] ⬆️ 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/owntracks/Chart.yaml | 4 +- charts/incubator/owntracks/questions.yaml | 46 ++++++++------- .../incubator/owntracks/templates/NOTES.txt | 1 + .../incubator/owntracks/templates/_secret.tpl | 12 +--- .../incubator/owntracks/templates/common.yaml | 11 ++-- charts/incubator/owntracks/values.yaml | 56 +++++++++---------- 6 files changed, 66 insertions(+), 64 deletions(-) create mode 100644 charts/incubator/owntracks/templates/NOTES.txt diff --git a/charts/incubator/owntracks/Chart.yaml b/charts/incubator/owntracks/Chart.yaml index 3ee56eee28c..3a4f7d17a10 100644 --- a/charts/incubator/owntracks/Chart.yaml +++ b/charts/incubator/owntracks/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "0.9.3" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 + version: 13.2.1 deprecated: false description: The OwnTracks Recorder is a lightweight program for storing and accessing location data published via MQTT (or HTTP) by the OwnTracks apps. home: https://truecharts.org/charts/incubator/owntracks @@ -22,7 +22,7 @@ sources: - https://github.com/owntracks/recorder - https://github.com/owntracks/docker-recorder type: application -version: 0.0.7 +version: 1.0.0 annotations: truecharts.org/catagories: | - media diff --git a/charts/incubator/owntracks/questions.yaml b/charts/incubator/owntracks/questions.yaml index 6fc16945f27..44b1fb193bc 100644 --- a/charts/incubator/owntracks/questions.yaml +++ b/charts/incubator/owntracks/questions.yaml @@ -114,6 +114,14 @@ questions: additional_attrs: true type: dict attrs: +# Include{persistenceBasic} + - variable: config + label: App Storage + description: Stores the config data. + schema: + additional_attrs: true + type: dict + attrs: # Include{persistenceBasic} # Include{persistenceList} # Include{ingressRoot} @@ -128,29 +136,29 @@ questions: # Include{ingressTraefik} # Include{ingressAdvanced} # Include{ingressList} -# Include{securityContextRoot} - - variable: runAsUser - label: runAsUser - description: The UserID of the user running the application - schema: - type: int - default: 568 - - variable: runAsGroup - label: runAsGroup - description: The groupID this App of the user running the application - schema: - type: int - default: 568 +# Include{securityContextRoot} + - variable: runAsUser + label: "runAsUser" + description: "The UserID of the user running the application" + schema: + type: int + default: 568 + - variable: runAsGroup + label: "runAsGroup" + description: "The groupID of the user running the application" + schema: + type: int + default: 568 # 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/owntracks/templates/NOTES.txt b/charts/incubator/owntracks/templates/NOTES.txt new file mode 100644 index 00000000000..efcb74cb772 --- /dev/null +++ b/charts/incubator/owntracks/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "tc.v1.common.lib.chart.notes" $ -}} diff --git a/charts/incubator/owntracks/templates/_secret.tpl b/charts/incubator/owntracks/templates/_secret.tpl index 00c3149236d..ac63181a6ae 100644 --- a/charts/incubator/owntracks/templates/_secret.tpl +++ b/charts/incubator/owntracks/templates/_secret.tpl @@ -1,16 +1,8 @@ {{/* Define the configmap */}} {{- define "owntracks.secret" -}} -{{- $configName := printf "%s-secret" (include "tc.common.names.fullname" .) }} ---- -apiVersion: v1 -kind: Secret -type: Opaque -metadata: - name: {{ $configName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -stringData: +enabled: true +data: OTR_HTTPPORT: {{ .Values.service.main.ports.main.port | quote }} {{- with .Values.owntracks.otr_host }} OTR_HOST: {{ . | quote }} diff --git a/charts/incubator/owntracks/templates/common.yaml b/charts/incubator/owntracks/templates/common.yaml index c7672cba5d5..500eb7b7cb4 100644 --- a/charts/incubator/owntracks/templates/common.yaml +++ b/charts/incubator/owntracks/templates/common.yaml @@ -1,8 +1,11 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.common.loader.init" . }} +{{- include "tc.v1.common.loader.init" . }} -{{/* Render secret */}} -{{- include "owntracks.secret" . }} +{{/* Render secrets for owntracks */}} +{{- $secret := include "owntracks.secret" . | fromYaml -}} +{{- if $secret -}} + {{- $_ := set .Values.secret "secret" $secret -}} +{{- end -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/incubator/owntracks/values.yaml b/charts/incubator/owntracks/values.yaml index 1e1437fbe81..5fe8e7cc960 100644 --- a/charts/incubator/owntracks/values.yaml +++ b/charts/incubator/owntracks/values.yaml @@ -3,8 +3,6 @@ image: pullPolicy: IfNotPresent tag: 0.9.3@sha256:797eb8958677b80bbb438251f75a51984b578c4919f0fe2c3a9bbf0e866a8b43 -# securityContext: -# readOnlyRootFilesystem: false owntracks: otr_host: "" @@ -17,44 +15,44 @@ owntracks: otr_serverlabel: OwnTracks otr_lmdbsize: 104857600000 -envFrom: - - secretRef: - name: '{{ include "tc.common.names.fullname" . }}-secret' service: main: ports: main: - protocol: HTTP port: 8083 + protocol: http -probes: - liveness: - enabled: true - custom: true - spec: - exec: - command: - - /usr/sbin/recorder-health.sh - readiness: - enabled: true - custom: true - spec: - exec: - command: - - /usr/sbin/recorder-health.sh - startup: - enabled: true - custom: true - spec: - exec: - command: - - /usr/sbin/recorder-health.sh +workload: + main: + podSpec: + containers: + main: + probes: + liveness: + enabled: true + type: exec + command: /usr/sbin/recorder-health.sh + readiness: + enabled: true + type: exec + command: /usr/sbin/recorder-health.sh + startup: + enabled: true + type: exec + command: /usr/sbin/recorder-health.sh + envFrom: + - secretRef: + name: "secret" persistence: store: enabled: true mountPath: /store + config: + enabled: true + mountPath: /config portal: - enabled: true + open: + enabled: true