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

Helm chart extraContainers appears to produce yaml with incorrect indentation. #6176

Open
bbil opened this issue Oct 18, 2024 · 0 comments
Open

Comments

@bbil
Copy link

bbil commented Oct 18, 2024

Describe the bug

The extraContainers value of the Helm chart appears to be outputting yaml with slightly wrong indentation, in my case for the ports list.

Workaround is use a yaml string instead. This outputs yaml that makes more sense to me.

To Reproduce

  1. Create a Helm chart that uses the Apollo Router helm chart
  2. Set .Values.router.extraContainers to yaml configuration for the extra container
  3. Render the helm template; and see the indentation

Expected behavior

Rendered Helm chart uses correct indentation.

Output

My Helm Chart Values

router:
  extraContainers: 
    - name: coprocessor
      image: "image:tag"
      imagePullPolicy: IfNotPresent
      command: ["run_the_thing"]
      ports:
        - name: http
          containerPort: 3000
          protocol: TCP

Weird looking output

      containers:
        - command:
          - run_the_thing
          image: img:tag
          imagePullPolicy: IfNotPresent
          name: coprocessor
          ports:
          - containerPort: 3000
            name: http
            protocol: TCP
        - name: router
           ports:
             - name: http
               containerPort: 4000
               protocol: TCP
             - name: health
               containerPort: 8088
               protocol: TCP

Notice the difference between router and coprocessor container ports.

Changing to yaml string

router:
  extraContainers: |      # <-- stringify!
    - name: coprocessor
      image: "image:tag"
      imagePullPolicy: IfNotPresent
      command: ["run_the_thing"]
      ports:
        - name: http
          containerPort: 3000
          protocol: TCP

Now the output looks better

      containers:
        - name: coprocessor
          image: "img:tag"      # <-- also now the image is wrapped as a string, which is probably for the best
          imagePullPolicy: IfNotPresent
          command: ["run_the_thing"]
          ports:
            - name: http
              containerPort: 3000
              protocol: TCP
        - name: router
           ports:
             - name: http
               containerPort: 4000
               protocol: TCP
             - name: health
               containerPort: 8088
               protocol: TCP

Desktop (please complete the following information):

N/A

Additional context

I'm willing to admit this could be a PEBKAC issue. And using the yaml string is fine enough. But the example I see in the Helm chart is not using yaml strings.

# -- An array of extra containers to include in the router pod
# Example:
# extraContainers:
#   - name: coprocessor
#     image: acme/coprocessor:1.0
#     ports:
#       - containerPort: 4001
extraContainers: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant