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

Fix persistence init container indentation #85

Merged
merged 1 commit into from
Apr 8, 2024
Merged

Conversation

fk-flip
Copy link
Contributor

@fk-flip fk-flip commented Apr 2, 2024

Observed on master and Helm Chart version 0.23.0

Indentation for the newly introduced init-data-dir init container (#82) is incorrect, resulting in Helm templating errors when setting and making use of .Values.initContainers:

values.yaml:

initContainers:
  - name: wait-for-postgres
    image: ghcr.io/patrickdappollonio/wait-for:v1.0.0
    env:
    - name: POSTGRES_ADDRESS
      value: "postgresql:5432"
    command:
      - /wait-for
    args:
      - --host="$(POSTGRES_ADDRESS)"
      - --timeout=240s
      - --verbose

Rendered Helm Deployment:

[...]
      initContainers:
      - name: init-data-dir
        image: "n8nio/n8n:1.33.1"
        command: ["/bin/sh", "-c", "mkdir -p /home/node/.n8n/"]
        volumeMounts:
        - name: data
          mountPath: /home/node/.n8n
      
        - args:
          - --host="$(POSTGRES_ADDRESS)"
          - --timeout=240s
          - --verbose
          command:
          - /wait-for
          env:
          - name: POSTGRES_ADDRESS
            value: postgresql:5432
          image: ghcr.io/patrickdappollonio/wait-for:v1.0.0
          name: wait-for-postgres
[...]

Observed error:

error validating data: [ValidationError(Deployment.spec.template.spec.initContainers[0].volumeMounts[1]): unknown field "args" in io.k8s.api.core.v1.VolumeMount, ValidationError(Deployment.spec.template.spec.initContainers[0].volumeMounts[1]): unknown field "command" in io.k8s.api.core.v1.VolumeMount, ValidationError(Deployment.spec.template.spec.initContainers[0].volumeMounts[1]): unknown field "env" in io.k8s.api.core.v1.VolumeMount, ValidationError(Deployment.spec.template.spec.initContainers[0].volumeMounts[1]): unknown field "image" in io.k8s.api.core.v1.VolumeMount, ValidationError(Deployment.spec.template.spec.initContainers[0].volumeMounts[1]): missing required field "mountPath" in io.k8s.api.core.v1.VolumeMount]

As you can see, due to the wrong indentation, the additional configured init container is not treated as such but as additional volume mount for the init-data-dir init container.

@fk-flip fk-flip requested a review from a team as a code owner April 2, 2024 13:17
@Vad1mo Vad1mo merged commit 4f70095 into 8gears:master Apr 8, 2024
@Vad1mo
Copy link
Member

Vad1mo commented Apr 8, 2024

@Karitham, can you also have a look?

@Karitham
Copy link
Contributor

Karitham commented Apr 8, 2024

At first glance, both the original and the fix are valid yaml. It seems this issue only appears when you also have your own init-containters because the identation is different! Good catch.

@fk-flip
Copy link
Contributor Author

fk-flip commented Apr 10, 2024

@Vad1mo thanks for merging. Can you please release this in a new Chart version as it's currently blocking us from updating n8n, thanks!

@Vad1mo
Copy link
Member

Vad1mo commented Apr 10, 2024

it is already, see https://artifacthub.io/packages/helm/open-8gears/n8n?modal=changelog

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