apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: sitemap-builder
  labels:
    app: sitemap-builder
spec:
  concurrencyPolicy: Forbid
  schedule: "0 1 10 * *"
  jobTemplate:
    metadata:
      labels:
        app: sitemap-builder
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          imagePullSecrets:
            - name: ghcr
          containers:
            - name: sitemap-builder
              image: busybox
              command:
                - /app/servicebin
              livenessProbe:
                httpGet:
                  path: /healthz
                  port: 80
              readinessProbe:
                httpGet:
                  path: /healthz
                  port: 80
              resources:
                requests:
                  cpu: 400m
                  memory: 350Mi
                limits:
                  cpu: 400m
                  memory: 350Mi
              env:
                - name: S3_BUCKETSITEMAP
                  valueFrom:
                    configMapKeyRef:
                      key: bucketsitemap
                      name: s3
                - name: S3_ENDPOINT
                  valueFrom:
                    configMapKeyRef:
                      key: endpoint
                      name: s3
                - name: S3_ACCESSKEYID
                  valueFrom:
                    configMapKeyRef:
                      key: accesskeyid
                      name: s3
                - name: S3_SECRETACCESSKEY
                  valueFrom:
                    secretKeyRef:
                      key: secretaccesskey
                      name: s3
                - name: S3_SECURE
                  valueFrom:
                    configMapKeyRef:
                      key: secure
                      name: s3
                - name: S3_REGION
                  valueFrom:
                    configMapKeyRef:
                      key: region
                      name: s3
                - name: MONGODB_URL
                  valueFrom:
                    configMapKeyRef:
                      key: url
                      name: mongodb
                - name: LOGLEVEL
                  value: debug
