GoogleContainerTools / GoogleContainerTools/skaffold
setValues null values converted to <nil>
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
### Expected behavior
For a key in `setValues` either a value of `null` or `~` should result in a helm CLI `--set` value of `null` when using `skaffold deploy`
### Actual behavior
For a key in `setValues` either a value of `null` or `~` results in a helm CLI `--set` value of ``. This is treated as a string `""` by helm.
### Information
- Skaffold version: 2.0.4
- Operating system: Windows 11
- Installed via: Standalone EXE
- Contents of skaffold.yaml:
```yaml
apiVersion: skaffold/v4beta1
kind: Config
manifests:
helm:
releases:
- name: example
setValues:
example: null
example2: ~
deploy:
helm: {}
```
### Steps to reproduce the behavior
1. `skaffold deploy --verbosity debug`
```
time="2023-01-10T11:57:38Z" level=debug msg="Running command: [helm --kube-context REDACTED template example --set example= --set example2=]" subtask=0 task=Render
```
### Workaround
Due to the way string values have their quotes removed, a string `"null"` can be used to produce a value of `null`.
```yaml
apiVersion: skaffold/v4beta1
kind: Config
manifests:
helm:
releases:
- name: example
setValues:
example: "null"
deploy:
helm: {}
```
```
time="2023-01-10T12:03:02Z" level=debug msg="Running command: [helm --kube-context REDACTED template example --set example=null]" subtask=0 task=Render
```
Incidentally, this workaround relies on (in my opinion) another bug. The potential exists for unquoted strings to result in invalid helm CLI arguments e.g.
```
apiVersion: skaffold/v4beta1
kind: Config
manifests:
helm:
releases:
- name: example
setValues:
example: "value invalid-arg"
deploy:
helm: {}
```
```
time="2023-01-10T12:06:00Z" level=debug msg="Running command: [helm --kube-context REDACTED template example --set example=value invalid-arg]" subtask=0 task=Render
```
Contributor guide
Assessment
This issue has not been assessed yet.