apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: ml-pipeline
  name: ml-pipeline
spec:
  selector:
    matchLabels:
      app: ml-pipeline
  template:
    metadata:
      labels:
        app: ml-pipeline
      annotations:
        cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
    spec:
      containers:
      - env:
        - name: AUTO_UPDATE_PIPELINE_DEFAULT_VERSION
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: autoUpdatePipelineDefaultVersion
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: OBJECTSTORECONFIG_SECURE
          value: "false"
        - name: OBJECTSTORECONFIG_BUCKETNAME
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: bucketName
        - name: DBCONFIG_USER
          valueFrom:
            secretKeyRef:
              name: mysql-secret
              key: username
        - name: DBCONFIG_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-secret
              key: password
        - name: DBCONFIG_DBNAME
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: pipelineDb
        - name: DBCONFIG_HOST
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: dbHost
        - name: DBCONFIG_PORT
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: dbPort
        - name: DBCONFIG_CONMAXLIFETIME
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: ConMaxLifeTime
        - name: OBJECTSTORECONFIG_ACCESSKEY
          valueFrom:
            secretKeyRef:
              name: mlpipeline-minio-artifact
              key: accesskey
        - name: OBJECTSTORECONFIG_SECRETACCESSKEY
          valueFrom:
            secretKeyRef:
              name: mlpipeline-minio-artifact
              key: secretkey
        image: gcr.io/ml-pipeline/api-server:dummy
        imagePullPolicy: IfNotPresent
        name: ml-pipeline-api-server
        ports:
        - name: http
          containerPort: 8888
        - name: grpc
          containerPort: 8887
        readinessProbe:
          exec:
            command:
              - wget
              - -q # quiet
              - -S # show server response
              - -O
              - "-" # Redirect output to stdout
              - http://localhost:8888/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:8888/apis/v1beta1/healthz
          initialDelaySeconds: 3
          periodSeconds: 5
          timeoutSeconds: 2
        # This startup probe provides up to a 60 second grace window before the
        # liveness probe takes over to accomodate the occasional database
        # migration.
        startupProbe:
          exec:
            command:
              - wget
              - -q # quiet
              - -S # show server response
              - -O
              - "-" # Redirect output to stdout
              - http://localhost:8888/apis/v1beta1/healthz
          failureThreshold: 12
          periodSeconds: 5
          timeoutSeconds: 2
        resources:
          requests:
            cpu: 250m
            memory: 500Mi
      serviceAccountName: ml-pipeline
