Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snipeit: Bugfix in initcontainer #151

Merged
merged 3 commits into from
Apr 29, 2021
Merged

snipeit: Bugfix in initcontainer #151

merged 3 commits into from
Apr 29, 2021

Conversation

lausser
Copy link
Contributor

@lausser lausser commented Apr 27, 2021

Hi,
sh -c find /var/www/html/..... does not what it was intended here. Actually, the command executed here is simply sh -c find, the rest is ignored. find and all it's parameters should be in quotes, so that the -c has only one argument.
I replaced this simply by chown -R ..., which has the same effect. I don't think wrapping everything in sh -c "command arg arg arg" is necessary.
It solves issues #150 and #127.

Also, the init container definition used the hardcoded path /var/www/html/storage/framework/sessions. I replaced it with .Values.persistence.sessions.mountPath, like it is done in the main container.

@mschmidt291
Copy link
Contributor

Hi Gerhard, thanks for the PR.
I see the issue. But can you please keep using the find command in your PR and not chown?
Background: When using plain chown on the complete sessions folder, it will take a very long time for the container to be ready, because of that we used the find command, which only changes ownership of files in the sessions folder which are not currently owned by the given user.

@lausser
Copy link
Contributor Author

lausser commented Apr 28, 2021

Tested with

      initContainers:
        - name: config-testdata
          image: busybox
          command: ["sh", "-c", "touch {{ .Values.persistence.sessions.mountPath }}/some_crap"]
          volumeMounts:
            - name: data
              mountPath: {{ .Values.persistence.sessions.mountPath }}
              subPath: {{ .Values.persistence.sessions.subPath }}
        - name: show-testdata
          image: busybox
          command: ["sh", "-c", "ls -l {{ .Values.persistence.sessions.mountPath }}"]
          volumeMounts:
            - name: data
              mountPath: {{ .Values.persistence.sessions.mountPath }}
              subPath: {{ .Values.persistence.sessions.subPath }}
        - name: config-data
          image: busybox
          command: ["sh", "-c", "find {{ .Values.persistence.sessions.mountPath }} -not -user 1000 -exec chown 1000 {} \\+"]
          volumeMounts:
            - name: data
              mountPath: {{ .Values.persistence.sessions.mountPath }}
              subPath: {{ .Values.persistence.sessions.subPath }}
        - name: show-testdata2
          image: busybox
          command: ["sh", "-c", "ls -l {{ .Values.persistence.sessions.mountPath }}"]
          volumeMounts:
            - name: data
              mountPath: {{ .Values.persistence.sessions.mountPath }}
              subPath: {{ .Values.persistence.sessions.subPath }}

Result:

:~/git/helm-charts$ kubectl -n snipe logs -f pod/snipe-snipeit-6d7989fd6b-26sp7 -c show-testdata
total 0
-rw-r--r--    1 root     root             0 Apr 28 09:21 some_crap
:~/git/helm-charts$ kubectl -n snipe logs -f pod/snipe-snipeit-6d7989fd6b-26sp7 -c show-testdata2
total 0
-rw-r--r--    1 1000     root             0 Apr 28 09:21 some_crap

@lausser
Copy link
Contributor Author

lausser commented Apr 28, 2021

I didn't notice that the changed code did not get properly pushed earlier today.

@mschmidt291 mschmidt291 self-requested a review April 29, 2021 08:52
mschmidt291
mschmidt291 previously approved these changes Apr 29, 2021
@mschmidt291
Copy link
Contributor

@lausser Looks good to me. Please raise the Chart version in the Chart.yaml to a BugFix release and then i am happy to merge

@trollr
Copy link

trollr commented Apr 29, 2021

Same issue here :( Will the PR be resolved in the next few minutes? I could use that very well now ^^

@mschmidt291 mschmidt291 merged commit eae3f1e into t3n:master Apr 29, 2021
@trollr
Copy link

trollr commented Apr 29, 2021

Thank you :) @mschmidt291 @lausser

Good Job 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants