helm/helm
View on GitHubHelm4 upgrade with dry-run and server-side enabled doesn't catch errors
Open
#31505 opened on Nov 13, 2025
Stalefeaturehelp wanted
Description
Hi.
Let's assume we have the following chart:
- Chart.yaml
apiVersion: v2
name: helm4-test
version: 1.0.0
- templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: bash
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: bash
app.kubernetes.io/instance: bash
template:
metadata:
labels:
app.kubernetes.io/name: bash
app.kubernetes.io/instance: bash
spec:
resources:
requests:
memory: "100Mi"
limits:
memory: "200Mi"
containers:
- image: bash
imagePullPolicy: IfNotPresent
name: bash
command: ["bash", "-c", "echo 'Hello, World!'"]
restartPolicy: Always
This is wrong spec - resources block is placed not under container.
Run helm dry-run with server-side:
helm upgrade test -n default --dry-run=server --server-side=true --install .
Result: No errors.
What is expected?
I expected that Helm4 should return error that resources is unknown field for spec.
Because if we run actual upgrade without dry-run, we will get the error:
╰─ helm upgrade test -n default --server-side=true --install .
Release "test" does not exist. Installing it now.
Error: failed to create typed patch object (default/bash; apps/v1, Kind=Deployment): .spec.template.spec.resources: field not declared in schema
Comparing to kubectl, if we use just deployment.yaml in apply command, it will catch the error:
╰─ kubectl apply --dry-run=server --server-side=true -f manifests.yaml
Error from server: failed to create typed patch object (default/bash; apps/v1, Kind=Deployment): .spec.template.spec.resources: field not declared in schema
╰─ kubectl apply --dry-run=server -f manifests.yaml
Error from server (BadRequest): error when creating "manifests.yaml": Deployment in version "v1" cannot be handled as a Deployment: strict decoding error: unknown field "spec.template.spec.resources"
Should Helm4 with server-side work the same way?
Otherwise, dry-run doesn't catch such errors and it can be a surprise in actual install/upgrade.
Tested on 1.28 k8s server
Helm 4.0.0