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

[bitnami/tomcat] Unable to install tomcat if an initContainers is set within a yaml value file. #29158

Closed
irenee25 opened this issue Sep 2, 2024 · 5 comments
Assignees
Labels
solved stale 15 days without activity tech-issues The user has a technical issue about an application tomcat

Comments

@irenee25
Copy link

irenee25 commented Sep 2, 2024

Name and Version

bitnami/tomcat 11.2.18

What architecture are you using?

amd64

What steps will reproduce the bug?

Export default value within a file.
Just edit the content of initContainers.

For example :

initContainers:
  - name: init-create-dir
    image: alpine
    imagePullPolicy: Always

Are you using any custom parameters or values?

Yes, using a custom initContainers

initContainers:
  - name: init-create-dir
    image: alpine
    imagePullPolicy: Always

What is the expected behavior?

The template must generate a template as below :

      initContainers:
        - name: volume-permissions
          image: docker.io/bitnami/os-shell:11-debian-11-r94
          imagePullPolicy: "IfNotPresent"
          command:
            - /bin/bash
            - -ec
            - |
                chown -R 1001:1001 /bitnami/tomcat
          securityContext:
            runAsUser: 0
          resources:
            limits: {}
            requests: {}
          volumeMounts:
            - name: data
              mountPath: /bitnami/tomcat

        - image: alpine
          imagePullPolicy: Always
          name: init-create-dir

What do you see instead?

  initContainers:
    - name: volume-permissions
      image: docker.io/bitnami/os-shell:11-debian-11-r94
      imagePullPolicy: "IfNotPresent"
      command:
        - /bin/bash
        - -ec
        - |
            chown -R 1001:1001 /bitnami/tomcat
      securityContext:
        runAsUser: 0
      resources:
        limits: {}
        requests: {}
      volumeMounts:
        - name: data
          mountPath: /bitnami/tomcat

  - image: alpine
    imagePullPolicy: Always
    name: init-create-dir

Additional information

To fix the issue, edit the code of tomcat/templates/_pod.tpl, near line 62.

Replace

{{- if .Values.initContainers }}
{{ include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $)  }}
{{- end }}

by

{{- if .Values.initContainers }}
{{ include "common.tplvalues.render" (dict "value" .Values.initContainers "context" $) | nindent 2 }}
{{- end }}

( add indentation +2 )

Rendered template will be correct.

@irenee25 irenee25 added the tech-issues The user has a technical issue about an application label Sep 2, 2024
@github-actions github-actions bot added the triage Triage is needed label Sep 2, 2024
@javsalgar
Copy link
Contributor

Hi!

Thank you so much for reporting! As you spotted it, would you like to submit a PR with the fix?

@irenee25
Copy link
Author

irenee25 commented Sep 3, 2024

Hi!

Thank you so much for reporting! As you spotted it, would you like to submit a PR with the fix?

Honestly, i prefer that an expert will check, have a look and make changes. It is working locally on my side, but i have no idea of possible side effects on other K8S.
Moreover, sorry, i am not really fluent on git actions (forking, ... )
And, after checking git history, i could see that commit 806c0e8 does the opposite of my proposal. I don't know the reason.

@github-actions github-actions bot removed the triage Triage is needed label Sep 4, 2024
@github-actions github-actions bot assigned migruiz4 and unassigned javsalgar Sep 4, 2024
@migruiz4
Copy link
Member

Thank you for reporting this issue @irenee25!

I have submitted this PR with your suggestion #29448

The change at 806c0e8 was correct, but later at some point, we modified the volumePermissions indent and forgot to set it back for initContainers, causing this issue.

As I mentioned in the PR's 'Additional information' section, the indentation is not wrong by itself, both with and without initial whitespace are valid as long as they are used consistently, which is not the case when volumePermissions (indent 2) is used with initContainers (indent 0).

Copy link

github-actions bot commented Oct 2, 2024

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label Oct 2, 2024
Copy link

github-actions bot commented Oct 7, 2024

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@github-actions github-actions bot added the solved label Oct 7, 2024
@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved stale 15 days without activity tech-issues The user has a technical issue about an application tomcat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants