cloudposse / cloudposse/charts

monochart fails to create ingress due to wrongly chosen API version

Open
#280 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Mustache
Stars
160
Forks
62
PR merge metrics
No merged PRs in 30d

Description

## Describe the Bug
monochart fails to create ingress when kube > 1.30 due to a problem in detecting kube version. For the example below, using helmfile:

```

- name: test
namespace: test
chart: cloudposse/monochart
version: ~0.25.0
values:
- ingress:
default:
enabled: true
className: nginx
port: http
pathType: ImplementationSpecific
hosts:
"foo.example.com": /

```

It fails with message:

```

Error: Failed to render chart: exit status 1: install.go:225: 2025-06-24 23:32:25.598827 -0300 -03 m=+0.019158251 [debug] Original chart version: "~0.25.0"
install.go:242: 2025-06-24 23:32:26.242879 -0300 -03 m=+0.663214876 [debug] CHART PATH: /Users/slaterx/Library/Caches/helm/repository/monochart-0.25.0.tgz
Error: unable to build kubernetes objects from release manifest: resource mapping not found for name: "test-default" namespace: "" from "": no matches for kind "Ingress" in version "networking.k8s.io/v1beta1"

```

You can notice the failure is so critical that it happens before monochart can detect chosen namespace for release. According to https://github.com/helm/helm/issues/12072, we should not use .GitVersion to detect kube version. However, inspecting [source for ingress in monochart](https://github.com/cloudposse/charts/blob/master/incubator/monochart/templates/ingress.yaml), we can see that:

```

{{- if semverCompare ">=1.19-0" $root.Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" $root.Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}

```

## Expected Behavior
ingress is defined in cluster under the chosen namespace

## Steps to Reproduce
Steps to reproduce the behavior:
1. Create ingress as per example above
2. run `helm install` (or if you use helmfile, run `helmfile -f apply`

## Screenshots
If applicable, add screenshots or logs to help explain your problem.

## Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:
- OS: macOS
- Version 0.25.0
- helm: 3.18.3
- helmfile: 1.1.2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.