apiVersion: apps/v1
kind: Deployment
metadata:
  name: minikube-sqlserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: minikube-mssql
  template:
    metadata:
      labels:
        app: minikube-mssql
    spec:
      containers:
      - name: minikube-sqlserver
        image: mcr.microsoft.com/mssql/server:2019-RC1-ubuntu
        resources:
          requests:
            memory: "1Gi"
            cpu: "10.5"
          limits:
            memory: "1Gi"
            cpu: "0.5"
        ports:
        - containerPort: 1433
        env:
        - name: MSSQL_PID
          value: "Developer"
        - name: ACCEPT_EULA
          value: "Y"
        - name: SA_PASSWORD
          valueFrom:
            secretKeyRef:
              name: minikube-mssql
              key: SA_PASSWORD 
        - name: MSSQL_DATA_DIR
          value: '/demo/data'
        - name: MSSQL_LOG_DIR
          value: '/demo/log'
        volumeMounts:
        - name: vol-minikube-mssql-systemdbs
          mountPath: /var/opt/mssql/
        - name: vol-minikube-mssql-data
          mountPath: /demo/data
        - name: vol-minikube-mssql-logs
          mountPath: /demo/log
      volumes:
      - name: vol-minikube-mssql-systemdbs
        persistentVolumeClaim:
          claimName: pvc-minikube-mssql-systemdbs
      - name: vol-minikube-mssql-data
        persistentVolumeClaim:
          claimName: pvc-minikube-mssql-data
      - name: vol-minikube-mssql-logs
        persistentVolumeClaim:
          claimName: pvc-minikube-mssql-logs