Why doesn't "helm install --dry-run" give me an error about a conflict but an actual "helm install" does?

12/23/2020

I installed my app like this:

helm install my-app my-application/ --set externalName.namespace=app-layer

Checking the pods and services, everything installed correctly.

I then tried a dry-run expecting to get a conflict but it simply printed out the YAML and some info about the previous install.

helm install my-app my-application/ --set externalName.namespace=app-layer --dry-run

The above printed out:

NAME: my-app
LAST DEPLOYED: Tue Dec 22 19:52:33 2020
NAMESPACE: default
STATUS: pending-install
REVISION: 1
TEST SUITE: None
USER-SUPPLIED VALUES:
externalName:
  namespace: app-layer

COMPUTED VALUES:
#...elided by me...

HOOKS:
MANIFEST:
---
#...elided by me...

However, when I try to install I get this error:

Error: cannot re-use a name that is still in use

Why doesn't the dry run catch that?

-- Don Rhummy
kubernetes
kubernetes-helm
yaml

1 Answer

12/23/2020

In dry-run mode, the availableName check explicitly stops before actually checking if the name you've provided is in use. You'll still get a complaint if you explicitly give an empty name or if the name is longer than 53 characters.

Practically, I tend to use helm upgrade --install instead of helm install most of the time, since that will work even if the chart is already installed.

-- David Maze
Source: StackOverflow