apiVersion: apps/v1
kind: Deployment
metadata:
  name: metadata-grpc-deployment
  labels:
    component: metadata-grpc-server
spec:
  replicas: 1
  selector:
    matchLabels:
      component: metadata-grpc-server
  template:
    metadata:
      labels:
        component: metadata-grpc-server
    spec:
      containers:
      - name: container
        image: gcr.io/tfx-oss-public/ml_metadata_store_server:0.21.1
        env:
        - name: DBCONFIG_USER
          valueFrom:
            secretKeyRef:
              name: mysql-credential
              key: username
        - name: DBCONFIG_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-credential
              key: password
        - name: MYSQL_DATABASE
          valueFrom:
            configMapKeyRef:
              name: metadata-mysql-configmap
              key: MYSQL_DATABASE
        - name: MYSQL_HOST
          valueFrom:
            configMapKeyRef:
              name: metadata-mysql-configmap
              key: MYSQL_HOST
        - name: MYSQL_PORT
          valueFrom:
            configMapKeyRef:
              name: metadata-mysql-configmap
              key: MYSQL_PORT
        command: ["/bin/metadata_store_server"]
        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)"
               ]
        ports:
        - name: md-backendapi
          containerPort: 8080
