apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    application-crd-id: kubeflow-pipelines
    component: metadata-grpc-server
  name: metadata-grpc-deployment
  namespace: kubeflow
spec:
  replicas: 1
  selector:
    matchLabels:
      application-crd-id: kubeflow-pipelines
      component: metadata-grpc-server
  template:
    metadata:
      labels:
        application-crd-id: kubeflow-pipelines
        component: metadata-grpc-server
    spec:
      containers:
      - args:
        - --grpc_port=8080
        - --mysql_config_database=$(MYSQL_DATABASE)
        - --mysql_config_host=$(MYSQL_HOST)
        - --mysql_config_port=$(MYSQL_PORT)
        - --mysql_config_user=$(DBCONFIG_USER)
        - --mysql_config_password=$(DBCONFIG_PASSWORD)
        - --enable_database_upgrade=true
        command:
        - /bin/metadata_store_server
        env:
        - name: DBCONFIG_USER
          valueFrom:
            secretKeyRef:
              key: username
              name: mysql-secret
        - name: DBCONFIG_PASSWORD
          valueFrom:
            secretKeyRef:
              key: password
              name: mysql-secret
        - name: MYSQL_DATABASE
          valueFrom:
            configMapKeyRef:
              key: mlmdDb
              name: pipeline-install-config
        - name: MYSQL_HOST
          valueFrom:
            configMapKeyRef:
              key: dbHost
              name: pipeline-install-config
        - name: MYSQL_PORT
          valueFrom:
            configMapKeyRef:
              key: dbPort
              name: pipeline-install-config
        image: gcr.io/tfx-oss-public/ml_metadata_store_server:0.25.1
        livenessProbe:
          initialDelaySeconds: 3
          periodSeconds: 5
          tcpSocket:
            port: grpc-api
          timeoutSeconds: 2
        name: container
        ports:
        - containerPort: 8080
          name: grpc-api
        readinessProbe:
          initialDelaySeconds: 3
          periodSeconds: 5
          tcpSocket:
            port: grpc-api
          timeoutSeconds: 2
      serviceAccountName: metadata-grpc-server
