apiVersion: apps/v1
kind: Deployment
metadata:
  name: model-registry-deployment
spec:
  template:
    metadata:
      annotations:
        # db doesn't use istio
        traffic.sidecar.istio.io/excludeOutboundPorts: $(MYSQL_PORT)
    spec:
      containers:
        - name: rest-container
          # Remove existing environment variables
          env:
          - $patch: replace
          envFrom:
          - configMapRef:
              name: model-registry-configmap
          args:
            - --hostname=0.0.0.0
            - --port=$(MODEL_REGISTRY_REST_SERVICE_PORT)
            - --mlmd-hostname=localhost
            - --mlmd-port=$(MODEL_REGISTRY_GRPC_SERVICE_PORT)
            - --datastore-type=$(MODEL_REGISTRY_DATA_STORE_TYPE)
        - name: grpc-container
          # Remove existing environment variables
          env:
          - $patch: replace
          envFrom:
          - configMapRef:
              name: model-registry-db-parameters
          - secretRef:
              name: model-registry-db-secrets
          - configMapRef:
              name: model-registry-configmap
          args: ["--grpc_port=$(MODEL_REGISTRY_GRPC_SERVICE_PORT)",
                 "--mysql_config_host=$(MLMD_DB_HOST)",
                 "--mysql_config_database=$(MYSQL_DATABASE)",
                 "--mysql_config_port=$(MYSQL_PORT)",
                 "--mysql_config_user=$(MYSQL_USER_NAME)",
                 "--mysql_config_password=$(MYSQL_ROOT_PASSWORD)"]
