apiVersion: batch/v1
kind: Job
metadata:
  annotations:
   "helm.sh/hook": post-install
  name: healthcheck-logging-operator
spec:
  selector: {}
  template:
    metadata:
      name: healthcheck-logging-operator
    spec:
     restartPolicy: Never
     serviceAccountName: logging-healthcheck
     containers:
      - name: 'healthcheck'
        image: 'quay.io/openshift/origin-cli:latest'
        command: ["sh"]
        args:
        - '-c'
        - 'while [[ `oc get csv -n openshift-logging | grep cluster-logging | grep Succeeded` = "" ]]; do echo "ClusterLogging operator still pending, sleeping for 5 sec"; sleep 5; done && oc get csv -n openshift-logging | grep cluster-logging'
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: logging-healthcheck
subjects:
- kind: ServiceAccount
  name: logging-healthcheck
  namespace: openshift-logging
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: logging-healthcheck