Skip to content

Commit

Permalink
✨ Update chart
Browse files Browse the repository at this point in the history
- Add refresh CronJob
  • Loading branch information
essembeh committed Feb 22, 2024
1 parent 12b636c commit 030aef5
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
40 changes: 40 additions & 0 deletions charts/yourss/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if and (.Values.redis.enabled) (.Values.redis.autoFetch.enabled) (len .Values.yourss.users) -}}
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ template "yourss.fullname" . }}-refresh
labels:
app: {{ template "yourss.fullname" . }}-refresh
spec:
schedule: "{{ .Values.redis.autoFetch.cron }}"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
backoffLimit: 1
template:
spec:
restartPolicy: Never
containers:
- name: curl
image: alpine:latest
command: ["sh", "-c"]
args:
- |
apk add curl && \
{{- if and (.Values.redis.autoFetch.users) (len (.Values.redis.autoFetch.users)) }}
for USER in {{ range $user := .Values.redis.autoFetch.users }}{{ $user }} {{ end }}; do \
{{- else }}
for USER in {{ range $user := .Values.yourss.users }}{{ $user.name }} {{ end }}; do \
{{- end }}
echo "Force refresh user: $USER"; \
curl -s -I -m 60 -X GET "http://{{ template "yourss.fullname" . }}:8000/u/$USER?refresh=true" >/dev/null ; \
done
resources:
requests:
memory: 32Mi
cpu: 100m
limits:
memory: 64Mi
{{- end }}
7 changes: 7 additions & 0 deletions charts/yourss/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ redis:
ttl:
metadata: 86400
rss: 3600
autoFetch:
enabled: true
## see https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#schedule-syntax
cron: "@hourly"
## You can choose to automatically refresh only some user pages, by default, all pages are fetched
#users:
# - demo

imagePullSecrets: []
nameOverride: ""
Expand Down

0 comments on commit 030aef5

Please sign in to comment.