migrate(nitter) migrate to new common (#15246)

**Description**
Migrate nitter to new common and update chart
⚒️ Fixes  # <!--(issue)-->

**⚙️ 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?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ 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._
This commit is contained in:
Xstar97TheNoob 2023-11-23 19:17:57 -05:00 committed by GitHub
parent 2709a80ff6
commit 7ef0a62864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 122 additions and 118 deletions

View File

@ -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"

View File

@ -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}

View File

@ -0,0 +1 @@
{{- include "tc.v1.common.lib.chart.notes" $ -}}

View File

@ -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 -}}

View File

@ -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 }}

View File

@ -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" . -}}

View File

@ -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