Skip to content

typeIs/typeOf behavior has changed since helm 3.18.0 #30880

@marcmillien

Description

@marcmillien

With helm 3.18.0, there is a change in typeIs/typeOf gotemplate behavior.

For example in:
https://github.com/oauth2-proxy/manifests/blob/4001c2385dc72990add71437b02e18d7ec7f8ffd/helm/oauth2-proxy/templates/_ingress.tpl#L40-L44

While debugging, we saw that typeOf .servicePort has changed from float64 to json.Number.

This could be a bad practice from the chart (that should probably use KindIs), but this is widely used and could break many charts.

Step to reproduce:

Helm 3.17.3:

$ helm repo add oauth2-proxy https://oauth2-proxy.github.io/manifests
"oauth2-proxy" has been added to your repositories

$ helm version
version.BuildInfo{Version:"v3.17.3", GitCommit:"e4da49785aa6e6ee2b86efd5dd9e43400318262b", GitTreeState:"clean", GoVersion:"go1.23.7"}

$ cat <<EOF | helm template demo oauth2-proxy/oauth2-proxy -f -
{
  "ingress": {
    "enabled": true,
    "hosts": ["demo.fr"]
  }
}
EOF
[...]
# Source: oauth2-proxy/templates/ingress.yaml
[...]
spec:
  rules:
    - host: "demo.fr"
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: demo-oauth2-proxy
                port:
                  number: 80                                         <==== OK

Helm 3.18.0:

$ helm version
version.BuildInfo{Version:"v3.18.0", GitCommit:"cc58e3f5a3aa615c6a86275e6f4444b5fdd3cc4e", GitTreeState:"clean", GoVersion:"go1.24.3"}

$ cat <<EOF | helm template demo oauth2-proxy/oauth2-proxy -f -
{
  "ingress": {
    "enabled": true,
    "hosts": ["demo.fr"]
  }
}
EOF
[...]
# Source: oauth2-proxy/templates/ingress.yaml
[...]
spec:
  rules:
    - host: "demo.fr"
      http:
        paths:
          - path: /
            pathType: ImplementationSpecific
            backend:
              service:
                name: demo-oauth2-proxy
                port:                                            <======= missing

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions