61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
---
|
|
apiVersion: batch/v1
|
|
kind: CronJob
|
|
metadata:
|
|
name: gitea-user-unban
|
|
labels:
|
|
app: gitea-user-unban
|
|
spec:
|
|
schedule: "*/10 * * * *"
|
|
concurrencyPolicy: Forbid
|
|
successfulJobsHistoryLimit: 3
|
|
failedJobsHistoryLimit: 3
|
|
jobTemplate:
|
|
spec:
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: gitea-user-unban
|
|
spec:
|
|
restartPolicy: OnFailure
|
|
nodeSelector:
|
|
kubernetes.io/hostname: master.tail2fe2d.ts.net
|
|
volumes:
|
|
- name: storage
|
|
hostPath:
|
|
path: /k8s/gitea
|
|
type: Directory
|
|
containers:
|
|
- name: sqlite-unban
|
|
image: 'gitea/gitea:latest'
|
|
imagePullPolicy: IfNotPresent
|
|
resources:
|
|
requests:
|
|
memory: "32Mi"
|
|
cpu: "10m"
|
|
limits:
|
|
memory: "128Mi"
|
|
cpu: "100m"
|
|
command:
|
|
- /bin/sh
|
|
- -ec
|
|
- |
|
|
sqlite3 -cmd ".timeout 30000" /data/gitea/gitea.db "
|
|
UPDATE \"user\"
|
|
SET is_active = 1,
|
|
prohibit_login = 0,
|
|
updated_unix = unixepoch()
|
|
WHERE lower(email) = lower('ab@hexor.cy')
|
|
AND (is_active <> 1 OR prohibit_login <> 0);
|
|
|
|
SELECT printf(
|
|
'gitea user watchdog: id=%d login=%s email=%s is_active=%d prohibit_login=%d updated_unix=%d',
|
|
id, lower_name, email, is_active, prohibit_login, updated_unix
|
|
)
|
|
FROM \"user\"
|
|
WHERE lower(email) = lower('ab@hexor.cy');
|
|
"
|
|
volumeMounts:
|
|
- name: storage
|
|
mountPath: /data
|