apiVersion: apps/v1
kind: Deployment
metadata:
  name: trips
  namespace: api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: trips
  template:
    metadata:
      labels:
        app: trips
    spec:
      nodeSelector:
        beta.kubernetes.io/os: linux
      containers:
        - name: trips
          image: registryktt4522.azurecr.io/trips:1.0
          volumeMounts:
            - mountPath: "/secrets"
              name: kv-secrets-vol
              readOnly: true
          env:
            - name: SQL_USER
              valueFrom:
                secretKeyRef:
                  name: foosecret
                  key: SQL_USER
            - name: SQL_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: foosecret
                  key: SQL_PASSWORD
            - name: SQL_SERVER
              valueFrom:
                secretKeyRef:
                  name: foosecret
                  key: SQL_SERVER
            - name: SQL_DBNAME
              valueFrom:
                secretKeyRef:
                  name: foosecret
                  key: SQL_DBNAME
          resources:
            requests:
              cpu: 100m
              memory: 128Mi
            limits:
              cpu: 250m
              memory: 256Mi
          ports:
            - containerPort: 80
              name: http
      volumes:
        - name: kv-secrets-vol
          csi:
            driver: secrets-store.csi.k8s.io
            readOnly: true
            volumeAttributes:
              secretProviderClass: "sql-kv-secret"