fix(tandoor-recipes): change to new common and move to incubator (#16864)

**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
My first attempt of fixing an app like this.
⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [x] ⚙️ Feature/App addition
- [x] 🪛 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
- [x] ⚠️ 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: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
This commit is contained in:
ZasX 2024-01-04 09:58:52 +01:00 committed by GitHub
parent 21d603097a
commit e0f7445003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 121 additions and 195 deletions

View File

@ -0,0 +1,37 @@
kubeVersion: ">=1.24.0-0"
apiVersion: v2
name: tandoor-recipes
version: 14.0.0
appVersion: 1.5.10
description: Tandoor Recipes is a Django application to manage, tag and search recipes using either built in models or external storage providers hosting PDF's, Images or other files.
home: https://truecharts.org/charts/incubator/tandoor-recipes
icon: https://truecharts.org/img/hotlink-ok/chart-icons/tandoor-recipes.png
deprecated: false
sources:
- https://github.com/vabene1111/recipes
- https://github.com/truecharts/charts/tree/master/charts/incubator/tandoor-recipes
maintainers:
- name: TrueCharts
email: info@truecharts.org
url: https://truecharts.org
keywords:
- tandoor
- recipes
- cooking
dependencies:
- name: common
version: 17.2.21
repository: oci://tccr.io/truecharts
condition: ""
alias: ""
tags: []
import-values: []
annotations:
max_scale_version: 23.10.2
min_scale_version: 23.10.0
truecharts.org/SCALE-support: "true"
truecharts.org/category: media
truecharts.org/max_helm_version: "3.13"
truecharts.org/min_helm_version: "3.12"
truecharts.org/train: incubator
type: application

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -18,43 +18,37 @@ questions:
attrs:
- variable: DEBUG
label: "DEBUG"
description: "Sets the DEBUG env var"
description: "Only set this to true when testing/debugging"
schema:
type: int
default: 0
- variable: ALLOWED_HOSTS
label: "ALLOWED_HOSTS"
description: "Sets the ALLOWED_HOSTS env var"
description: "hosts the application can run under e.g. recipes.mydomain.com,cooking.mydomain.com,..."
schema:
type: string
default: "*"
- variable: CSRF_TRUSTED_ORIGINS
label: "CSRF_TRUSTED_ORIGINS"
description: "Sets the CSRF_TRUSTED_ORIGINS env var"
description: "Cross Site Request Forgery protection"
schema:
type: string
default: ""
- variable: GUNICORN_MEDIA
label: "GUNICORN_MEDIA"
description: "Sets the GUNICORN_MEDIA env var"
schema:
type: int
default: 0
- variable: FRACTION_PREF_DEFAULT
label: "FRACTION_PREF_DEFAULT"
description: "Sets the FRACTION_PREF_DEFAULT env var"
description: "The default value for the user preference 'fractions' (enable/disable fraction support)"
schema:
type: int
default: 0
- variable: COMMENT_PREF_DEFAULT
label: "COMMENT_PREF_DEFAULT"
description: "Sets the COMMENT_PREF_DEFAULT env var"
description: "The default value for the user preference 'comments' (enable/disable commenting system)"
schema:
type: int
default: 1
- variable: SHOPPING_MIN_AUTOSYNC_INTERVAL
label: "SHOPPING_MIN_AUTOSYNC_INTERVAL"
description: "Sets the SHOPPING_MIN_AUTOSYNC_INTERVAL env var"
description: "Users can set an amount of time after which the shopping list is refreshed"
schema:
type: int
default: 5
@ -131,6 +125,7 @@ questions:
type: int
default: 568
# Include{resources}
# Include{postgresql}
# Include{advanced}
# Include{addons}
# Include{codeserver}

View File

@ -0,0 +1,11 @@
{{/* Define the secrets */}}
{{- define "recipes.secrets" -}}
{{- $secretName := (printf "%s-recipes-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) }}
{{- $secretKey := randAlphaNum 50 -}}
{{- with (lookup "v1" "Secret" .Release.Namespace $secretName) -}}
{{- $secretKey = index .data "SECRET_KEY" | b64dec -}}
{{- end }}
enabled: true
data:
SECRET_KEY: {{ $secretKey }}
{{- end -}}

View File

@ -1,7 +1,10 @@
{{- include "tc.v1.common.loader.init" . }}
{{/* Render secrets for recipes */}}
{{- include "recipes.secrets" . }}
{{- $secrets := include "recipes.secrets" . | fromYaml -}}
{{- if $secrets -}}
{{- $_ := set .Values.secret "recipes-secrets" $secrets -}}
{{- end -}}
{{/* Render the templates */}}
{{ include "tc.v1.common.loader.apply" . }}

View File

@ -0,0 +1,62 @@
image:
repository: vabene1111/recipes
pullPolicy: IfNotPresent
tag: 1.5.10@sha256:07fe5a05de3a8a746b4bfe778f9c7a5ec80a0710123d5067efec5c4dc6d807cb
securityContext:
container:
readOnlyRootFilesystem: false
runAsNonRoot: false
runAsGroup: 0
runAsUser: 0
workload:
main:
podSpec:
containers:
main:
env:
DB_ENGINE: django.db.backends.postgresql
POSTGRES_HOST:
secretKeyRef:
name: cnpg-main-urls
key: host
POSTGRES_PORT: 5432
POSTGRES_USER: "{{ .Values.cnpg.main.user }}"
POSTGRES_PASSWORD:
secretKeyRef:
name: cnpg-main-user
key: password
POSTGRES_DB: "{{ .Values.cnpg.main.database }}"
TANDOOR_PORT: "{{ .Values.service.main.ports.main.port }}"
ALLOWED_HOSTS: "*"
COMMENT_PREF_DEFAULT: 1
CSRF_TRUSTED_ORIGINS: ""
DEBUG: 0
FRACTION_PREF_DEFAULT: 0
GUNICORN_MEDIA: 1
SECRET_KEY:
secretKeyRef:
key: SECRET_KEY
name: recipes-secrets
SHOPPING_MIN_AUTOSYNC_INTERVAL: 5
TIMEZONE: "{{ .Values.TZ }}"
service:
main:
ports:
main:
port: 10029
persistence:
media:
enabled: true
mountPath: /opt/recipes/mediafiles
static:
enabled: true
mountPath: /opt/recipes/staticfiles
type: emptyDir
cnpg:
main:
enabled: true
user: recipes
database: recipes
portal:
open:
enabled: true

View File

@ -1,44 +0,0 @@
kubeVersion: ">=1.24.0-0"
apiVersion: v2
name: recipes
version: 13.0.11
appVersion: 1.5.6
description: Recipes is a Django application to manage, tag and search recipes using either built in models or external storage providers hosting PDF's, Images or other files.
home: https://truecharts.org/charts/unstable/recipes
icon: https://truecharts.org/img/hotlink-ok/chart-icons/recipes.png
deprecated: false
sources:
- https://hub.docker.com/_/nginx
- https://github.com/vabene1111/recipes
- https://github.com/truecharts/charts/tree/master/charts/unstable/recipes
maintainers:
- name: TrueCharts
email: info@truecharts.org
url: https://truecharts.org
keywords:
- recipes
- cooking
dependencies:
- name: common
version: 17.2.21
repository: oci://tccr.io/truecharts
condition: ""
alias: ""
tags: []
import-values: []
- name: postgresql
version: 11.0.31
repository: https://deps.truecharts.org/
condition: postgresql.enabled
alias: ""
tags: []
import-values: []
annotations:
max_scale_version: 23.10.2
min_scale_version: 23.10.0
truecharts.org/SCALE-support: "true"
truecharts.org/category: media
truecharts.org/max_helm_version: "3.13"
truecharts.org/min_helm_version: "3.12"
truecharts.org/train: unstable
type: application

View File

@ -1,20 +0,0 @@
{{/* Define the secrets */}}
{{- define "recipes.secrets" -}}
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: recipes-secrets
{{- $recipesprevious := lookup "v1" "Secret" .Release.Namespace "recipes-secrets" }}
{{- $secret_key := "" }}
data:
{{- if $recipesprevious}}
SECRET_KEY: {{ index $recipesprevious.data "SECRET_KEY" }}
{{- else }}
{{- $secret_key := randAlphaNum 50 }}
SECRET_KEY: {{ $secret_key | b64enc | quote }}
{{- end }}
{{- end -}}

View File

@ -1,118 +0,0 @@
additionalContainers:
nginx:
image: "{{ .Values.nginxImage.repository }}:{{ .Values.nginxImage.tag }}"
name: nginx
ports:
- containerPort: 80
name: main
volumeMounts:
- mountPath: /etc/nginx/nginx.conf
name: recipes-config
readOnly: true
subPath: nginx-config
- mountPath: /media
name: media
- mountPath: /static
name: static
configmap:
config:
data:
nginx-config: |-
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
server {
listen 80;
server_name _;
client_max_body_size 16M;
# serve media files
location /media/ {
alias /media/;
}
# serve static files
location /static/ {
alias /static/;
}
# pass requests for dynamic content to gunicorn
location / {
proxy_set_header Host $http_host;
proxy_pass http://localhost:8080;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
}
}
}
enabled: true
image:
pullPolicy: IfNotPresent
repository: vabene1111/recipes
tag: 1.5.10@sha256:07fe5a05de3a8a746b4bfe778f9c7a5ec80a0710123d5067efec5c4dc6d807cb
nginxImage:
repository: nginx
tag: 1.25.3@sha256:86e53c4c16a6a276b204b0fd3a8143d86547c967dc8258b3d47c3a21bb68d3c6
persistence:
media:
enabled: true
mountPath: /opt/recipes/mediafiles
recipes-config:
enabled: "true"
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
type: custom
volumeSpec:
configMap:
name: '{{ printf "%v-config" (include "tc.common.names.fullname" .) }}'
static:
enabled: true
mountPath: /opt/recipes/staticfiles
type: emptyDir
portal:
enabled: true
postgresql:
enabled: true
existingSecret: dbcreds
postgresqlDatabase: recipes
postgresqlUsername: recipes
securityContext:
container:
readOnlyRootFilesystem: false
runAsGroup: 0
runAsNonRoot: false
runAsUser: 0
service:
main:
ports:
main:
port: 10029
targetPort: 80
workload:
main:
podSpec:
containers:
main:
env:
ALLOWED_HOSTS: "*"
COMMENT_PREF_DEFAULT: 1
CSRF_TRUSTED_ORIGINS: ""
DB_ENGINE: django.db.backends.postgresql
DEBUG: 0
FRACTION_PREF_DEFAULT: 0
GUNICORN_MEDIA: 0
POSTGRES_DB: "{{ .Values.postgresql.postgresqlDatabase }}"
POSTGRES_HOST:
secretKeyRef:
key: plainhost
name: dbcreds
POSTGRES_PASSWORD:
secretKeyRef:
key: postgresql-password
name: dbcreds
POSTGRES_PORT: "5432"
POSTGRES_USER: "{{ .Values.postgresql.postgresqlUsername }}"
SECRET_KEY:
secretKeyRef:
key: SECRET_KEY
name: recipes-secrets
SHOPPING_MIN_AUTOSYNC_INTERVAL: 5
TIMEZONE: "{{ .Values.TZ }}"