Configuring additionalMounts parameter
- Used to mount a list of additional resources like configMaps, secrets, and PVCs with volume mount configuration, to be mounted into each pods.
- Used to pass customer overrides through a
configMap
to the pods as an alternate way. For more information, see Passing customer overrides through configMaps by using additionalMounts.
The following .yaml file is a sample schema of
additionalMounts
:
additionalMounts:
configMaps:
- name: ""
mountPath: ""
# subPath: ""
# subPathExpr: ""
# readOnly: false
# mountPropagation: ""
# matchLabels: {}
secrets:
- name: ""
mountPath: ""
# subPath: ""
# subPathExpr: ""
# readOnly: false
# mountPropagation: ""
# matchLabels: {}
storages:
- name: ""
mountPath: ""
# storageClassName: ""
# accessMode: ""
# capacity:
# matchLabels: {}
The following table explains the attributes applicable for both configMaps and secrets properties
of
additionalMounts
parameter.
Property | Default value | Value type | Required | Description |
---|---|---|---|---|
name |
string | Yes | Specify the name and make sure it matches the name of a configMap or a secret. | |
mountPath |
string | Yes | Specify the path within the container where the volume should be mounted. Note: The path must
not contain ':'.
|
|
mountPropagation |
string | No | This determines how mounts are propagated from the host to container and the other way
around. When not set, MountPropagationNone is used. |
|
readOnly |
false |
boolean | No | Mounted read-only if true, read-write otherwise (false or unspecified). |
subPath |
"" (volumes's root) |
string | No | Path within the configMap or secret from which the container's volume should be mounted. |
subPathExpr |
"" (volumes's root) |
string | No | Expanded path within the configMap or secret from which the container's volume should be
mounted. Behaves similarly to SubPath but environment variable references
$(VAR_NAME) are expanded using the container's environment.
SubPathExpr and SubPath are mutually exclusive. |
matchLabels |
object | No | Specify matchLabels as key-value pair. If matchLabels are
empty, then the volume is mounted to every pod. Otherwise, the additional volume is mounted to only
those pods where key-value pair of matchLabels matches with key-value pair of
podLabels . |
The following table explains the attributes applicable for
storage
property of
additionalMounts
spec.
Property | Default value | Value type | Required | Description |
---|---|---|---|---|
mountPath |
|
string | Yes | Specify the path to mount a PV onto the pod. Note: Do not set the path to
/shared . |
name |
shared-volume |
string | Yes | Specify the name of the Persistent Volume claim. |
accessMode |
ReadWriteMany |
string | No | Specify the access mode for the Persistent Volume. |
capacity |
10Gi |
string or integer | No | Specify the capacity for the Persistent Volume. |
storageClassName |
default |
string | No | Specify the storage class for the Persistent Volume claim. |
matchLabels |
object | No | Specify matchLabels as key-value pair. If matchLabels are
empty, then the volume is mounted to every pod. Otherwise, the additional volume is mounted to only
those pods where key-value pair of matchLabels matches with key-value pair of
podLabels . |
Automation of initialization scripts by using additionalMounts
You can choose to mount your initialization scripts to the pods and that allows the scripts to
run automatically when your application and agent servers start. Use
additionalMounts
to mount initialization scripts to a specific location inside the
pod. The scripts must be mounted to the /opt/ssfs/init
location, (a sub-directory
is also accepted). When the pod starts, it checks this location for executable files and runs the
scripts in alphabetical order. For NFS storage, you must change the permissions such that the
scripts are executable. The pod runs only executable files inside the
/opt/ssfs/init
location.
Mount the scripts by using configMap and storage as shown in the following example that includes
sample scripts. Change the configuration to include the required
scripts.
additionalMounts:
configMaps:
- name: init-scripts
mountPath: /opt/ssfs/init/cm_scripts
defaultMode: 0770
storages:
- name: scripts-pvc
accessMode: ReadWriteMany
capacity: '10Gi'
mountPath: /opt/ssfs/init/storage_scripts
storageClassName: default