apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: aso-wpdemo
spec:
  selector:
    matchLabels:
      app: wordpress
  replicas: 1
  template:
    metadata:
      name: aso-wpdemo
      labels:
        app: wordpress
    spec:
      containers:
      - name: aso-wpdemo
        image: wordpress
        ports: 
        - containerPort: 80
          name: wordpress
        env:
          - name: WORDPRESS_DEBUG
            value: "1"
          - name: WORDPRESS_DB_HOST
            value: "aso-wpdemo-mysqlserver.mysql.database.azure.com:3306"
          - name: WORDPRESS_DB_NAME
            value: aso-wpdemo-mysqldatabase
          - name: WORDPRESS_DB_USER
            valueFrom:
              secretKeyRef:
                name: aso-wpdemo-mysqlserver
                key: username
          - name: WORDPRESS_DB_PASSWORD
            valueFrom:
              secretKeyRef:
                name: aso-wpdemo-mysqlserver
                key: password
        volumeMounts:
        - name: wordpress-persistent-storage
          mountPath: /var/www/html
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
      volumes: 
      - name: wordpress-persistent-storage
        persistentVolumeClaim:
          claimName: wp-pv-claim
      - name: mysql-persistent-storage
        persistentVolumeClaim: 
          claimName: mysql-pv-claim