apps(sirius-growth): sgs-leadgen weekly CronJob (ET) + monthly NCDA job + state PVC
Runs the published amd64 image forgejo.../sgs-leadgen:eef9358 with DATABASE_URL from sirius-growth-portal-app and the contact bot's Telegram pair; /data on a local-path PVC pins to siriussec, /tmp on an emptyDir so the root fs stays RO.
This commit is contained in:
parent
d5193c2525
commit
45c3b8533b
4 changed files with 185 additions and 0 deletions
85
apps/base/sirius-growth/cronjob-leadgen-ncda.yaml
Normal file
85
apps/base/sirius-growth/cronjob-leadgen-ncda.yaml
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: sgs-leadgen-ncda
|
||||||
|
namespace: sirius-growth
|
||||||
|
spec:
|
||||||
|
# 10:00, not 08:00: on a Monday-the-1st the weekly job owns the RWO volume at
|
||||||
|
# 08:00 and concurrencyPolicy is per-CronJob, so a 2h gap keeps them apart.
|
||||||
|
schedule: "0 10 1 * *"
|
||||||
|
timeZone: America/New_York
|
||||||
|
concurrencyPolicy: Forbid
|
||||||
|
startingDeadlineSeconds: 3600
|
||||||
|
suspend: false
|
||||||
|
successfulJobsHistoryLimit: 3
|
||||||
|
failedJobsHistoryLimit: 3
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
backoffLimit: 1
|
||||||
|
activeDeadlineSeconds: 1800
|
||||||
|
ttlSecondsAfterFinished: 604800
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: sgs-leadgen-ncda
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/hostname: siriussec
|
||||||
|
tolerations:
|
||||||
|
- key: dedicated
|
||||||
|
operator: Exists
|
||||||
|
effect: PreferNoSchedule
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 10001
|
||||||
|
containers:
|
||||||
|
- name: leadgen
|
||||||
|
image: forgejo.siriusdevops.com/sirius/sgs-leadgen:eef935874bb19b6cee73bd93d7fd9ab4001ec184
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
env:
|
||||||
|
- name: DATABASE_URL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: sirius-growth-portal-app
|
||||||
|
key: database-url
|
||||||
|
- name: TELEGRAM_BOT_TOKEN
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: sirius-growth-contact
|
||||||
|
key: TG_TOKEN
|
||||||
|
- name: TELEGRAM_CHAT_ID
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: sirius-growth-contact
|
||||||
|
key: TG_CHAT
|
||||||
|
- name: SGS_DATA_DIR
|
||||||
|
value: /data
|
||||||
|
- name: SGS_STATE_PATH
|
||||||
|
value: /data/state.json
|
||||||
|
- name: SGS_CSV
|
||||||
|
value: /data/leads.csv
|
||||||
|
# Monthly-only source: the NCDA&CS licensed-nursery register.
|
||||||
|
- name: SGS_NCDA
|
||||||
|
value: "1"
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 256Mi
|
||||||
|
limits:
|
||||||
|
memory: 1Gi
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: sgs-leadgen-data
|
||||||
|
- name: tmp
|
||||||
|
emptyDir:
|
||||||
|
sizeLimit: 256Mi
|
||||||
85
apps/base/sirius-growth/cronjob-leadgen.yaml
Normal file
85
apps/base/sirius-growth/cronjob-leadgen.yaml
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: sgs-leadgen
|
||||||
|
namespace: sirius-growth
|
||||||
|
spec:
|
||||||
|
schedule: "0 8 * * 1"
|
||||||
|
timeZone: America/New_York
|
||||||
|
concurrencyPolicy: Forbid
|
||||||
|
startingDeadlineSeconds: 3600
|
||||||
|
suspend: false
|
||||||
|
successfulJobsHistoryLimit: 3
|
||||||
|
failedJobsHistoryLimit: 3
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
backoffLimit: 1
|
||||||
|
activeDeadlineSeconds: 1800
|
||||||
|
ttlSecondsAfterFinished: 604800
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: sgs-leadgen
|
||||||
|
spec:
|
||||||
|
restartPolicy: Never
|
||||||
|
# local-path is a node-local volume: the pod must run where the PV is.
|
||||||
|
nodeSelector:
|
||||||
|
kubernetes.io/hostname: siriussec
|
||||||
|
tolerations:
|
||||||
|
- key: dedicated
|
||||||
|
operator: Exists
|
||||||
|
effect: PreferNoSchedule
|
||||||
|
# local-path mounts root-owned; the image runs as uid 10001, so fsGroup
|
||||||
|
# makes /data group-writable for it.
|
||||||
|
securityContext:
|
||||||
|
fsGroup: 10001
|
||||||
|
containers:
|
||||||
|
- name: leadgen
|
||||||
|
image: forgejo.siriusdevops.com/sirius/sgs-leadgen:eef935874bb19b6cee73bd93d7fd9ab4001ec184
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
env:
|
||||||
|
- name: DATABASE_URL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: sirius-growth-portal-app
|
||||||
|
key: database-url
|
||||||
|
- name: TELEGRAM_BOT_TOKEN
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: sirius-growth-contact
|
||||||
|
key: TG_TOKEN
|
||||||
|
- name: TELEGRAM_CHAT_ID
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: sirius-growth-contact
|
||||||
|
key: TG_CHAT
|
||||||
|
- name: SGS_DATA_DIR
|
||||||
|
value: /data
|
||||||
|
- name: SGS_STATE_PATH
|
||||||
|
value: /data/state.json
|
||||||
|
- name: SGS_CSV
|
||||||
|
value: /data/leads.csv
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
# tempfile.NamedTemporaryFile() needs a writable TMPDIR; the rest
|
||||||
|
# of the root filesystem stays read-only.
|
||||||
|
- name: tmp
|
||||||
|
mountPath: /tmp
|
||||||
|
securityContext:
|
||||||
|
runAsNonRoot: true
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 256Mi
|
||||||
|
limits:
|
||||||
|
memory: 1Gi
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: sgs-leadgen-data
|
||||||
|
- name: tmp
|
||||||
|
emptyDir:
|
||||||
|
sizeLimit: 256Mi
|
||||||
|
|
@ -11,3 +11,6 @@ resources:
|
||||||
- httproute.yaml
|
- httproute.yaml
|
||||||
- cluster.yaml
|
- cluster.yaml
|
||||||
- podmonitor.yaml
|
- podmonitor.yaml
|
||||||
|
- pvc-leadgen.yaml
|
||||||
|
- cronjob-leadgen.yaml
|
||||||
|
- cronjob-leadgen-ncda.yaml
|
||||||
|
|
|
||||||
12
apps/base/sirius-growth/pvc-leadgen.yaml
Normal file
12
apps/base/sirius-growth/pvc-leadgen.yaml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: sgs-leadgen-data
|
||||||
|
namespace: sirius-growth
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
storageClassName: local-path
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
Loading…
Reference in a new issue