From 7ef0a62864811bae4d7b752d4119a4dc576c86e7 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Thu, 23 Nov 2023 19:17:57 -0500 Subject: [PATCH] migrate(nitter) migrate to new common (#15246) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Migrate nitter to new common and update chart ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [X] ⚠️ 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:** - [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._ --- charts/incubator/nitter/Chart.yaml | 6 +- charts/incubator/nitter/questions.yaml | 40 ++++++----- charts/incubator/nitter/templates/NOTES.txt | 1 + .../incubator/nitter/templates/_configmap.tpl | 59 ++++++++++++++++ charts/incubator/nitter/templates/_secret.tpl | 70 ------------------- charts/incubator/nitter/templates/common.yaml | 10 ++- charts/incubator/nitter/values.yaml | 54 ++++++++------ 7 files changed, 122 insertions(+), 118 deletions(-) create mode 100644 charts/incubator/nitter/templates/NOTES.txt create mode 100644 charts/incubator/nitter/templates/_configmap.tpl delete mode 100644 charts/incubator/nitter/templates/_secret.tpl diff --git a/charts/incubator/nitter/Chart.yaml b/charts/incubator/nitter/Chart.yaml index f85b7ad0ff7..052edcad9c5 100644 --- a/charts/incubator/nitter/Chart.yaml +++ b/charts/incubator/nitter/Chart.yaml @@ -3,11 +3,11 @@ appVersion: "latest" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 + version: 14.3.5 - condition: redis.enabled name: redis repository: https://deps.truecharts.org - version: 5.0.33 + version: 6.0.66 deprecated: false description: A free and open source alternative Twitter front-end focused on privacy and performance. home: https://truecharts.org/charts/incubator/nitter @@ -25,7 +25,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/nitter - https://github.com/zedeus/nitter type: application -version: 1.0.12 +version: 2.0.0 annotations: truecharts.org/category: media truecharts.org/SCALE-support: "true" diff --git a/charts/incubator/nitter/questions.yaml b/charts/incubator/nitter/questions.yaml index 6bd40218db0..07f48986256 100644 --- a/charts/incubator/nitter/questions.yaml +++ b/charts/incubator/nitter/questions.yaml @@ -10,6 +10,7 @@ questions: # Include{replicas1} # Include{podSpec} # Include{containerMain} + # Include{containerBasic} # Include{containerAdvanced} @@ -172,6 +173,7 @@ questions: schema: type: boolean default: false + # Include{containerConfig} # Include{serviceRoot} - variable: main @@ -214,27 +216,27 @@ questions: # 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 + - 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} @@ -242,4 +244,4 @@ questions: # Include{codeserver} # Include{netshoot} # Include{vpn} -# Include{documentation} +# Include{documentation} \ No newline at end of file diff --git a/charts/incubator/nitter/templates/NOTES.txt b/charts/incubator/nitter/templates/NOTES.txt new file mode 100644 index 00000000000..efcb74cb772 --- /dev/null +++ b/charts/incubator/nitter/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "tc.v1.common.lib.chart.notes" $ -}} diff --git a/charts/incubator/nitter/templates/_configmap.tpl b/charts/incubator/nitter/templates/_configmap.tpl new file mode 100644 index 00000000000..aaa03b9b4eb --- /dev/null +++ b/charts/incubator/nitter/templates/_configmap.tpl @@ -0,0 +1,59 @@ +{{/* Define the configmap */}} +{{- define "nitter.configmaps" -}} +{{- $fullname := (include "tc.v1.common.lib.chart.names.fullname" $) -}} + +{{- $config := .Values.nitter.config -}} +{{- $general := .Values.nitter.general -}} +{{- $cache := .Values.nitter.cache -}} +{{- $preferences := .Values.nitter.preferences -}} + +{{- $redisHost := .Values.redis.creds.plainhost | trimAll "\"" -}} +{{- $redisPass := .Values.redis.creds.redisPassword | trimAll "\"" -}} + +{{- $hmacKey := randAlphaNum 32 -}} + + {{- with lookup "v1" "Secret" .Release.Namespace $fullname -}} + {{- $hmacKey = index .data "hmacKey" | b64dec -}} + {{- end }} + +nitter-config: + enabled: true + data: + nitter.conf: | + [Server] + https = false + address = "0.0.0.0" + staticDir = "./public" + port = {{ .Values.service.main.ports.main.port }} + httpMaxConnections = {{ $general.httpMaxConnections }} + title = {{ $general.title | quote }} + hostname = {{ $general.hostname | quote }} + + [Cache] + redisPort = 6379 + redisConnections = 20 + redisMaxConnections = 30 + redisHost = {{ $redisHost }} + redisPassword = {{ $redisPass }} + listMinutes = {{ $cache.listMinutes }} + rssMinutes = {{ $cache.rssMinutes }} + + [Config] + hmacKey: {{ $hmacKey | quote }} + base64Media = {{ $config.base64Media }} + enableRSS = {{ $config.enableRSS }} + enableDebug = {{ $config.enableDebug }} + proxy = {{ $config.proxy | quote }} + proxyAuth = {{ $config.proxyAuth | quote }} + tokenCount = {{ $config.tokenCount }} + + [Preferences] + theme = {{ $preferences.theme | quote }} + replaceTwitter = {{ $preferences.replaceTwitter | quote }} + replaceYouTube = {{ $preferences.replaceYouTube | quote }} + replaceReddit = {{ $preferences.replaceReddit | quote }} + replaceInstagram = {{ $preferences.replaceInstagram | quote }} + proxyVideos = {{ $preferences.proxyVideos }} + hlsPlayback = {{ $preferences.hlsPlayback }} + infiniteScroll = {{ $preferences.infiniteScroll }} +{{- end -}} diff --git a/charts/incubator/nitter/templates/_secret.tpl b/charts/incubator/nitter/templates/_secret.tpl deleted file mode 100644 index 446290e83bb..00000000000 --- a/charts/incubator/nitter/templates/_secret.tpl +++ /dev/null @@ -1,70 +0,0 @@ -{{/* Define the configmap */}} -{{- define "nitter.secret" -}} - -{{- $secretName := printf "%s-nitter-secret" (include "tc.common.names.fullname" .) }} -{{- $storageSecretName := printf "%s-nitter-storage-secret" (include "tc.common.names.fullname" .) }} - -{{- $hmacKey := "" -}} -{{- with (lookup "v1" "Secret" .Release.Namespace $storageSecretName) -}} - {{- $hmacKey = (index .data "hmacKey") | b64dec -}} -{{- else -}} - {{- $hmacKey = randAlphaNum 32 -}} -{{- end }} - ---- -apiVersion: v1 -kind: Secret -type: Opaque -metadata: - name: {{ $storageSecretName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -data: {{/* Store to reuse */}} - hmacKey: {{ $hmacKey | b64enc }} ---- -apiVersion: v1 -kind: Secret -type: Opaque -metadata: - name: {{ $secretName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -stringData: - nitter.conf: | - [Server] - https = false - address = "0.0.0.0" - staticDir = "./public" - port = {{ .Values.service.main.ports.main.port }} - httpMaxConnections = {{ .Values.nitter.general.httpMaxConnections }} - title = {{ .Values.nitter.general.title | quote }} - hostname = {{ .Values.nitter.general.hostname | quote }} - - [Cache] - redisPort = 6379 - redisConnections = 20 - redisMaxConnections = 30 - redisHost = {{ .Values.redis.url.plain | trimAll "\"" | quote }} - redisPassword = {{ .Values.redis.redisPassword | trimAll "\"" | quote }} - listMinutes = {{ .Values.nitter.cache.listMinutes }} - rssMinutes = {{ .Values.nitter.cache.rssMinutes }} - - [Config] - hmacKey: {{ $hmacKey | quote }} - base64Media = {{ .Values.nitter.config.base64Media }} - enableRSS = {{ .Values.nitter.config.enableRSS }} - enableDebug = {{ .Values.nitter.config.enableDebug }} - proxy = {{ .Values.nitter.config.proxy | quote }} - proxyAuth = {{ .Values.nitter.config.proxyAuth | quote }} - tokenCount = {{ .Values.nitter.config.tokenCount }} - - [Preferences] - theme = {{ .Values.nitter.preferences.theme | quote }} - replaceTwitter = {{ .Values.nitter.preferences.replaceTwitter | quote }} - replaceYouTube = {{ .Values.nitter.preferences.replaceYouTube | quote }} - replaceReddit = {{ .Values.nitter.preferences.replaceReddit | quote }} - replaceInstagram = {{ .Values.nitter.preferences.replaceInstagram | quote }} - proxyVideos = {{ .Values.nitter.preferences.proxyVideos }} - hlsPlayback = {{ .Values.nitter.preferences.hlsPlayback }} - infiniteScroll = {{ .Values.nitter.preferences.infiniteScroll }} -{{- end }} diff --git a/charts/incubator/nitter/templates/common.yaml b/charts/incubator/nitter/templates/common.yaml index 10ba5789515..417d6ac78cd 100644 --- a/charts/incubator/nitter/templates/common.yaml +++ b/charts/incubator/nitter/templates/common.yaml @@ -1,7 +1,11 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.common.loader.init" . }} +{{- include "tc.v1.common.loader.init" . -}} -{{- include "nitter.secret" . -}} +{{/* Render configmaps for all pods */}} +{{- $configmaps := include "nitter.configmaps" . | fromYaml -}} +{{- if $configmaps -}} + {{- $_ := mustMergeOverwrite .Values.configmap $configmaps -}} +{{- end -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/incubator/nitter/values.yaml b/charts/incubator/nitter/values.yaml index 277db284489..8dee6abe2be 100644 --- a/charts/incubator/nitter/values.yaml +++ b/charts/incubator/nitter/values.yaml @@ -1,7 +1,14 @@ image: - repository: tccr.io/truecharts/nitter + repository: zedeus/nitter pullPolicy: IfNotPresent - tag: latest@sha256:9e85cc3257d422391d01af3a322827929d755918720fcfaea90a04dbb3bde8e9 + tag: latest@sha256:c0275459df4de2331a1ceac61c42be30a8731e168f582851134b5ec25af75171 + +service: + main: + ports: + main: + protocol: http + port: 10606 nitter: general: @@ -28,35 +35,36 @@ nitter: hlsPlayback: false infiniteScroll: false -probes: - liveness: - type: HTTP - path: / - readiness: - type: HTTP - path: / - startup: - type: HTTP - path: / - -service: +workload: main: - ports: - main: - protocol: HTTP - port: 10606 + podSpec: + containers: + main: + probes: + liveness: + enabled: true + type: http + path: / + readiness: + enabled: true + type: http + path: / + startup: + enabled: true + type: tcp persistence: - nitter-conf: + nitter-config: enabled: true + type: configmap + objectName: nitter-config mountPath: /src/nitter.conf - type: secret - objectName: '{{ template "tc.common.names.fullname" . }}-nitter-secret' subPath: nitter.conf + readOnly: true redis: enabled: true - existingSecret: rediscreds portal: - enabled: true + open: + enabled: true