# Copyright (c) 2021 SIGHUP s.r.l All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: tls-certs-check
spec:
  schedule: "*/1 * * * *"
  startingDeadlineSeconds: 10 # if a job hasn't starting in this many seconds, skip
  concurrencyPolicy: Forbid # either allow|forbid|replace
  successfulJobsHistoryLimit: 3 # how many completed jobs should be
  jobTemplate:
    spec:
      template:
        spec:
          serviceAccountName: tls-certs-check
          securityContext:
            fsGroup: 999
            runAsGroup: 999
            runAsUser: 1001
          containers:
          - name: tls-certs-check
            image: registry.sighup.io/poc/tls-certs-check:unstable
            imagePullPolicy: IfNotPresent
            args: ["--log-level", "$(TCC_LOG_LEVEL)", "--host", "$(TCC_HOST)", "--port", "$(TCC_PORT)", "--days", "$(TCC_DAYS)"]
            envFrom:
              - configMapRef:
                  name: tcc-envs
          restartPolicy: OnFailure
