# 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/v1beta1
kind: CronJob
metadata:
  name: http-check-product
spec:
  schedule: "*/5 * * * *"
  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:
      backoffLimit: 0
      activeDeadlineSeconds: 60 # job is marked failed after this limit
      template:
        spec:
          containers:
          - name: http-check-product
            image: registry.sighup.io/poc/http-status-check
            imagePullPolicy: Always
            env:
              - name: HSC_HTTP_URL
                valueFrom:
                  configMapKeyRef:
                    name: http-product-envs
                    key: HSC_HTTP_URL
              - name: HSC_LOG_LEVEL
                valueFrom:
                  configMapKeyRef:
                    name: http-product-envs
                    key: HSC_LOG_LEVEL
                    optional: true
          restartPolicy: Never
