85 lines
2.8 KiB
YAML
85 lines
2.8 KiB
YAML
|
|
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
|