apiVersion: batch/v1
kind: Job
metadata:
  name: ${FQDN}-count-active-users
  namespace: ${NS}
spec:
  template:
    spec:
      restartPolicy: Never
      containers:
        - name: wrench
          image: libresh/wrench
          args:
            - rc
            - user
            - count
            - --mongo-url=$(MONGO_URL)
            - --active
            - --last-login=30
          env:
            - name: MONGO_URL
              valueFrom:
                secretKeyRef:
                  key: MONGO_URL
                  name: ${FQDN}-app
            - name: ADMIN_USER
              valueFrom:
                configMapKeyRef:
                  key: ADMIN_USERNAME
                  name: ${FQDN}-config
            - name: ADMIN_PASS
              valueFrom:
                secretKeyRef:
                  key: ADMIN_PASS
                  name: ${FQDN}-app
