Skip to content

Commit 81684ff

Browse files
authored
Merge pull request #85 from small-hack/add-libre-translate
Add libre translate support
2 parents 6dc1e8b + bad25db commit 81684ff

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed

charts/mastodon/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type: application
99
# This is the chart version. This version number should be incremented each time you make changes
1010
# to the chart and its templates, including the app version.
1111
# Versions are expected to follow Semantic Versioning (https://semver.org/)
12-
version: 9.7.0
12+
version: 9.8.0
1313

1414
# renovate: image=ghcr.io/mastodon/mastodon
1515
appVersion: v4.3.1

charts/mastodon/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# mastodon
22

3-
![Version: 9.7.0](https://img.shields.io/badge/Version-9.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v4.3.1](https://img.shields.io/badge/AppVersion-v4.3.1-informational?style=flat-square)
3+
![Version: 9.8.0](https://img.shields.io/badge/Version-9.8.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v4.3.1](https://img.shields.io/badge/AppVersion-v4.3.1-informational?style=flat-square)
44

55
Mastodon is a free, open-source social network server based on ActivityPub.
66

@@ -57,7 +57,7 @@ Mastodon is a free, open-source social network server based on ActivityPub.
5757
| mastodon.cron.updateSearchIndexMappings.schedule | string | `"0 * * * *"` | run once an hour |
5858
| mastodon.deepl.apiKeySecretRef.key | string | `""` | |
5959
| mastodon.deepl.apiKeySecretRef.name | string | `""` | |
60-
| mastodon.deepl.enabled | bool | `false` | |
60+
| mastodon.deepl.enabled | bool | `false` | enable the use of deepl for translations |
6161
| mastodon.deepl.plan | string | `""` | |
6262
| mastodon.extraEnvFrom | string | `""` | Alternatively specify extra environment variables stored in a ConfigMap. The specified ConfigMap should contain the additional environment variables in key-value format. |
6363
| mastodon.extraEnvVars | list | `[]` | Specify extra environment variables to be added to all Mastodon pods. These can be used for configuration not included in this chart (including configuration for Mastodon varietals.) |
@@ -73,6 +73,12 @@ Mastodon is a free, open-source social network server based on ActivityPub.
7373
| mastodon.hooks.s3Upload.secretRef.keys.accesKeyId | string | `"acces-key-id"` | |
7474
| mastodon.hooks.s3Upload.secretRef.keys.secretAccessKey | string | `"secret-access-key"` | |
7575
| mastodon.hooks.s3Upload.secretRef.name | string | `nil` | |
76+
| mastodon.libretranslate.apiKey | string | `""` | |
77+
| mastodon.libretranslate.enabled | bool | `false` | enable the use of libretranslate for translations |
78+
| mastodon.libretranslate.endpoint | string | `""` | |
79+
| mastodon.libretranslate.existingSecret | string | `""` | use an existing secret for libretranslate endpoint and api key |
80+
| mastodon.libretranslate.secretKeys.apiKey | string | `""` | |
81+
| mastodon.libretranslate.secretKeys.endpoint | string | `""` | |
7682
| mastodon.limitedFederationMode | bool | `false` | Enables "Limited Federation Mode" for more detauls see: https://docs.joinmastodon.org/admin/config/#limited_federation_mode |
7783
| mastodon.local_domain | string | `"mastodon.local"` | |
7884
| mastodon.locale | string | `"en"` | available locales: https://github.com/mastodon/mastodon/blob/main/config/application.rb#L71 |

charts/mastodon/templates/deployment-web.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,35 @@ spec:
154154
name: {{ .Values.mastodon.s3.existingSecret }}
155155
key: {{ .Values.mastodon.s3.secretKeys.s3AccessKey }}
156156
{{- end }}
157-
{{- if and .Values.mastodon.deepl.enabled }}
157+
{{- if .Values.mastodon.deepl.enabled }}
158158
- name: "DEEPL_API_KEY"
159159
valueFrom:
160160
secretKeyRef:
161161
name: {{ .Values.mastodon.deepl.apiKeySecretRef.name }}
162162
key: {{ .Values.mastodon.deepl.apiKeySecretRef.key }}
163163
{{- end }}
164+
{{- if .Values.mastodon.libretranslate.enabled }}
165+
- name: "LIBRE_TRANSLATE_API_KEY"
166+
valueFrom:
167+
secretKeyRef:
168+
{{- if .Values.mastodon.libretranslate.existingSecret }}
169+
name: {{ .Values.mastodon.libretranslate.existingSecret }}
170+
key: {{ .Values.mastodon.libretranslate.secretKeys.apiKey }}
171+
{{- else -}}
172+
name: {{ include "mastodon.fullname" . }}-libretranslate
173+
key: apiKey
174+
{{- end }}
175+
- name: "LIBRE_TRANSLATE_ENDPOINT"
176+
valueFrom:
177+
secretKeyRef:
178+
{{- if .Values.mastodon.libretranslate.existingSecret }}
179+
name: {{ .Values.mastodon.libretranslate.existingSecret }}
180+
key: {{ .Values.mastodon.libretranslate.secretKeys.endpoint }}
181+
{{- else -}}
182+
name: {{ include "mastodon.fullname" . }}-libretranslate
183+
key: endpoint
184+
{{- end }}
185+
{{- end }}
164186
{{- if or .Values.mastodon.web.otel.enabled (and .Values.mastodon.otel.enabled (ne .Values.mastodon.web.otel.enabled false)) }}
165187
- name: OTEL_EXPORTER_OTLP_ENDPOINT
166188
value: {{ coalesce .Values.mastodon.web.otel.endpointUri .Values.mastodon.otel.endpointUri }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if and .Values.mastodon.libretranslate.enabled (not .Values.mastodon.libretranslate.existingSecret) }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ include "mastodon.fullname" . }}-libretranslate
6+
labels:
7+
{{- include "mastodon.labels" . | nindent 4 }}
8+
type: Opaque
9+
data:
10+
apiKey: {{ .Values.mastodon.libretranslate.apiKey | b64enc }}
11+
endpoint: {{ .Values.mastodon.libretranslate.endpoint | b64enc }}
12+
{{- end }}

charts/mastodon/values.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,24 @@ mastodon:
149149
s3Region: ""
150150

151151
deepl:
152+
# -- enable the use of deepl for translations
152153
enabled: false
153154
plan: ""
154155
apiKeySecretRef:
155156
name: ""
156157
key: ""
157158

159+
libretranslate:
160+
# -- enable the use of libretranslate for translations
161+
enabled: false
162+
endpoint: ""
163+
apiKey: ""
164+
# -- use an existing secret for libretranslate endpoint and api key
165+
existingSecret: ""
166+
secretKeys:
167+
endpoint: ""
168+
apiKey: ""
169+
158170
secrets:
159171
# -- must be set manually; autogenerated keys are rotated on each upgrade
160172
secret_key_base: ""

0 commit comments

Comments
 (0)