bjw-s / helm-charts

A collection of Helm charts
https://bjw-s.github.io/helm-charts/
Apache License 2.0
582 stars 106 forks source link

initContainer tag being truncated in v2.3.0 #229

Closed adampetrovic closed 10 months ago

adampetrovic commented 10 months ago

Details

What steps did you take and what happened:

Upgrading my application which makes use of initContainers from app-template 1.x to 2.3.0. In doing so, I have the image ghcr.io/onedr0p/postgres-init:14.10.

When I deploy, the init container is created with image tag 14.1 instead of 14.10, causing the container to fail as that version doesn't exist.

What did you expect to happen:

I expect the initContainer to use the image tag specified.

Additional Information:

configuration:

 controllers:
      main:
        annotations:
          reloader.stakater.com/auto: "true"
        initContainers:
          init-db:
            image:
              repository: ghcr.io/onedr0p/postgres-init
              tag: 14.10
              pullPolicy: Always
            envFrom:
              - secretRef:
                  name: teslamate-secret

resulting deployment:

Init Containers:
   init-db:
    Image:      ghcr.io/onedr0p/postgres-init:14.1
    Port:       <none>
    Host Port:  <none>
bjw-s commented 10 months ago

Hi, thanks for rasing this bug report!

14.10 without quotes is a number as parsed by YAML rather than a string. Helm uses the same YAML parser that Kubernetes does and they both follow the specification on this. If you want to retain the 0 on the end you will have to wrap it in quotes to make it a string like "14.10". This will force the parser to see a string which is what I think you intend. What you've seen is the result of number handling.

As for why this wasn't happening with v1: the way the values are being parsed has changed in v2 resulting in a number of intermediate toYaml and/or fromYaml conversion steps which call the YAML parser.

adampetrovic commented 10 months ago

Thanks bjw-s - I learned something new today :)