apiVersion: v1
kind: Pod
metadata:
  name: web-server
spec:
  # TODO: As a future improvement, if we add topology support to the mock driver, 
  # then we don't need podAffinity in this pod. The pv provisioned will have a 
  # nodeaffinity on it, and the pod will always get scheduled to the correct node.
  #
  # Deploy this pod only on where csi-mock-driver exists.
  # This is because csi-mock-driver keeps all states in memory and the process that
  # provisioned the PV needs to be the same process that's mounting it.
  affinity:
    podAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchExpressions:
          - key: app
            operator: In
            values:
            - csi-mockplugin
        topologyKey: "kubernetes.io/hostname"
  containers:
   - name: web-server
     image: nginx 
     volumeMounts:
       - mountPath: /var/lib/www/html
         name: mypvc
  volumes:
   - name: mypvc
     persistentVolumeClaim:
       claimName: example-pvc
       readOnly: false
