apiVersion: apps/v1
kind: Deployment
metadata:
  name: go-vol-deployment
  labels:
    app: go-vol
    system: example
spec:
  replicas: 2
  selector:
    matchLabels:
      app: go-vol
  template:
    metadata:
      labels:
        app: go-vol
        system: example
    spec:
      containers:
        - name: go-vol-container
          image: cjimti/go-vol:latest
          imagePullPolicy: Always
          env:
            - name: PORT
              value: "80"
            - name: VOL_PATH
              value: "/files"
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: SERVICE_ACCOUNT
              valueFrom:
                fieldRef:
                  fieldPath: spec.serviceAccountName
          volumeMounts:
            - mountPath: /files
              name: go-vol-storage
              readOnly: false
          ports:
            - name: go-vol-port
              containerPort: 80
      volumes:
        - name: go-vol-storage
          flexVolume:
            driver: rook.io/rook
            fsType: ceph
            options:
              clusterName: rook
              fsName: testfs # see setup-rookfs.yml