K8s deployment of 2022.06 causes UnexpectedException: Unable to create directory [attachments] for attachments

Hi,
I’m trying to deploy an A12 application to the mgm cluster. But the data-services pod fails with an exception.

my helm chart:

init:
  enabled: false

configValues:
  clusterSafe: false
  springProfiles: dev
[...]
persistence:
  enabled: false
sizing:
  replicaCount: 1

[...]

This results in two emptyDir volume mount for /a12/attachmentsTmp and /a12/attachments

This is a shortened version of the stacktrace:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.mgmtp.a12.dataservices.attachment.persitence.AttachmentPersister]: Factory method 'fileSystemAttachmentPersister' threw exception; nested exception is com.mgmtp.a12.dataservices.exception.UnexpectedException: Unable to create directory [attachments] for attachments
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.22.jar!/:5.3.22]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.22.jar!/:5.3.22]
	... 118 common frames omitted
Caused by: com.mgmtp.a12.dataservices.exception.UnexpectedException: Unable to create directory [attachments] for attachments
	at com.mgmtp.a12.dataservices.attachment.persitence.internal.FileSystemAttachmentPersister.<init>(FileSystemAttachmentPersister.java:35) ~[dataservices-core-34.1.0.jar!/:na]
	at com.mgmtp.a12.dataservices.autoconfigure.ServiceFactory.fileSystemAttachmentPersister(ServiceFactory.java:97) ~[dataservices-core-spring-boot-autoconfigure-34.1.0.jar!/:na]

I looked in the pod and the /a12 directory looks like this:

> ls -al /a12
total 16
drwxr-xr-x 4 root root 4096 Sep 14 14:48 .
drwxr-xr-x 1 root root 4096 Sep 14 14:48 ..
drwxrwsrwx 2 root 1000 4096 Sep 14 14:48 attachments
drwxrwsrwx 2 root 1000 4096 Sep 14 14:48 attachmentsTmp

Why is this exception thrown?

Thanks,
Guido

Hi, does the user have permissions to the directories configured for attachments?

Hi Guido,

Try to to add an envrionment variable to additionalEnvVars with the name MGMTP_A12_DATASERVICES_ATTACHMENTS_EXT_FS_LOCATION and set its value to the path set by the attachments.storagePath value. By default you should use file:/a12/attachments as value for the environment variable.

In your values it should look like this:

configValues:
  additionalEnvVars: |-
    - name: MGMTP_A12_DATASERVICES_ATTACHMENTS_EXT_FS_LOCATION
      value: file:/a12/attachments

Cheers,
Emanuel

Quang Truong Pham Ngo helped me yesterday and we solved it with

additionalEnvVars: |
  - name: MGMTP_A12_DATASERVICES_ATTACHMENTS_EXT_FS_LOCATION
    value: "/a12/attachments"

But I think @emanuel-grey-ford 's way is the correct one. Thanks!