apiVersion: v1
kind: Service
metadata:
  name: <<appenv>>letsencrypt
  namespace: istio-ingress
  labels:
    app: <<appenv>>letsencrypt
    service: <<appenv>>letsencrypt
spec:
  ports:
  - port: 80
    name: http-<<appenv>>letsencrypt
  selector:
    app: <<appenv>>letsencrypt
---
apiVersion: v1
kind: Secret
metadata:
  name: <<appenv>>letsencrypt-certs
  namespace: istio-ingress
type: Opaque
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: cron-configmap
  namespace: istio-ingress
data:
  cron-test.sh: |-
    #!/bin/sh
    completo=$(date +"%d-%m-%Y %H:%M:%S")
    ore=$(date +"%I")
    if [ $ore = '02' ]; then
      echo $completo >> /minuti.log
    fi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: <<appenv>>ada-cert-manager
  namespace: istio-ingress
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: <<appenv>>letsencrypt
      version: v1
  template:
    metadata:
      name: <<appenv>>letsencrypt
      labels:
        app: <<appenv>>letsencrypt
        version: v1
    spec:
      containers:
      - name: letsencrypt
        image: docker.adaoncloud.com/frontend/<<appenv>>ada-cert-manager:<<imagetag>>
        ports:
        - containerPort: 80
        imagePullPolicy: Always
        env:
        - name: DOMAINS
          value: <<DOMAINS>>
        - name: EMAIL
          value: dev@thedigitalbox.net
        - name: SECRET
          value: <<appenv>>letsencrypt-certs
        livenessProbe:
          httpGet:
            path: /livenessProbe
            port: 80
        volumeMounts:
          - name: cron-configmap-volume
            mountPath: /etc/periodic/15min/cron-test.sh
            readOnly: true
            subPath: cron-test.sh
      restartPolicy: Always
      imagePullSecrets:
        - name: ada-registry
      volumes:
        - name: cron-configmap-volume
          configMap:
            defaultMode: 0700
            name: cron-configmap