apiVersion: batch/v1
kind: Job
metadata:
  name: create-user
spec:
  template:
    metadata:
      name: create-user
    spec:
      containers:
      - name: couchbase-cli
        image: couchbaseutils/couchbase-cli:v5.5.0
        imagePullPolicy: IfNotPresent
        command: ["/bin/sh", "-c", "couchbase-cli-secure user-manage
										 -c ${CLUSTER_NAME}
										 -u {auth.admin.username}
										 -p {auth.admin.password}
										 --rbac-username {auth.users.default_user}
                     --rbac-password {auth.users.default_password}
                     --roles admin --auth-domain local --set"]
        env:
          - name: CLUSTER_NAME
            value: cb-example
        volumeMounts:
          - name: cb-admin
            mountPath: "/auth/admin"
          - name: cb-users
            mountPath: "/auth/users"
      volumes:
        - name: cb-admin
          secret:
            secretName: cb-example-auth
        - name: cb-users
          secret:
            secretName: cb-user-auth
      restartPolicy: Never
