apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-local-storage-ram
  labels:
    app: nginx-local-storage-ram
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-local-storage-ram
  template:
    metadata:
      labels:
        app: nginx-local-storage-ram
      name: nginx-local-storage-ram
    spec:
      schedulerName: hwameistor-scheduler
      restartPolicy: Always
      terminationGracePeriodSeconds: 0
      containers:
      - image: nginx:latest
        imagePullPolicy: IfNotPresent
        name: nginx
        ports:
        - containerPort: 80
        command:
        - sh
        - -xc
        - |
          VOL="$( df | grep /usr/share/nginx/html | awk '{print $1,$NF}' )"
          echo "<center><h1>Demo volume: ${VOL}</h1></center>" > /usr/share/nginx/html/index.html
          nginx -g "daemon off;"
        volumeMounts:
        - name: html-root
          mountPath: /usr/share/nginx/html
        resources:
          limits:
            cpu: '100m'
            memory: '100Mi'
      volumes:
      - name: html-root
        persistentVolumeClaim:
          claimName: local-storage-pvc-ram
