Existing ConfigMaps, Secrets, and Persistent Volume Claims on the cluster can be mounted automatically to all containers created by
odo. These resources can be configured by applying the appropriate labels.
To mark a resource for mounting to containers created by
odo, apply the following label to the resource:
By default, resources will be mounted based on the resource name:
Secrets will be mounted to
Configmaps will be mounted to
Persistent volume claims will be mounted to
Mounting resources can be additionally configured via annotations:
devfile.io/mount-path: configure where the resource should be mounted
devfile.io/mount-as: for secrets and configmaps only, configure how the resource should be mounted to the container
devfile.io/mount-as: file, the configmap/secret will be mounted as files within the mount path. This is the default behavior.
devfile.io/mount-as: subpath, the keys and values in the configmap/secret will be mounted as files within the mount path using subpath volume mounts.
devfile.io/mount-as: env, the keys and values in the configmap/secret will be mounted as environment variables in all containers.
fileis used, the configmap is mounted as a directory within the containers, erasing any files/directories already present. When
subpathis used, each key in the configmap/secret is mounted as a subpath volume mount in the mount path, leaving existing files intact but preventing changes to the secret/configmap from propagating into the containers without a restart.
devfile.io/read-only: for persistent volume claims, mount the resource as read-only
devfile.io/mount-access-mode: for secret/configmap, can be used to configure file permissions on mounted files. The value can be in octal notation between
0400), or in decimal notation between
511. The default value is
0644in octal (