{{- if .Values.tfJobOperator.enabled }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    ksonnet.io/component: tf-job-operator
  name: tf-job-dashboard
  namespace: kubeflow
spec:
  template:
    metadata:
      labels:
        name: tf-job-dashboard
    spec:
      containers:
      - command:
        - /opt/tensorflow_k8s/dashboard/backend
        env:
        - name: KUBEFLOW_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        image: "{{ .Values.tfJobOperator.image.repository }}:{{ .Values.tfJobOperator.image.tag }}"
        name: tf-job-dashboard
        ports:
        - containerPort: 8080
      serviceAccountName: tf-job-dashboard
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    ksonnet.io/component: tf-job-operator
  name: tf-job-operator-v1alpha2
  namespace: kubeflow
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: tf-job-operator
    spec:
      containers:
      - command:
        - /opt/kubeflow/tf-operator.v2
        - --alsologtostderr
        - -v=1
        env:
        - name: MY_POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: MY_POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        image: "{{ .Values.tfJobOperator.image.repository }}:{{ .Values.tfJobOperator.image.tag }}"
        name: tf-job-operator
        volumeMounts:
        - mountPath: /etc/config
          name: config-volume
      serviceAccountName: tf-job-operator
      volumes:
      - configMap:
          name: tf-job-operator-config
        name: config-volume
{{- end }}
