apiVersion: batch/v1
kind: Job
metadata:
  name: "{{ .Release.Name }}-atomiclog"
  annotations:
    "helm.sh/hook": pre-delete,pre-rollback
    "helm.sh/hook-weight": "1"
    "helm.sh/hook-delete-policy": before-hook-creation
  labels:
    app: {{ .Chart.Name }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
    component: atomiclog
spec:
  activeDeadlineSeconds: 100
  template:
    metadata:
      labels:
        app: {{ .Chart.Name }}
        release: {{ .Release.Name }}
        component: atomiclog
    spec:
      containers:
      - name: atomiclog
        image: centosadmin/kubernetes-helm:3.3.4
        imagePullPolicy: IfNotPresent
        command:
        - /bin/bash
        args:
        - /usr/local/bin/hooklog.sh
        - {{ .Release.Namespace }}
        - {{ .Release.Name }}
        resources:
          limits:
            cpu: 50m
            memory: 256Mi
          requests:
            cpu: 50m
            memory: 128Mi
      dnsPolicy: ClusterFirst
      restartPolicy: Never
      serviceAccountName: {{ .Release.Namespace }}
