feat(tsn-ranksystem) Added Cronjob Feature (#19538)

**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.
-->
⚒️ Added Cronjob Feature to Automatically Restart the Bot which connects
to the teamspeak-server if crashed

**⚙️ Type of change**

- [x] ⚙️ 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?**
<!--
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
- [x] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ 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: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com>
Co-authored-by: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com>
This commit is contained in:
alfi0812 2024-03-20 23:16:05 +01:00 committed by GitHub
parent a4915323f5
commit 194cf0d409
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 62 additions and 2 deletions

View File

@ -44,4 +44,4 @@ sources:
- https://github.com/truecharts/charts/tree/master/charts/stable/tsn-ranksystem
- https://hub.docker.com/r/serverlein/tsn-ranksystem-webserver
type: application
version: 1.1.3
version: 1.2.2

View File

@ -13,6 +13,26 @@ questions:
# Include{containerAdvanced}
# Include{containerConfig}
# Include{podOptions}
- variable: ranksystem
group: App Configuration
label: TSN Ranksystem Config
schema:
additional_attrs: true
type: dict
attrs:
- variable: cron_enabled
label: "Enable cronjob"
schema:
type: boolean
default: true
show_subquestions_if: true
subquestions:
- variable: cron_schedule
label: Schedule
description: How often to run the task.
schema:
type: string
default: "*/5 * * * *"
# Include{serviceRoot}
# Include{serviceMain}
# Include{serviceSelectorLoadBalancer}

View File

@ -1 +1,10 @@
{{ include "tc.v1.common.loader.all" . }}
{{/* Make sure all variables are set properly */}}
{{- include "tc.v1.common.loader.init" . }}
{{/* Disable [ranksystemcron] if requested */}}
{{- if not .Values.ranksystem.cron_enabled -}}
{{- $_ := set .Values.workload.ranksystemcron "enabled" false -}}
{{- end -}}
{{/* Render the templates */}}
{{ include "tc.v1.common.loader.apply" . }}

View File

@ -7,6 +7,10 @@ securityContext:
container:
readOnlyRootFilesystem: false
ranksystem:
cron_enabled: true
cron_schedule: "*/5 * * * *"
workload:
main:
podSpec:
@ -72,6 +76,30 @@ workload:
else
echo "Install script doesnt exists, no further action is needed."
fi
ranksystemcron:
enabled: true
type: CronJob
schedule: "{{ .Values.ranksystem.cron_schedule }}"
podSpec:
restartPolicy: OnFailure
containers:
ranksystemcron:
primary: true
enabled: true
imageSelector: "image"
probes:
liveness:
enabled: false
readiness:
enabled: false
startup:
enabled: false
command:
- /bin/sh
- -c
- |
php /var/www/html/worker.php check
service:
main:
ports:
@ -87,6 +115,9 @@ persistence:
mountPath: /var/www/html
download-ranksystem:
mountPath: /var/www/html
ranksystem-cron:
ranksystem-cron:
mountPath: /var/www/html
mariadb:
enabled: true
mariadbUsername: ranksystem