atlassian / data-center-helm-charts

Helm charts for Atlassian's Data Center products
https://atlassian.github.io/data-center-helm-charts/
Apache License 2.0
158 stars 134 forks source link

[Suggestion] - [jira] Use special variable to right separate mount for logs and home #844

Open w1ndblow opened 4 months ago

w1ndblow commented 4 months ago

Suggestion

problem happen with config

localHome:
    persistentVolumeClaim:
      create: true

Into the pod mounts other volume

$ df
/dev/sdg   <> <> <>   1% /opt/atlassian/jira/logs

when pvc is creating it binds to first local-home mount (/opt/atlassian/jira/logs) and logs get space whereas local-home directory /var/atlassian/application-data/jira is not, it can see df command

if my decision https://github.com/atlassian/data-center-helm-charts/pull/842 is not satisfied with our plan, i suggest create other variable and pvc for that

logs:
    persistentVolumeClaim:
      create: true

Product

jira

Code of Conduct

bianchi2 commented 4 months ago

@w1ndblow

I am sorry but I have hard time understanding what the issue is. Can you please rephrase:

when pvc is creating it binds to first local-home mount (/opt/atlassian/jira/logs) and logs get space whereas local-home directory /opt/atlassian/jira/ is not

Btw, /opt/atlassian/jira should not be persisted at all, it's an installation directory.

Our existing configuration uses subPath which makes it possible to use 2 volumeMounts in 1 volume.

Again, can you please paraphrase your problem statement, e.g. "Logs in directory xxx not persisted" or "Can't create a pod because of...".

w1ndblow commented 3 months ago

Our existing configuration uses subPath which makes it possible to use 2 volumeMounts in 1 volume.

What does it mean? There is configuration https://github.com/atlassian/data-center-helm-charts/blob/main/src/main/charts/jira/templates/_helpers.tpl#L153 path with values .Values.jira.accessLog.mountPath gets pv with pvc whereas path with value .Values.volumes.localHome.mountPath (/var/atlassian/application-data/jira) is not

bianchi2 commented 3 months ago

Yes, that's expected. The two volume mounts use one PVC, one volumeMount (tomcat logs) is using subpath. This way data is persisted in both locations and there's no need to declare an additional PVC just to persist Tomcat logs.

w1ndblow commented 3 months ago

I think you are mistaken in interpreting this feature, as you can see in the official documentation the example is given with several containers and not with one. To confirm my words, try to run this configuration on your cluster and go into the container and see the information about system mounts (df for example)

bianchi2 commented 3 months ago

@w1ndblow it does not matter if it's one or several containers. Both directories are persisted:

root@jira-0:/var/atlassian/application-data/jira# mount | grep jira
/dev/vda1 on /var/atlassian/application-data/jira type ext4 (rw,relatime,discard)
/dev/vda1 on /opt/atlassian/jira/logs type ext4 (rw,relatime,discard)

Just to confirm, what you say is that your Jira home is not persisted? Can you write a file to /var/atlassian/application-data/jira, kill the pod and then check if the file is still there?

Also, can you share more information about your k8s version, vendor/cloud and storage class?

w1ndblow commented 3 months ago

the provisioner of class is csi.vsphere.vmware.com, server version v1.26.5 there is private instances of k8s. i don't achieve behavior like in your cluster, but it is not so important, i suggest more clearly configuration If user need to persist logs of specific instance he may create different pvc

bianchi2 commented 3 months ago

@w1ndblow can you please answer the question I asked a few times already?

Just to confirm, what you say is that your Jira home is not persisted? Can you write a file to /var/atlassian/application-data/jira, kill the pod and then check if the file is still there?

If you see different behavior with subPath, you may want to investigate it for your particular k8s provider and StorageClass. Like I said before this is the first report of subPath not working and Jira home not being persisted. Can you share output from mount command in your jira container?

w1ndblow commented 4 weeks ago

I figured out the problem, command df и web ui in jira displays only one of mount's

df -h 
Filesystem                Size  Used Avail Use% Mounted on
overlay                    98G   54G   40G  58% /
tmpfs                      64M     0   64M   0% /dev
/dev/mapper/deb--vg-root   19G  5.2G   13G  30% /etc/hosts
/dev/mapper/vg0-lv0        98G   54G   40G  58% /etc/hostname
shm                        64M     0   64M   0% /dev/shm
/dev/rbd2                 9.8G   33M  9.7G   1% /var/atlassian/application-data/jira
tmpfs                      63G   12K   63G   1% <>
tmpfs                      32G     0   32G   0% /proc/acpi
tmpfs                      32G     0   32G   0% /sys/firmware

but there are two in fact

mount | grep "/var/atlassian/application-data/jira"
/dev/rbd2 on /var/atlassian/application-data/jira type ext4 (rw,relatime,discard,stripe=16)
mount | grep "/opt/atlassian/jira/logs"
/dev/rbd2 on /opt/atlassian/jira/logs type ext4 (rw,relatime,discard,stripe=16)

it is still possible to separate the log sections from the home one, this will be more explicit and simplify the configuration