apiVersion: batch/v1
kind: Job
metadata:
  name: webhook-cert-setup
spec:
  ttlSecondsAfterFinished: 100
  template:
    spec:
      serviceAccountName: webhook-cert-sa
      containers:
      - name: webhook-cert-setup
        # This is a minimal kubectl image based on Alpine Linux that signs certificates using the k8s extension api server
        image: quay.io/didil/k8s-webhook-cert-manager:0.13.19-1-a
        command: ["./generate_certificate.sh"]
        args:
          - "--service"
          - "deploy-webhook-service"
          - "--webhook"
          - "deployment.webhook.com"
          - "--secret"
          - "deploy-mutate-tls-secret"
          - "--namespace"
          - "default"
      restartPolicy: OnFailure
  backoffLimit: 3
