From 3d58baaf2fecc470ac2b8463ac2e0afe9156b4a5 Mon Sep 17 00:00:00 2001 From: AB Date: Sun, 28 Jun 2026 11:50:56 +0300 Subject: [PATCH] Added tmp job for unban me in gitea --- k8s/apps/gitea/kustomization.yaml | 2 +- k8s/apps/gitea/user-unban-cronjob.yaml | 60 ++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 k8s/apps/gitea/user-unban-cronjob.yaml diff --git a/k8s/apps/gitea/kustomization.yaml b/k8s/apps/gitea/kustomization.yaml index ac085db..85144a4 100644 --- a/k8s/apps/gitea/kustomization.yaml +++ b/k8s/apps/gitea/kustomization.yaml @@ -5,6 +5,6 @@ resources: - app.yaml - external-secrets.yaml - deployment.yaml + - user-unban-cronjob.yaml - service.yaml - ingress.yaml - diff --git a/k8s/apps/gitea/user-unban-cronjob.yaml b/k8s/apps/gitea/user-unban-cronjob.yaml new file mode 100644 index 0000000..2d4d6f9 --- /dev/null +++ b/k8s/apps/gitea/user-unban-cronjob.yaml @@ -0,0 +1,60 @@ +--- +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