---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: pv$VERSION
spec:
  capacity:
    storage: 10Gi
  accessModes:
  - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
  storageClassName: local-storage
  local:
    path: /run
  nodeAffinity:
    required:
      nodeSelectorTerms:
      - matchExpressions:
        - key: kubernetes.io/hostname
          operator: In
          values:
          - $NODE
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: v$VERSION
spec:
  serviceName: v$VERSION
  replicas: 1
  selector:
    matchLabels:
      app: v
      version: "$VERSION"
  template:
    metadata:
      labels:
        app: v
        version: "$VERSION"
    spec:
      containers:
      - name: v
        image: docker
        command:
          - "sleep"
          - "3600"
        volumeMounts:
        - mountPath: /host
          name: v
  volumeClaimTemplates:
  - metadata:
      name: v
    spec:
      accessModes: [ "ReadWriteMany" ]
      resources:
        requests:
          storage: 10Gi
      storageClassName: local-storage
      volumeName: pv$VERSION
