Requirement is to dynamically create a subdirectory based on pod uid and mount it inside the container.
env:
- name: METADATA_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
Since init containers are not supported in Google Cloud Run, we will have to achieve this by running a side car and wait in main container until the directory is created.
mkdir -p /shared_storage_root/POD_$METADATA_UID/logs/XYZ
and mount inside container
- name: log-efs
mountPath: /home/app/logs
subPathExpr: POD_$METADATA_UID/logs/XYZ
is subPathExpr feature supported by Google Cloud Run? I have seen post which suggests that we can apply a full k8s manifest generated by helm in Google Cloud Run, so does it mean it will be supported at runtime?
subPathExpr is not supported by Cloud Run. While you can use Helm to generate configs that are compatible with Cloud Run, not all Kubernetes configs are compatible with it.