apiVersion: batch/v1
kind: Job
metadata:
  name: console-https-secret-create
  namespace: console-system
spec:
  template:
    metadata:
      name: console-https-secret-create
    spec:
      containers:
        - name: create
          image: docker.io/jettech/kube-webhook-certgen:v1.3.0
          imagePullPolicy: IfNotPresent
          args:
            - create
            - --host=console,console.$(POD_NAMESPACE).svc
            - --namespace=$(POD_NAMESPACE)
            - --secret-name=console-https-secret
          env:
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
      restartPolicy: OnFailure
      serviceAccountName: console-system-admin
      securityContext:
        runAsNonRoot: true
        runAsUser: 2000
