apiVersion: apps/v1
kind: Deployment
metadata:
  name: userprofile
  namespace: api
spec:
  replicas: 3
  selector:
    matchLabels:
      app: userprofile
  template:
    metadata:
      labels:
        app: userprofile
    spec:
      volumes:
      - name: tripinsights-secrets-2
        csi:
          driver: secrets-store.csi.k8s.io
          readOnly: true
          volumeAttributes:
            secretProviderClass: tripinsights-secrets-2
      containers:
      - name: userprofile
        image: registrydoy6068.azurecr.io/tripinsights/userprofile:1.0
        ports:
        - containerPort: 80
          name: userprofile
        env:
        - name: SQL_PASSWORD
          valueFrom:
            secretKeyRef:
              name: sqlserver-for-userprofile
              key: SQL_PASSWORD_KEY
        - name: SQL_SERVER
          valueFrom:
            configMapKeyRef:
              name: sqlserver-configmap
              key: sql_server
        - name: SQL_USER
          valueFrom:
            configMapKeyRef:
              name: sqlserver-configmap
              key: sql_user
        - name: SQL_DBNAME
          valueFrom:
            configMapKeyRef:
              name: sqlserver-configmap
              key: sql_dbname
        volumeMounts:
        - name: tripinsights-secrets-2
          mountPath: /secrets
          readOnly: true
