apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: ml-pipeline-ui
  name: ml-pipeline-ui
spec:
  selector:
    matchLabels:
      app: ml-pipeline-ui
  template:
    metadata:
      labels:
        app: ml-pipeline-ui
      annotations:
        cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
    spec:
      volumes:
      - name: config-volume
        configMap:
          name: ml-pipeline-ui-configmap
      containers:
      - image: gcr.io/ml-pipeline/frontend:dummy
        imagePullPolicy: IfNotPresent
        name: ml-pipeline-ui
        ports:
        - containerPort: 3000
        volumeMounts:
        - name: config-volume
          mountPath: /etc/config
          readOnly: true
        env:
          - name: VIEWER_TENSORBOARD_POD_TEMPLATE_SPEC_PATH
            value: /etc/config/viewer-pod-template.json
          - name: MINIO_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: MINIO_ACCESS_KEY
            valueFrom:
              secretKeyRef:
                name: mlpipeline-minio-artifact
                key: accesskey
          - name: MINIO_SECRET_KEY
            valueFrom:
              secretKeyRef:
                name: mlpipeline-minio-artifact
                key: secretkey
          - name: ALLOW_CUSTOM_VISUALIZATIONS
            value: "true"
        readinessProbe:
          exec:
            command:
              - wget
              - -q # quiet
              - -S # show server response
              - -O
              - "-" # Redirect output to stdout
              - http://localhost:3000/apis/v1beta1/healthz
          initialDelaySeconds: 3
          periodSeconds: 5
          timeoutSeconds: 2
        livenessProbe:
          exec:
            command:
              - wget
              - -q # quiet
              - -S # show server response
              - -O
              - "-" # Redirect output to stdout
              - http://localhost:3000/apis/v1beta1/healthz
          initialDelaySeconds: 3
          periodSeconds: 5
          timeoutSeconds: 2
        resources:
          requests:
            cpu: 10m
            memory: 70Mi
      serviceAccountName: ml-pipeline-ui
