-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Version
4.0.1
What Kubernetes platforms are you running on?
EKS Amazon
Steps to reproduce
Helm v3.18.5 changed the Go library for validating JSON Schema https://github.com/helm/helm/releases/tag/v3.18.5
helm/helm@cb8595b
which uncovered a problem with the nginx-ingress topologySpreadConstraints JSON schema in the Helm chart.
The problem is that the JSON schema incorrectly specifies controller.topologySpreadConstraints as object
https://github.com/nginx/kubernetes-ingress/blob/main/charts/nginx-ingress/values.schema.json#L919
but the referenced schema https://raw.githubusercontent.com/nginxinc/kubernetes-json-schema/master/v1.33.1/_definitions.json#/definitions/io.k8s.api.core.v1.PodSpec/properties/topologySpreadConstraints
specifies it (correctly) as "array"
How to reproduce
- Prepare
values-array.yaml
controller:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: "topology.kubernetes.io/zone"
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
helmapp.kubernetes.io/name: nginx-ingress
- connect Helm repo
helm repo add nginx https://helm.nginx.com/stable
- run local templating with Helm
❯ helm version
version.BuildInfo{Version:"v3.18.6", GitCommit:"b76a950f6835474e0906b96c9ec68a2eff3a6430", GitTreeState:"clean", GoVersion:"go1.25.0"}
❯ helm template nginx nginx/nginx-ingress -f values-array.yaml
Error: values don't meet the specifications of the schema(s) in the following chart(s):
nginx-ingress:
- at '/controller/topologySpreadConstraints': got array, want object
when JSON schema validation is disabled, it produces valid manifest
❯ helm template nginx nginx/nginx-ingress -f values-array.yaml --skip-schema-validation | kubeconform -strict -verbose
stdin - ConfigMap nginx-nginx-ingress-leader-election is valid
stdin - ServiceAccount nginx-nginx-ingress is valid
stdin - ConfigMap nginx-nginx-ingress is valid
stdin - ClusterRole nginx-nginx-ingress is valid
stdin - Role nginx-nginx-ingress is valid
stdin - RoleBinding nginx-nginx-ingress is valid
stdin - ClusterRoleBinding nginx-nginx-ingress is valid
stdin - Service nginx-nginx-ingress-controller is valid
stdin - IngressClass nginx is valid
stdin - Deployment nginx-nginx-ingress-controller is valid
stdin - Lease nginx-nginx-ingress-leader-election is valid
With older version of Helm this works just fine
❯ ~/tmp/helm-old version
version.BuildInfo{Version:"v3.18.4", GitCommit:"d80839cf37d860c8aa9a0503fe463278f26cd5e2", GitTreeState:"clean", GoVersion:"go1.24.4"}
❯ ~/tmp/helm-old template nginx nginx/nginx-ingress -f values-array.yaml
---
# Source: nginx-ingress/templates/controller-serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: nginx-nginx-ingress
namespace: default
labels:
helm.sh/chart: nginx-ingress-2.2.2
app.kubernetes.io/name: nginx-ingress
app.kubernetes.io/instance: nginx
app.kubernetes.io/version: "5.1.1"
app.kubernetes.io/managed-by: Helm
...
Metadata
Metadata
Assignees
Labels
Type
Projects
Status