# Generic Mount Example

This allows you to mount any pre-provisioned PVs, secret or configMap into any container.
It can be used e.g. to mount migration nfs, cifs / samba shares into a pipeliner container.

Use the following format:

```
mounts:
  generic:
    - name: <name>:
      path: <the path in the container, where you want to mount this>
      volumeName: <the name of the PV to be mounted>
      configMap: <the name of the configMap to bemounted>
      secret: <the name of the secret to bemounted>
      subPath: [a (optional) subpath to be used inside the PV]
      accessMode: <ReadWriteMany|ReadWriteOnce|ReadOnlyMany|ReadWriteOncePod>
      size: <size request>
```

## Mounting generic secrets or configMaps

In this example, we create a secret with two sample files and a configMap with two sample files:

```
apiVersion: v1
kind: Secret
metadata:
  name: sample-generic-secret
type: Opaque
stringData:
  test1.txt: |
    This is a test file
    lets see if this works.
  test2.txt: |
    This is a second test file
    lets see if this works.
---
apiVersion: v1 
kind: ConfigMap 
metadata:
  name: sample-generic-configmap
data:
  test1.txt: |
    This is a test file
    lets see if this works.
  test2.txt: |
    This is a second test file
    lets see if this works.
```

Then we use these objects to mount them as directory and as files:

```
nappl:
  mounts:
    generic:
      # -- This shows how to mount the contents of a secret into
      # a directory
      - name: "sample-generic-secret"
        secret: "sample-generic-secret"
        path: "/mnt/secret"

      # -- This shows how to mount the contents of a configMap into
      # a directory
      - name: "sample-generic-configmap"
        configMap: "sample-generic-configmap"
        path: "/mnt/configmap"

      # -- This shows how to mount a file from a secret to a secret file
      - name: "sample-generic-secret-file"
        secret: "sample-generic-secret"
        path: "/mnt/secret-file.txt"
        subPath: "test1.txt"

      # -- This shows how to mount a file from a configMap to a file
      - name: "sample-generic-configmap-file"
        configMap: "sample-generic-configmap"
        path: "/mnt/configmap-file.txt"
        subPath: "test2.txt"
```

## Mounting generic PVs

Here is an example how to mount any pre-created PV:

```
mounts:
  generic:
    # -- This shows how to mount a generic Persistent Volume
    - name: "migration"
      path: "/mnt/migration"
      subPath: "{{ .Release.Name }}-mig"
      accessModes: 
        - ReadWriteMany
      volumeName: my-migration-data-volume
      size: "512Gi"
```